summaryrefslogtreecommitdiffstats
path: root/kview
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
commit47d455dd55be855e4cc691c32f687f723d9247ee (patch)
tree52e236aaa2576bdb3840ebede26619692fed6d7d /kview
downloadtdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.tar.gz
tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.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/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kview')
-rw-r--r--kview/AUTHORS4
-rw-r--r--kview/ChangeLog98
-rw-r--r--kview/Makefile.am25
-rw-r--r--kview/TODO73
-rw-r--r--kview/config/Makefile.am21
-rw-r--r--kview/config/kview.setdlg219
-rw-r--r--kview/config/kviewconfmodules.cpp90
-rw-r--r--kview/config/kviewconfmodules.h47
-rw-r--r--kview/config/kviewgeneralconfig.desktop131
-rw-r--r--kview/config/plugins/Makefile.am17
-rw-r--r--kview/config/plugins/kviewpluginsconfig.cpp46
-rw-r--r--kview/config/plugins/kviewpluginsconfig.desktop118
-rw-r--r--kview/config/plugins/kviewpluginsconfig.h38
-rw-r--r--kview/hi16-app-kview.pngbin0 -> 943 bytes
-rw-r--r--kview/hi22-app-kview.pngbin0 -> 1506 bytes
-rw-r--r--kview/hi32-app-kview.pngbin0 -> 2592 bytes
-rw-r--r--kview/hi48-app-kview.pngbin0 -> 4918 bytes
-rw-r--r--kview/kimageviewer/Makefile.am18
-rw-r--r--kview/kimageviewer/canvas.cpp35
-rw-r--r--kview/kimageviewer/canvas.h348
-rw-r--r--kview/kimageviewer/kimageviewer.desktop63
-rw-r--r--kview/kimageviewer/kimageviewercanvas.desktop60
-rw-r--r--kview/kimageviewer/viewer.cpp36
-rw-r--r--kview/kimageviewer/viewer.h99
-rw-r--r--kview/kview.cpp698
-rw-r--r--kview/kview.desktop95
-rw-r--r--kview/kview.h124
-rw-r--r--kview/kviewcanvas/ChangeLog18
-rw-r--r--kview/kviewcanvas/Makefile.am18
-rw-r--r--kview/kviewcanvas/config/Makefile.am16
-rw-r--r--kview/kviewcanvas/config/confmodules.cpp145
-rw-r--r--kview/kviewcanvas/config/confmodules.h51
-rw-r--r--kview/kviewcanvas/config/defaults.h46
-rw-r--r--kview/kviewcanvas/config/generalconfigwidget.ui300
-rw-r--r--kview/kviewcanvas/config/kviewcanvasconfig.desktop118
-rw-r--r--kview/kviewcanvas/kimagecanvas.cpp953
-rw-r--r--kview/kviewcanvas/kimagecanvas.h366
-rw-r--r--kview/kviewcanvas/kimageholder.cpp371
-rw-r--r--kview/kviewcanvas/kimageholder.h105
-rw-r--r--kview/kviewcanvas/kviewcanvas.desktop63
-rw-r--r--kview/kviewcanvas/test/Makefile.am9
-rw-r--r--kview/kviewcanvas/test/main.cpp51
-rw-r--r--kview/kviewcanvas/test/test.cpp46
-rw-r--r--kview/kviewcanvas/test/test.h25
-rw-r--r--kview/kviewui.rc50
-rw-r--r--kview/kviewviewer/ChangeLog68
-rw-r--r--kview/kviewviewer/Makefile.am21
-rw-r--r--kview/kviewviewer/config/Makefile.am17
-rw-r--r--kview/kviewviewer/config/kviewviewerpluginsconfig.cpp48
-rw-r--r--kview/kviewviewer/config/kviewviewerpluginsconfig.desktop118
-rw-r--r--kview/kviewviewer/config/kviewviewerpluginsconfig.h38
-rw-r--r--kview/kviewviewer/imagesettings.cpp73
-rw-r--r--kview/kviewviewer/imagesettings.h45
-rw-r--r--kview/kviewviewer/kviewkonqextension.cpp105
-rw-r--r--kview/kviewviewer/kviewkonqextension.h52
-rw-r--r--kview/kviewviewer/kviewpopup.rc7
-rw-r--r--kview/kviewviewer/kviewviewer.cpp883
-rw-r--r--kview/kviewviewer/kviewviewer.desktop118
-rw-r--r--kview/kviewviewer/kviewviewer.h145
-rw-r--r--kview/kviewviewer/kviewviewer.rc36
-rw-r--r--kview/kviewviewer/kviewviewer_ro.rc34
-rw-r--r--kview/kviewviewer/kviewvieweriface.h30
-rw-r--r--kview/kviewviewer/printimagesettings.ui190
-rw-r--r--kview/kviewviewer/test/Makefile.am9
-rw-r--r--kview/kviewviewer/test/main.cpp51
-rw-r--r--kview/kviewviewer/test/test.cpp43
-rw-r--r--kview/kviewviewer/test/test.h25
-rw-r--r--kview/main.cpp70
-rw-r--r--kview/modules/Makefile.am1
-rw-r--r--kview/modules/NAMING4
-rw-r--r--kview/modules/README52
-rw-r--r--kview/modules/browser/Makefile.am15
-rw-r--r--kview/modules/browser/kmyfileitemlist.cpp41
-rw-r--r--kview/modules/browser/kmyfileitemlist.h39
-rw-r--r--kview/modules/browser/kviewbrowser.cpp179
-rw-r--r--kview/modules/browser/kviewbrowser.desktop130
-rw-r--r--kview/modules/browser/kviewbrowser.h62
-rw-r--r--kview/modules/browser/kviewbrowser.rc18
-rw-r--r--kview/modules/effects/Makefile.am15
-rw-r--r--kview/modules/effects/kvieweffects.cpp244
-rw-r--r--kview/modules/effects/kvieweffects.desktop119
-rw-r--r--kview/modules/effects/kvieweffects.h46
-rw-r--r--kview/modules/effects/kvieweffects.rc10
-rw-r--r--kview/modules/presenter/DESIGN42
-rw-r--r--kview/modules/presenter/Makefile.am17
-rw-r--r--kview/modules/presenter/config/Makefile.am17
-rw-r--r--kview/modules/presenter/config/kviewpresenterconfig.cpp72
-rw-r--r--kview/modules/presenter/config/kviewpresenterconfig.desktop120
-rw-r--r--kview/modules/presenter/config/kviewpresenterconfig.h46
-rw-r--r--kview/modules/presenter/imagelistdialog.ui289
-rw-r--r--kview/modules/presenter/imagelistdialog.ui.h23
-rw-r--r--kview/modules/presenter/imagelistitem.cpp82
-rw-r--r--kview/modules/presenter/imagelistitem.h49
-rw-r--r--kview/modules/presenter/kviewpresenter.cpp492
-rw-r--r--kview/modules/presenter/kviewpresenter.desktop118
-rw-r--r--kview/modules/presenter/kviewpresenter.h103
-rw-r--r--kview/modules/presenter/kviewpresenter.rc20
-rw-r--r--kview/modules/presenter/kviewpresenterconfmodule.cpp60
-rw-r--r--kview/modules/presenter/kviewpresenterconfmodule.h49
-rw-r--r--kview/modules/scale/Makefile.am15
-rw-r--r--kview/modules/scale/kfloatspinbox.cpp116
-rw-r--r--kview/modules/scale/kfloatspinbox.h64
-rw-r--r--kview/modules/scale/kview_scale.cpp180
-rw-r--r--kview/modules/scale/kview_scale.desktop127
-rw-r--r--kview/modules/scale/kview_scale.h48
-rw-r--r--kview/modules/scale/kview_scale.rc14
-rw-r--r--kview/modules/scale/scaledlg.cpp311
-rw-r--r--kview/modules/scale/scaledlg.h78
-rw-r--r--kview/modules/scanner/Makefile.am15
-rw-r--r--kview/modules/scanner/kviewscanner.cpp96
-rw-r--r--kview/modules/scanner/kviewscanner.desktop127
-rw-r--r--kview/modules/scanner/kviewscanner.h50
-rw-r--r--kview/modules/scanner/kviewscanner.rc12
-rw-r--r--kview/modules/template/Makefile.am15
-rw-r--r--kview/modules/template/kviewtemplate.cpp43
-rw-r--r--kview/modules/template/kviewtemplate.desktop129
-rw-r--r--kview/modules/template/kviewtemplate.h27
-rw-r--r--kview/modules/template/kviewtemplate.rc11
-rw-r--r--kview/photobook/Makefile.am19
-rw-r--r--kview/photobook/cr16-app-photobook.pngbin0 -> 720 bytes
-rw-r--r--kview/photobook/cr22-app-photobook.pngbin0 -> 922 bytes
-rw-r--r--kview/photobook/photobook.cpp292
-rw-r--r--kview/photobook/photobook.desktop131
-rw-r--r--kview/photobook/photobook.h140
-rw-r--r--kview/photobook/photobookui.rc14
-rw-r--r--kview/version.h3
126 files changed, 12131 insertions, 0 deletions
diff --git a/kview/AUTHORS b/kview/AUTHORS
new file mode 100644
index 00000000..63f21e88
--- /dev/null
+++ b/kview/AUTHORS
@@ -0,0 +1,4 @@
+
+Written by Sirtaj Singh Kang <taj@kde.org>
+KOM/OpenParts integration done by Simon Hausmann
+Rewritten by Matthias Kretz (current Maintainer)
diff --git a/kview/ChangeLog b/kview/ChangeLog
new file mode 100644
index 00000000..e24c55e2
--- /dev/null
+++ b/kview/ChangeLog
@@ -0,0 +1,98 @@
+2003-10-06 Matthias Kretz <kretz@kde.org>
+
+ * config/plugins/kviewpluginsconfig.cpp:
+ Don't show an empty config page in the pluginselector (there are no
+ KView plugins with config options, yet).
+
+2003-09-27 Matthias Kretz <kretz@kde.org>
+
+ * config/kviewconfmodules.cpp:
+ Call sync() in save() on the KConfig object.
+
+2003-08-19 Matthias Kretz <kretz@kde.org>
+
+ * kview.cpp:
+ Use boundImageTo instead of ugly hack.
+ * kview.{h.cpp}:
+ New method loadFromStdin().
+ * main.cpp:
+ If args is - load image from stdin.
+ * Makefile.am:
+ remove kviewviewer files from messages target
+ * Makefile.am:
+ remove kviewcanvas files from messages target
+
+2003-07-11 Matthias Kretz <kretz@kde.org>
+
+ * kviewviewer/kviewviewer.cpp:
+ Use KMimeType::findByFileContent if KImageIO::type fails to
+ get the type.
+
+2003-06-14 Matthias Kretz <kretz@kde.org>
+
+ * kimageviewer/canvas.h:
+ New method boundImageTo( QSize ). Makes fit image to widget
+ size a lot nicer.
+ * kview.cpp, kviewviewer/kviewviewer.cpp:
+ Use the new boundImageTo() method.
+
+2003-05-01 Matthias Kretz <kretz@kde.org>
+
+ * kview.cpp:
+ New method loadFromStdin() that reads the image from stdin
+ into a QByteArray constructs a QImage and passes that to
+ KImageViewer::Viewer::newImage().
+ * main.cpp:
+ Check for args-url(0) being "-" and open image from stdin
+ then.
+
+2003-04-10 Matthias Kretz <kretz@kde.org>
+
+ * modules/presenter/kviewpresenter.cpp:
+ Allow drops of KURLDrags on the main view, too. This is done
+ by the KViewPresenter installing an event filter on the
+ m_pViewer->widget() and handling them just like the drops on
+ the image list.
+
+2003-04-03 Matthias Kretz <kretz@kde.org>
+
+ * modules/presenter/kviewpresenter.cpp:
+ s/QUriDrag/KURLDrag/
+
+2003-03-09 Matthias Kretz <kretz@kde.org>
+
+ * modules/effects/kvieweffects.cpp:
+ Initialize m_intensity and m_lastintensity.
+
+2003-03-07 Matthias Kretz <kretz@kde.org>
+
+ * modules/effects/kvieweffects.{cpp,h,rc}:
+ New effect: "Change Intensity". Uses KImageEffect::intensity()
+ with configurable, guess what, intensity.
+ Added helper function workImage() to copy the canvas' image
+ into m_image and create a detached QImage to apply the effect
+ on.
+ * modules/effects/kvieweffects.cpp:
+ Call setModified( true ) on the Viewer so that saving the
+ image will work correctly
+ * modules/effects/kvieweffects.{cpp,h,rc}:
+ New effect: "Blend Color". Uses KImageEffect::blend() with
+ configurable color and opacity.
+
+2003-03-06 Matthias Kretz <kretz@kde.org>
+
+ * modules/effects/*:
+ New module: KViewEffects. I implemented a simple gamma
+ correction filter using KIconEffect::toGamma().
+ * kview.desktop:
+ Changed MimeType field to support pbm, pnm, ppm and pgm.
+ Is the image/x-png still needed?
+
+2003-03-04 Matthias Kretz <kretz@kde.org>
+
+ * TODO:
+ added the architectural thoughts I had today
+ * ChangeLog:
+ started a ChangeLog (like you can see)
+
+# vim: sw=4 ts=4 tw=80 noet
diff --git a/kview/Makefile.am b/kview/Makefile.am
new file mode 100644
index 00000000..2acb3133
--- /dev/null
+++ b/kview/Makefile.am
@@ -0,0 +1,25 @@
+SUBDIRS = kimageviewer . config kviewcanvas kviewviewer modules photobook
+
+INCLUDES = -I$(top_srcdir)/kview $(all_includes)
+
+METASOURCES = AUTO
+
+bin_PROGRAMS =
+lib_LTLIBRARIES =
+kdeinit_LTLIBRARIES = kview.la
+
+noinst_HEADERS = kview.h
+
+kview_la_SOURCES = kview.cpp main.cpp
+kview_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) -module -avoid-version
+kview_la_LIBADD = $(LIB_KPARTS) $(LIB_KUTILS)
+
+xdg_apps_DATA = kview.desktop
+
+KDE_ICON = kview
+
+rcdir = $(kde_datadir)/kview
+rc_DATA = kviewui.rc
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/kview.pot
diff --git a/kview/TODO b/kview/TODO
new file mode 100644
index 00000000..e8515db1
--- /dev/null
+++ b/kview/TODO
@@ -0,0 +1,73 @@
+- regression: did the last change from bmeyer break resize handling when the
+ statusbar is shown/hidden? How can it be fixed if not reverted?
+
+- KView Canvas Widget
+ - alpha blending
+ - faster zooming (how? perhaphs I can create smaller pixmaps and only the ones visible are
+ really calculated and shown)
+ - partial loading
+
+- Configuration Dlg
+
+- Printing
+ - Gibt es einen Befehl, mit dem man z.B. Fotogre 9x13 bzw. 10x15 eingeben
+ kann? (option in printing dialog to select photo size 9x13, 10x15)
+ - print in original size (look at dpi info in image file if present and
+ allow the user to override the value)
+
+- Architectural stuff
+ - Add "playlist" to the imageviewer interface:
+ The Viewer should support, somehow, that a list of images is to be shown as
+ a slideshow. Plugins can then work with that "playlist" instead of messing
+ around with internals like the presenter plugin does.
+ - This would make preloading (and caching) the images possible.
+ - Caching: currently the canvas doesn't do anything with files while the
+ viewer only calls QImage( QByteArray ) or QImage( filename ). Therefor the
+ Viewer has to cache the loading of images while the canvas would have to
+ cache the zoomed images and pixmaps.
+ It would be no problem to make the canvas work on files and bytearrays
+ (with the additional way of passing QImages) and make the Viewer only use
+ the Canvas' functionality in working with images. The Viewer would
+ basically rely on the canvas for most of the work.
+
+- Effects Plugin:
+ - Good enough for now, but if this plugin should support more effects I
+ should think about creating an interface for effect classes:
+ Something like:
+ class Effect
+ {
+ QString dialogTitle() const = 0;
+ QWidget * dialogWidget() = 0;
+ /* @returns whether @ref applyEffect() would create the same image as
+ * last time or a changed one */
+ bool changed() const = 0;
+ void applyEffect( QImage & ) = 0;
+ };
+ - Brightness Adjustment
+ - Greyscale conversion
+ - Smoothing
+
+- Image info
+
+- Handle resizing of the image area using an event filter? Instead of calling
+ handleResize() everywhere it could resize the image area this would always
+ call the function when the image area resizes (if it works).
+
+- show modified state in titlebar
+
+- new config option to set KView into read-only mode: remove all edit
+ functionality and use the ReadOnly KPart. This disables the annoying question
+ whether you want to save changes when all you wanted to do was to look at the
+ image from a different angle :-)
+
+- If an image is deleted but hasn't changed in the viewer it might happen that
+ you can't save the file again.
+ KView should stat the file and if it's deleted save it regardless of whether
+ the image was modified or not.
+
+- move the configuration of resize handling into a menu and remove it from the
+ configuration dialog (or should it be kept - dunno)
+
+- config option to always rotate the image so that it's shown with maximum size
+
+# vim: sw=4 ts=4 tw=80
diff --git a/kview/config/Makefile.am b/kview/config/Makefile.am
new file mode 100644
index 00000000..84f5aabd
--- /dev/null
+++ b/kview/config/Makefile.am
@@ -0,0 +1,21 @@
+SUBDIRS = . plugins
+INCLUDES = $(all_includes)
+
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = kcm_kviewgeneralconfig.la
+
+noinst_HEADERS = kviewconfmodules.h
+
+kcm_kviewgeneralconfig_la_SOURCES = kviewconfmodules.cpp
+kcm_kviewgeneralconfig_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+kcm_kviewgeneralconfig_la_LIBADD = $(LIB_KDEUI)
+
+kcm_kviewgeneralconfig_DATA = kviewgeneralconfig.desktop
+kcm_kviewgeneralconfigdir = $(kde_servicesdir)/kconfiguredialog
+
+kviewappdatadir = $(kde_datadir)/kview
+kviewappdata_DATA = kview.setdlg
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/kcm_kviewgeneralconfig.pot
diff --git a/kview/config/kview.setdlg b/kview/config/kview.setdlg
new file mode 100644
index 00000000..99347b8f
--- /dev/null
+++ b/kview/config/kview.setdlg
@@ -0,0 +1,219 @@
+[Viewer]
+Name=Viewer
+Name[ar]=العارض
+Name[bg]=Визуализатор
+Name[br]=Gweler
+Name[bs]=Preglednik
+Name[ca]=Visualitzador
+Name[cs]=Prohlížeč
+Name[cy]=Gwelydd
+Name[da]=Fremviser
+Name[de]=Betrachter
+Name[el]=Προβολέας
+Name[eo]=Rigardilo
+Name[es]=Visor
+Name[et]=Näitaja
+Name[eu]=Ikustailua
+Name[fa]=مشاهده‌گر
+Name[fi]=Näytin
+Name[fr]=Afficheur
+Name[gl]=Visor
+Name[he]=מציג
+Name[hi]=प्रदर्शक
+Name[hu]=Nézegető
+Name[is]=Birtir
+Name[it]=Visore
+Name[ja]=ビューア
+Name[kk]=Кескінді қарау
+Name[km]=កម្មវិធី​មើល
+Name[lt]=Žiūriklis
+Name[ms]=Pemapar
+Name[nb]=Fremviser
+Name[nds]=Kieker
+Name[ne]=दर्शक
+Name[nl]=Weergaveprogramma
+Name[nn]=Framvisar
+Name[pa]=ਦਰਸ਼ਕ
+Name[pl]=Przeglądarka obrazków
+Name[pt]=Visualizador
+Name[pt_BR]=Visualizador
+Name[ro]=Vizualizor
+Name[ru]=Просмотрщик
+Name[se]=Čájeheaddji
+Name[sk]=Prehliadač
+Name[sl]=Pregledovalnik
+Name[sr]=Приказивач
+Name[sr@Latn]=Prikazivač
+Name[sv]=Visning
+Name[ta]=காட்சி
+Name[tg]=Намоишгар
+Name[tr]=Görüntüleyici
+Name[uk]=Переглядач
+Name[uz]=Koʻruvchi
+Name[uz@cyrillic]=Кўрувчи
+Name[wa]=Håyneu
+Name[zh_CN]=查看器
+Name[zh_HK]=檢視器
+Comment=This is the configuration for the part of KView that can be reused by other applications (meaning that the settings will also affect the KView part that gets embedded into Konqueror or other applications).
+Comment[ar]=هذه الإعدادات هي لجزء برنامج KView الذي يدمج في داخل متصفح Konqueror والبرامج الأخرى
+Comment[bg]=Настройване на модулите на KView, които могат да бъдат използвани в другите програми. Това означава, че настройките ще имат ефект навсякъде, където се използва съответния модул.
+Comment[bs]=Ovo je konfiguracija dijela KView-a kojeg mogu koristiti druge aplikacije (što znači da će se ove postavke takođe odraziti na KView dio koji se ugrađuje u Konqueror i druge aplikacije).
+Comment[ca]=Aquesta és la configuració de la part de KView que es pot reutilitzar per altres aplicacions (vol dir que els paràmetres també afectaran la part KView que està incrustada dins el Konqueror o altres aplicacions).
+Comment[cs]=Toto je konfigurace komponenty KView, kterou lze použít v jiným aplikacích. To znamená, že nastavení ovlivní také aplikace, které tuto komponentu používají, např. Konqueror.
+Comment[da]=Dette er indstillingen for den del af KView der kan genbruges af andre programmer (hvilket detyder at opsætningen også vil påvirke den KView-part der bliver indlejret i Konqueror eller andre programmer).
+Comment[de]=Dies sind die Einstellungen für die KView-Komponente, die von anderen Anwendungen verwendet werden kann. Das bedeutet, dass diese Einstellungen auch die KView-Komponente betreffen, die in Konqueror und andere Anwendungen eingebettet wird.
+Comment[el]=Αυτή είναι η ρύθμιση του τμήματος του KView που μπορεί να χρησιμοποιηθεί και από άλλες εφαρμογές (που σημαίνει ότι οι ρυθμίσεις θα επηρεάσουν επίσης το τμήμα του KView που ενσωματώνεται στον Konqueror ή σε άλλες εφαρμογές).
+Comment[es]=Esta la configuración para la parte de KView que puede ser reutilizada por otras aplicaciones (teniendo en consideración que las preferencias también afectarán a la parte incrustada en Konqueror o en otras aplicaciones).
+Comment[et]=Siin saab seadistada KView seda osa, mida saavad kasutada ka teised rakendused (see tähendab, et siinmääratu mõjutab ka seda, mida teeb Konquerori või muudesse rakendustesse põimitud KView komponent).
+Comment[eu]=Hau da KView-en beste aplikazioek aprobetxa dezaketenaren konfigurazioa (hau da, ezarpen hauek Konqueror-ek edo beste aplikazioek erabiltzen duten KView-en zatietan eragingo dute)
+Comment[fa]= این پیکربندی برای جزئی از KView است که می‌توان آن را توسط کاربردهای دیگر مجدداً استفاده کرد )یعنی این که تنظیمات هم بر جزئی از KView که در Konqueror یا کاربردهای دیگر نهفته می‌‌شود، اثر می‌گذارد).
+Comment[fi]=Nämä asetukset ovat KView-ohjelman osalle, jota voidaan käyttää muissa sovelluksissa (asetukset vaikuttavat KView-sovellukseen, joka upotetaan eri ohjelmiin, kuten Konqueroriin)
+Comment[fr]=C'est la configuration pour la partie de KView qui peut être réutilisée par les autres applications (ce qui signifie que les réglages affecteront aussi le composant KView qui est intégré dans Konqueror ou les autres applications).
+Comment[gl]=Esta é a configuración para as partes de KView que poden ser rempregadas por otras aplicacións (Isto é que as configuracións que afectán a KView tamén o farán coa parte deste integrada en Konqueror ou noutras aplicaccións).
+Comment[hu]=Ezek a KView beágyazható, más alkalmazásokban felhasználható változatának beállításai (tehát a beállítások kihatással vannak a Konquerorba és más alkalmazásokba beágyazott megjelenítőkre).
+Comment[is]=Þetta eru stillingar þess hluta KView sem önnur forrit geta notað (sem þýðir að þessar stillingar hafa einnig áhrif á KView hlutann sem er byggður inn í Konqueror og önnur forrit).
+Comment[it]=Questa è la configurazione per il componente di KView riutilizzabile da altre applicazioni (cioè le impostazioni avranno effetto per il componente KView integrabile in Konqueror e altre applicazioni).
+Comment[ja]=これは他のアプリケーションでも利用される、KView の一部分の設定です。(この設定は Konqueror や他のアプリケーションに埋め込まれる KView にも影響を与えます)
+Comment[kk]=Бұл басқа бағдарламалар қолдана алатын KView бөлшегінің баптауы (баптаулары Konqueror не басқа қолданбалардың құрамына ендірілетін KView бөлшегіне де тиісті).
+Comment[km]=នេះ​ជា​ការ​កំណត់​រចនាសម្ព័ន្ធ សម្រាប់​ផ្នែក​របស់ KView ដែល​អាច​ត្រូវ​បាន​ប្រើ​ម្ដង​ទៀត​ដោយ​កម្មវិធី​ផ្សេង​ទៀត (មាន​ន័យ​ថា ផ្នែក KView ដែល​បាន​បង្កប់​នៅ​ក្នុង Konqueror ឬ កម្មវិធី​ផ្សេង​ទៀត) ។
+Comment[lt]=Tai yra KView konfigūracija, kuri gali būti naudojama ir kitų programų (tai yra, šie nustatymai taip pat bus naudojami ir KView programiniam moduliui, įterpiamam į Konqueror ir kitas programas).
+Comment[ms]=Ini ialah konfigurasi sebahagian KView yang boleh diguna semula oleh aplikasi lain (bermakna seting juga akan memberikan kesan kepada bahagian KPapar yang dibenamkan dalam Konqueror atau aplikasi lain).
+Comment[nb]=Dette er oppsettet av den delen av KView som kan gjenbrukes i andre programmer. (Innstillingene her vil påvirke den KView-modulen som blir bygd inn i Konqueror eller andre programmer.)
+Comment[nds]=Dit sünd de Instellen för de KView-Komponent, de sik ok vun anner Programmen bruken lett. Dat bedüüdt, dat disse Instellen ok de KView-Komponent bedraapt, de in Konqueror oder anner Programmen inbett sünd.
+Comment[ne]=अन्य अनुप्रयोगद्वारा पुन: प्रयोग गर्न सक्ने केडीई दर्शकको भागका लागि यो कन्फिगरेसन हो ( अन्य अनुप्रयोग वा कन्क्वेररमा सम्मिलित के दर्शकको भागलाई पनि प्रभाव पार्ने सेटिङ भन्ने बुझिन्छ )
+Comment[nl]=Dit zijn de instellingen van het onderdeel van KView dat ook door andere toepassingen gebruikt kan worden. Deze instellingen betreffen dus ook de KView Part zoals die in Konqueror of andere toepassingen kan worden ingebed.
+Comment[nn]=Dette er oppsettet av den delen av KView som kan brukast opp att i andre program. (Innstillingane her vil påverka den KView-modulen som vert bygd inn i Konqueror eller andre program.)
+Comment[pl]=To jest konfiguracja osadzonej części KView, która może być osadzana w innych programach (co oznacza, że te ustawienia będą dotyczyć również części KView osadzonej w Konquerorze lub innych programach).
+Comment[pt]=Esta é a configuração da componente do KView que poderá ser usada pelas outras aplicações (o que significa que a configuração também irá afectar a componente do KView que está incorporada no Konqueror e noutras aplicações).
+Comment[pt_BR]=Esta é a configuração para o componente do KView que pode ser reutilizado por outras aplicações (o que significa que todas as configurações afetarão também o componente do KView que obtém a integração junto com o Konqueror e outras aplicações).
+Comment[ro]=Aceasta este configurarea pentru partea KView care poate fi reutilizată de alte aplicaţii. Setările afectează acea parte de KView care este înglobată în Konqueror sau alte aplicaţii.
+Comment[ru]=Настройки компонента KView, который используется другими приложениями (устанавливают поведение компонента, внедрённого в Konqueror или другие приложения).
+Comment[sk]=Toto je konfigurácia pre KView, ktorý je možné použiť vo viacerých aplikáciách (takže zmeny tohto nastavenia sa prejavia vo všetkých aplikáciách, ktoré by KView použili, ako je Konqueror alebo iné).
+Comment[sl]=To so nastavitve za del KView, ki ga lahko uporabijo tudi drugi programi (kar pomeni, da nastavitve veljajo tudi za del KView, ki je vključen v Konqueror in druge programe).
+Comment[sr]=Ово је подешавање за део KView-а који могу користити и други програми (што значи да ће поставке утицати и на KView-ов део који се уграђује у Konqueror и друге програме).
+Comment[sr@Latn]=Ovo je podešavanje za deo KView-a koji mogu koristiti i drugi programi (što znači da će postavke uticati i na KView-ov deo koji se ugrađuje u Konqueror i druge programe).
+Comment[sv]=Det här är inställningen av den del av Kview som kan återanvändas av flera program (vilket betyder att inställningarna också påverkar Kview-delen som bäddas in i Konqueror eller andra program).
+Comment[ta]=இது கேகாட்சியின் பகுதிக்கான வடிவமைப்பு. இதை மற்ற பயன்பாடுகளுக்காக திரும்ப பயன்படுத்தலாம். அந்த அமைப்புகள் கேகாட்சி பகுதியை பாதிக்கும். அந்த அமைப்புகள் கான்கொரர் அல்லது மற்ற பயன்பாடுகளிலும் பொதிந்துவிடும்.
+Comment[tg]=Танзимоти қисмати KView, ки бо дигар барномаҳо (рафтори қисматро, ки ба дохили Konqueror ҷорӣ шудааст ё дигар барномаҳоро низ танзим мекунад) истифода мешавад.
+Comment[tr]=Bu KView'in diğer programlar tarafından tekrar kullanılabilecek ayarlarıdır (Bu KView'in Konqueror veya diğer programlar altında çalışan gömülü parçalarını da etkiler).
+Comment[uk]=Це параметри складової KView, які можуть бути використані багатьма програмами (тобто, зміни значень цих параметрів будуть впливати на складову KView вмонтовану у Konqueror та інші програми).
+Comment[zh_CN]=这是可被其它应用程序重用的 KView 部分的配置(这意味着,这里的设置也会影响嵌入到 Konqueror 或其它应用程序中的 KView 部分)。
+Comment[zh_HK]=這是可復用於其他應用程式的 KView 設定的一部份(意即設置會同時影響嵌入到 Konqueror 或其他應用程式的 KView 部份)。
+Comment[zh_TW]=這部份的 KView 設定可被其他應用程式一起使用,(也就是說這裡的設定也會影響其他應用程式)。
+Weight=1
+[Application]
+Name=Application
+Name[ar]=التطبيق
+Name[az]=Proqram
+Name[bg]=Програма
+Name[br]=Arload
+Name[bs]=Program
+Name[ca]=Aplicació
+Name[cs]=Aplikace
+Name[cy]=Cymhwysiad
+Name[da]=Program
+Name[de]=Anwendung
+Name[el]=Εφαρμογή
+Name[eo]=Aplikaĵo
+Name[es]=Aplicación
+Name[et]=Rakendus
+Name[eu]=Aplikazioa
+Name[fa]=کاربرد
+Name[fi]=Sovellus
+Name[ga]=Feidhmchlár
+Name[gl]=Aplicación
+Name[he]=יישום
+Name[hi]=अनुप्रयोग
+Name[hr]=Program
+Name[hu]=Alkalmazás
+Name[id]=Aplikasi
+Name[is]=Forrit
+Name[it]=Applicazione
+Name[ja]=アプリケーション
+Name[kk]=Қолданба
+Name[km]=កម្មវិធី
+Name[lt]=Programa
+Name[lv]=Aplikācija
+Name[mk]=Апликација
+Name[ms]=Aplikasi
+Name[mt]=Programm
+Name[nb]=Program
+Name[nds]=Programm
+Name[ne]=अनुप्रयोग
+Name[nl]=Toepassing
+Name[nn]=Program
+Name[pa]=ਕਾਰਜ
+Name[pl]=Program
+Name[pt]=Aplicação
+Name[pt_BR]=Aplicativo
+Name[ro]=Aplicaţie
+Name[ru]=Приложение
+Name[rw]=Porogaramu
+Name[se]=Prográmma
+Name[sk]=Aplikácia
+Name[sl]=Program
+Name[sr]=Програм
+Name[sr@Latn]=Program
+Name[sv]=Program
+Name[ta]=பயன்பாடு
+Name[tg]=Барнома
+Name[th]=แอพพลิเคชัน
+Name[tr]=Uygulama
+Name[uk]=Програма
+Name[uz]=Dastur
+Name[uz@cyrillic]=Дастур
+Name[ven]=Apulifikhesheni
+Name[wa]=Programe
+Name[xh]=Isicelo
+Name[zh_CN]=应用程序
+Name[zh_HK]=應用程式
+Name[zh_TW]=應用程式
+Name[zu]=Isicelo
+Comment=Here you can set options that are special for the KView application when running stand-alone. What you change in here will not affect other applications.
+Comment[ar]=هنا يمكنك اختار الاختيارات الخاصة بتطبيق KView المستقل. أي تغيير هنا لن يؤثر على التطبيقات الأخرى.
+Comment[bg]=Настройване на самостоятелната програма KView. Това означава, че настройките ще имат ефект само за програмата KView и останалите програми, които ползват същите модули, няма да бъдат повлияни.
+Comment[bs]=Ovdje možete podesiti opcije koje su specifične za KView samostalnu aplikaciju. Ono što ovdje promijenite se neće odraziti na druge aplikacije.
+Comment[ca]=Aquí podeu establir les opcions específiques de l'aplicació KView quan s'executa autonomament. El que es canviï aquí no afectarà a les altres aplicacions.
+Comment[cs]=Zde vidíte možnosti, které jsou specifické pro samostatnou aplikaci KView. Změny zde neovlivní ostatní aplikace.
+Comment[cy]=Yma gallwch osod dewisiadau sy'n arbennig i'r cymhwysiad KGweld tra'n rhedeg yn arunigol. Ni fydd y newidiadau a wneir yma yn effeithio cymwysiadau eraill.
+Comment[da]=Her kan du sætte de valgmuligheder der er specielle for KView-programmet når det køres alenestående. Det du ændrer her vil ikke påvirke andre programmer.
+Comment[de]=Hier können Sie Einstellungen festlegen, die nur für die Anwendung KView gelten. Hier vorgenommene Änderungen betreffen keine andere Anwendung.
+Comment[el]=Εδώ μπορείτε να ορίσετε επιλογές που αφορούν την εφαρμογή KView όταν εκτελείται μόνη της. Ότι αλλάξετε εδώ δε θα επηρεάσει άλλες εφαρμογές.
+Comment[es]=Aquí puede establecer las opciones para KView cuando este se ejecute de modo independiente. Los cambios realizados aquí no afectarán a otras aplicaciones.
+Comment[et]=Siin saab määrata seadistusi, mis toimivad ainult siis, kui KView on käivitatud iseseisva rakendusena. Siinmääratav ei mõjuta seda, kuidas KView komponent toimib muudes rakendustes.
+Comment[eu]=Hemen KView-erako bereziak diren aukerak ezar ditzakezu. Hemen alda dezakezunak ez du eraginik izanen beste aplikazioetan
+Comment[fa]=در اینجا هنگام اجرای خوداتکا می‌توانید گزینه‌هایی را که برای کاربرد KView ویژه هستند را تنظیم کنید. آنچه در اینجا تغییر می‌دهید بر کاربردهای دیگر اثر نمی‌گذارد.
+Comment[fi]=Tästä voidaan asettaa omia asetuksia erilliselle KView-sovellukselle. Nämä asetukset eivät vaikuta muihin sovelluksiin.
+Comment[fr]=Ici, vous pouvez déterminer les options spéciales pour l'application KView lorsqu'elle fonctionne isolément. Ce que vous changez ici n'affectera pas les autres applications.
+Comment[gl]=Elixe aquí as opcións especiais para KView cando funciona por si mesma. O que cambies neste lugar non afectará a outras aplicacións.
+Comment[hu]=Itt a KView önállóan futtatható változatára érvényes beállításokat lehet módosítani. Ezek a beállítások tehát nem befolyásolják más alkalmazások működését.
+Comment[is]=Hér getur þú stillt eiginleika KView forritsins þegar það keyrir eitt og sér. Stillingar hér hafa engin áhrif á önnur forrit.
+Comment[it]=Qui puoi impostare le opzioni che riguardano l'applicazione KView quando è eseguita da sola. Quello che cambi qui non ha effetto in altre applicazioni.
+Comment[ja]=ここではスタンドアロンで実行される KView 用のオプションを設定します。ここでの変更は他のアプリケーションに影響を及ぼしません。
+Comment[kk]=Бұл жеке-дара KView қолданбаның баптауы. Басқа қолданбаларға бұның әсері жоқ.
+Comment[km]=នៅ​ទីនេះ អ្នក​អាច​កំណត់​ជម្រើស​ពិសេសៗ​សម្រាប់​កម្មវិធី KView នៅ​ពេល​វា​រត់​តែ​ឯង ។ អ្វី​ដែល​អ្នក​ផ្លាស់ប្ដូរ​នៅ​ទីនេះ នឹង​មិន​ប៉ះពាល់​ដល់​កម្មវិធី​ផ្សេង​ទៀត​ឡើយ ។
+Comment[lt]=Čia galite nustatyti parinktis, kurios bus naudojamos tik tuo atveju, jei KView veikia kaip nepriklausoma programa. Čia atlikti pakeitimai nepakeis kitų programų darbo.
+Comment[ms]=Di sini anda boleh set opsyen yang khas kepada aplikasi KView apabila dilancar secara tunggal. Apa yang anda ubah di sini tidak akan memberikan kesan kepada aplikasi lain.
+Comment[nb]=Her finner du innstillinger som bare påvirker KView som frittstående program. Disse innstillingene har ingenting å si for andre programmer.
+Comment[nds]=Hier laat sik de Instellen fastleggen, de bloots för dat KView-Enkelprogramm gellt. Wat Du hier ännerst, bedröppt keen anner Programmen.
+Comment[ne]=यहाँ तपाईँले स्यान्ड अलोन चलिरहेको बेलामा केडीई दृश्य अनुप्रयोगका लागि विशेष विकल्प सेट गर्न सक्नुहुन्छ । तपाईँको यहाँको परिवर्तनले अन्य अनुप्रयोगलाई प्रभाव पार्ने छैन ।
+Comment[nl]=Deze instellingen gelden alleen voor de KView-toepassing op zichzelf. Wat u hier instelt heeft geen invloed op andere toepassingen.
+Comment[nn]=Her finn du innstillingar som berre påverkar KView som frittståande program. Desse innstillingane har ingenting å seia for andre program.
+Comment[pl]=Tutaj można zmienić ustawienia, które będą używane, gdy KView jest uruchamiane jako oddzielny program. Zmiany dokonane tutaj nie będą miały wpływu na inne programy.
+Comment[pt]=Aqui você poderá definir as opções que são específicas para a aplicação KView quando corre autonomamente. O que você alterar aqui não irá afectar as outras aplicações.
+Comment[pt_BR]=Aqui você pode configurar as opções que são especiais para o KView, quando estiver rodando independentemente. O que você mudar aqui não afetará outras aplicações.
+Comment[ro]=Aici puteţi seta opţiuni care sînt specifice aplicaţiei KView de sine stătătoare. Cînd le modificaţi celelalte aplicaţii nu vor fi afectate.
+Comment[ru]=Настройки приложения KView, запущенного отдельно. Эти настройки не касаются других приложений, в которые внедряется компонент KView.
+Comment[sk]=Tu môžete nastaviť voľby, ktoré sú špeciálne pre samostatnú aplikáciu KView. Čo zmeníte tu neovplyvní ostatné aplikácie.
+Comment[sl]=Tu lahko nastavite možnosti, ki so posebne samo za program KView, ko teče samostojno. Kar spremenite tu, se ne bo poznalo v drugih programih.
+Comment[sr]=Овде можете поставити опције које су посебне за програм KView, када се он извршава самостално. Оно што овде промените неће утицати на друге програме.
+Comment[sr@Latn]=Ovde možete postaviti opcije koje su posebne za program KView, kada se on izvršava samostalno. Ono što ovde promenite neće uticati na druge programe.
+Comment[sv]=Här kan du ställa in alternativ som bara gäller för Kview-programmet när det körs själv. Det du ändrar här påverkar inte andra program.
+Comment[ta]=தனியான இயக்கத்தின்போது கேகாட்சிக்கான விசேஷ தேர்வுகளை இங்கே அமைக்கலாம். நீங்கள் இங்கே செய்யும் மாற்றங்கள் மற்ற பயன்பாடுகளை பாதிக்காது.
+Comment[tg]=Танзимоти барномаи KView, ки ҷудо оғоз шуда буд. Ин танзимотҳо дигар барномаҳоро, ки дар он қисмати KView дохил мешавад дар бар намегирад.
+Comment[tr]=Burada KView programı yanlız (standalone) çalışırken özel olan seçeneklerinizi belirleyebilirsiniz. Burada yaptığınız değişiklikler diğer programları etkilemeyecektir.
+Comment[uk]=Тут ви можете встановити значення параметрів для програми KView, коли вона виконується окремо. Зміни тут не будуть впливати на інші програми.
+Comment[zh_CN]=您可在此设定 KView 应用程序以独立形式运行时的特殊选项。您在此所在的更改不会影响其它应用程序。
+Comment[zh_HK]=在此你可設定專用於當獨立使用的 KView 應用程式的選項。你在此更改不會影響其他應用程式。
+Comment[zh_TW]=您可以在此設定 KView 應用程式單獨執行時的選項。您在這裡的設定不會影響其他應用程式。
+Weight=5
diff --git a/kview/config/kviewconfmodules.cpp b/kview/config/kviewconfmodules.cpp
new file mode 100644
index 00000000..23f6a1ef
--- /dev/null
+++ b/kview/config/kviewconfmodules.cpp
@@ -0,0 +1,90 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2003 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#include "kviewconfmodules.h"
+
+#include <qlayout.h>
+#include <qvbuttongroup.h>
+#include <qradiobutton.h>
+
+#include <klocale.h>
+#include <kdialog.h>
+#include <kglobal.h>
+#include <kconfig.h>
+#include <kgenericfactory.h>
+#include <qwhatsthis.h>
+
+typedef KGenericFactory<KViewGeneralConfig, QWidget> KViewGeneralConfigFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_kviewgeneralconfig, KViewGeneralConfigFactory( "kcm_kviewgeneralconfig" ) )
+
+KViewGeneralConfig::KViewGeneralConfig( QWidget * parent, const char * /*name*/, const QStringList & args )
+ : KCModule( KViewGeneralConfigFactory::instance(), parent, args )
+{
+ QBoxLayout * layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() );
+
+ m_pResizeGroup = new QVButtonGroup( i18n( "Resizing" ), this );
+ m_pResizeGroup->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) );
+ connect( m_pResizeGroup, SIGNAL( clicked( int ) ), this, SLOT( resizeChanged( int ) ) );
+ layout->addWidget( m_pResizeGroup );
+
+ ( void )new QRadioButton( i18n( "Only resize window" ), m_pResizeGroup );
+ ( void )new QRadioButton( i18n( "Resize image to fit window" ), m_pResizeGroup );
+ ( void )new QRadioButton( i18n( "Don't resize anything" ), m_pResizeGroup );
+ QWhatsThis::add( new QRadioButton( i18n( "Best fit" ), m_pResizeGroup ),
+ i18n( "<p>KView will resize the window to fit the image. The image will never be scaled up but if it is too large for the screen the image will be scaled down.</p>" ) );
+
+ load();
+}
+
+KViewGeneralConfig::~KViewGeneralConfig()
+{
+}
+
+void KViewGeneralConfig::save()
+{
+ KConfigGroup cfgGroup( KGlobal::config(), "KView General" );
+ m_savedPosition = m_pResizeGroup->id( m_pResizeGroup->selected() );
+ cfgGroup.writeEntry( "Resize Mode", m_savedPosition );
+ emit changed( false );
+ KGlobal::config()->sync();
+}
+
+void KViewGeneralConfig::load()
+{
+ KConfigGroup cfgGroup( KGlobal::config(), "KView General" );
+ int m_savedPosition = cfgGroup.readNumEntry( "Resize Mode", 2 );
+ if( m_savedPosition < 0 || m_savedPosition > 3 )
+ m_savedPosition = 2;
+ m_pResizeGroup->setButton( m_savedPosition );
+ emit changed( false );
+}
+
+void KViewGeneralConfig::defaults()
+{
+ m_pResizeGroup->setButton( 2 );
+ emit changed( ( 2 != m_savedPosition ) );
+}
+
+void KViewGeneralConfig::resizeChanged( int pos )
+{
+ emit changed( ( pos != m_savedPosition ) );
+}
+
+// vim:sw=4:ts=4
+
+#include "kviewconfmodules.moc"
diff --git a/kview/config/kviewconfmodules.h b/kview/config/kviewconfmodules.h
new file mode 100644
index 00000000..d064b386
--- /dev/null
+++ b/kview/config/kviewconfmodules.h
@@ -0,0 +1,47 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2003 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef KVIEWCONFMODULES_H
+#define KVIEWCONFMODULES_H
+
+#include <kcmodule.h>
+
+class QVButtonGroup;
+
+class KViewGeneralConfig : public KCModule
+{
+ Q_OBJECT
+ public:
+ KViewGeneralConfig( QWidget * parent, const char * name = 0, const QStringList & args = QStringList() );
+ ~KViewGeneralConfig();
+
+ virtual void load();
+ virtual void save();
+ virtual void defaults();
+
+ private slots:
+ void resizeChanged( int );
+
+ private:
+ QVButtonGroup * m_pResizeGroup;
+ int m_savedPosition;
+};
+
+// vim:sw=4:ts=4
+
+#endif // KVIEWCONFMODULES_H
diff --git a/kview/config/kviewgeneralconfig.desktop b/kview/config/kviewgeneralconfig.desktop
new file mode 100644
index 00000000..acb6f625
--- /dev/null
+++ b/kview/config/kviewgeneralconfig.desktop
@@ -0,0 +1,131 @@
+[Desktop Entry]
+Icon=kview
+Type=Service
+ServiceTypes=KCModule
+
+X-KDE-ModuleType=Library
+X-KDE-Library=kviewgeneralconfig
+X-KDE-FactoryName=KViewGeneralConfigFactory
+X-KDE-ParentApp=kview
+X-KDE-ParentComponents=kview
+X-KDE-Weight=5
+X-KDE-CfgDlgHierarchy=Application
+
+Name=Application
+Name[ar]=التطبيق
+Name[az]=Proqram
+Name[bg]=Програма
+Name[br]=Arload
+Name[bs]=Program
+Name[ca]=Aplicació
+Name[cs]=Aplikace
+Name[cy]=Cymhwysiad
+Name[da]=Program
+Name[de]=Anwendung
+Name[el]=Εφαρμογή
+Name[eo]=Aplikaĵo
+Name[es]=Aplicación
+Name[et]=Rakendus
+Name[eu]=Aplikazioa
+Name[fa]=کاربرد
+Name[fi]=Sovellus
+Name[ga]=Feidhmchlár
+Name[gl]=Aplicación
+Name[he]=יישום
+Name[hi]=अनुप्रयोग
+Name[hr]=Program
+Name[hu]=Alkalmazás
+Name[id]=Aplikasi
+Name[is]=Forrit
+Name[it]=Applicazione
+Name[ja]=アプリケーション
+Name[kk]=Қолданба
+Name[km]=កម្មវិធី
+Name[lt]=Programa
+Name[lv]=Aplikācija
+Name[mk]=Апликација
+Name[ms]=Aplikasi
+Name[mt]=Programm
+Name[nb]=Program
+Name[nds]=Programm
+Name[ne]=अनुप्रयोग
+Name[nl]=Toepassing
+Name[nn]=Program
+Name[pa]=ਕਾਰਜ
+Name[pl]=Program
+Name[pt]=Aplicação
+Name[pt_BR]=Aplicativo
+Name[ro]=Aplicaţie
+Name[ru]=Приложение
+Name[rw]=Porogaramu
+Name[se]=Prográmma
+Name[sk]=Aplikácia
+Name[sl]=Program
+Name[sr]=Програм
+Name[sr@Latn]=Program
+Name[sv]=Program
+Name[ta]=பயன்பாடு
+Name[tg]=Барнома
+Name[th]=แอพพลิเคชัน
+Name[tr]=Uygulama
+Name[uk]=Програма
+Name[uz]=Dastur
+Name[uz@cyrillic]=Дастур
+Name[ven]=Apulifikhesheni
+Name[wa]=Programe
+Name[xh]=Isicelo
+Name[zh_CN]=应用程序
+Name[zh_HK]=應用程式
+Name[zh_TW]=應用程式
+Name[zu]=Isicelo
+Comment=Configuration for the standalone Version of KView
+Comment[ar]=اعدادات الاصدار المستقل من KView
+Comment[bg]=Настройки на главната програма
+Comment[bs]=Postavke za samostalnu verziju KView
+Comment[ca]=Configuració per a la versió independent de KView
+Comment[cs]=Nastavení samostatné verze KView
+Comment[cy]=Ffurfweddiad ar gyfer y fersiwn arunigol o KGweld
+Comment[da]=Indstilling af den alenestående udgave af KView
+Comment[de]=Einstellungen für die Anwendung KView
+Comment[el]=Ρύθμιση της standalone έκδοσης του KView
+Comment[eo]=Agordo por la aŭtonoma versio de KView
+Comment[es]=Configuración para la versión independiente de KView
+Comment[et]=KView iseseisva versiooni seadistus
+Comment[eu]=KView programaren konfigurazioa
+Comment[fa]=پیکربندی برای نسخۀ خوداتکای KView
+Comment[fi]=Asetukset itsenäiselle versiolle KView-ohjelmasta
+Comment[fr]=Configuration de la version isolée de KView
+Comment[gl]=Configuración para a versión «standalone» de KView
+Comment[he]=הגדרות עבור הגרסה העצמאית של KView
+Comment[hi]= के-व्यू के स्टैण्डएलोन संस्करण के लिए कॉन्फ़िगरेशन
+Comment[hu]=A KView önállóan futtatható verziójának beállításai
+Comment[is]=Stillingar fyrir KView
+Comment[it]=Configurazione di KView
+Comment[ja]=スタンドアロンバージョンの KView の設定
+Comment[kk]=KView бағдарламасының жеке-дара нұсқасының баптаулары
+Comment[km]=ការ​កំណត់​រចនាសម្ព័ន្ធ​សម្រាប់​កំណែ​កម្មវិធី KView រត់​តែ​ឯង
+Comment[lt]=KView kaip nepriklausomos programos konfigūravimas
+Comment[ms]=Konfigurasi untuk Versi tunggal bagi KView
+Comment[nb]=Oppsett av den frittstående utgaven av KView
+Comment[nds]=Instellen för de Enkelverschoon vun KView
+Comment[ne]=केडीई दृश्यको स्यान्डअलोन संस्करणाका लागि कन्फिगरेसन
+Comment[nl]=Instellingen voor KView op zichzelf
+Comment[nn]=Oppsett av den frittståande utgåva av KView
+Comment[pl]=Konfiguracja KView jako osobnego programu
+Comment[pt]=Configuração da versão independente do KView
+Comment[pt_BR]=Configuração para visão independente do KView
+Comment[ro]=Configurare pentru versiunea de sine stătătoare a KView
+Comment[ru]=Настройка самостоятельного приложения KView
+Comment[se]=Heivet KView:a oktosaš veršuvnna
+Comment[sk]=Konfigurácia pre samostatnú verziu KView
+Comment[sl]=Nastavitve za samostojno različico KView
+Comment[sr]=Подешавање за самосталну верзију KView-а
+Comment[sr@Latn]=Podešavanje za samostalnu verziju KView-a
+Comment[sv]=Inställning för fristående version av Kview
+Comment[ta]=கேகாட்சியின் தனிப் பதிப்புக்கான வடிவமைப்பு
+Comment[tg]=Танзимоти барномаи мустақили KView
+Comment[tr]=KView programının yanlız sürümünün ayarları
+Comment[uk]=Налаштування KView, як окремої програми
+Comment[zh_CN]=KView 标准版本的配置
+Comment[zh_HK]=獨立版本的 KView 的設定
+Comment[zh_TW]= KView 單獨執行版本的設定
diff --git a/kview/config/plugins/Makefile.am b/kview/config/plugins/Makefile.am
new file mode 100644
index 00000000..d2169a9d
--- /dev/null
+++ b/kview/config/plugins/Makefile.am
@@ -0,0 +1,17 @@
+INCLUDES = $(all_includes)
+
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = kcm_kviewpluginsconfig.la
+
+noinst_HEADERS = kviewpluginsconfig.h
+
+kcm_kviewpluginsconfig_la_SOURCES = kviewpluginsconfig.cpp
+kcm_kviewpluginsconfig_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+kcm_kviewpluginsconfig_la_LIBADD = $(LIB_KUTILS)
+
+kcm_kviewpluginsconfig_DATA = kviewpluginsconfig.desktop
+kcm_kviewpluginsconfigdir = $(kde_servicesdir)/kconfiguredialog
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/kcm_kviewpluginsconfig.pot
diff --git a/kview/config/plugins/kviewpluginsconfig.cpp b/kview/config/plugins/kviewpluginsconfig.cpp
new file mode 100644
index 00000000..e093366c
--- /dev/null
+++ b/kview/config/plugins/kviewpluginsconfig.cpp
@@ -0,0 +1,46 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#include "kviewpluginsconfig.h"
+
+#include <kpluginselector.h>
+#include <kgenericfactory.h>
+#include <klocale.h>
+#include <kglobal.h>
+#include <ksimpleconfig.h>
+#include <kplugininfo.h>
+
+typedef KGenericFactory<KViewPluginsConfig, QWidget> KViewPluginsConfigFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_kviewpluginsconfig, KViewPluginsConfigFactory( "kcm_kviewpluginsconfig" ) )
+
+KViewPluginsConfig::KViewPluginsConfig( QWidget * parent, const char *, const QStringList & args )
+ : KSettings::PluginPage( KViewPluginsConfigFactory::instance(), parent, args )
+{
+ m_config = new KSimpleConfig( "kviewrc" );
+ pluginSelector()->addPlugins( QString::fromAscii( "kview" ), i18n( "Application" ), QString::null, m_config );
+ pluginSelector()->setShowEmptyConfigPage( false );
+}
+
+KViewPluginsConfig::~KViewPluginsConfig()
+{
+ delete m_config;
+}
+
+// vim: sw=4 ts=4 noet
+
+#include "kviewpluginsconfig.moc"
diff --git a/kview/config/plugins/kviewpluginsconfig.desktop b/kview/config/plugins/kviewpluginsconfig.desktop
new file mode 100644
index 00000000..492b962c
--- /dev/null
+++ b/kview/config/plugins/kviewpluginsconfig.desktop
@@ -0,0 +1,118 @@
+[Desktop Entry]
+Icon=plugin
+Type=Service
+ServiceTypes=KCModule
+
+X-KDE-ModuleType=Library
+X-KDE-Library=kviewpluginsconfig
+X-KDE-FactoryName=KViewPluginsConfigFactory
+X-KDE-ParentApp=kview
+X-KDE-ParentComponents=kview
+X-KDE-Weight=6
+X-KDE-CfgDlgHierarchy=Application
+
+Name=Plugins
+Name[ar]=البرامج المساعدة
+Name[bg]=Приставки
+Name[br]=Lugantoù
+Name[bs]=Dodaci
+Name[ca]=Connectors
+Name[cs]=Moduly
+Name[cy]=Ategion
+Name[da]=Plugin
+Name[de]=Module
+Name[el]=Πρόσθετα
+Name[eo]=Kromaĵoj
+Name[es]=Extensiones
+Name[et]=Pluginad
+Name[eu]=Pluginak
+Name[fa]=وصله‌ها
+Name[fi]=Liitännäiset
+Name[fr]=Modules externes
+Name[ga]=Breiseáin
+Name[he]=תוספים
+Name[hi]=प्लगइन्स
+Name[hr]=Umetci
+Name[hu]=Bővítőmodulok
+Name[is]=Íforrit
+Name[it]=Plugin
+Name[ja]=プラグイン
+Name[kk]=Плагин модулі
+Name[km]=កម្មវិធី​ជំនួយ
+Name[lt]=Priedai
+Name[ms]=Plugin
+Name[nb]=Programtillegg
+Name[nds]=Modulen
+Name[ne]=प्लगइन
+Name[nn]=Programtillegg
+Name[pa]=ਪਲੱਗਿੰਨ
+Name[pl]=Wtyczki
+Name[pt]='Plugins'
+Name[ro]=Module
+Name[ru]=Модули
+Name[rw]=Amacomeka
+Name[se]=Lassemoduvllat
+Name[sk]=Moduly
+Name[sl]=Vstavki
+Name[sr]=Прикључци
+Name[sr@Latn]=Priključci
+Name[sv]=Insticksprogram
+Name[ta]=சொருகுப்பொருள்
+Name[tg]=Модулҳо
+Name[tr]=Eklentiler
+Name[uk]=Втулки
+Name[uz]=Plaginlar
+Name[uz@cyrillic]=Плагинлар
+Name[wa]=Tchôke-divins
+Name[zh_CN]=插件
+Name[zh_HK]=插件
+Name[zh_TW]=外掛程式
+Comment=Choose and Configure Your Plugins
+Comment[bg]=Избор и настройване на приставки
+Comment[br]=Dibabit ha kefluniut ho lugentoù
+Comment[bs]=Izaberite i podesite vaše dodatke
+Comment[ca]=Escolliu i configureu els connectors
+Comment[cs]=Zvolte a nastavte si moduly
+Comment[da]=Vælg og indstil dine plugin
+Comment[de]=Auswahl und Einrichtung der Module
+Comment[el]=Επιλέξτε και ρυθμίστε τα πρόσθετα σας
+Comment[eo]=Elektu kaj agordu viajn kromprogramojn
+Comment[es]=Seleccione y configure sus extensiones
+Comment[et]=Pluginate valimine ja seadistamine
+Comment[eu]=Aukeratu eta konfigurau zure pluginak
+Comment[fa]=وصله‌های خود را انتخاب و پیکربندی کنید
+Comment[fi]=Valitse ja muokkaa liitännäisten asetuksia
+Comment[fr]=Choisissez et configurez vos modules externes
+Comment[gl]=Elexir e Configurar as súas Extensións
+Comment[he]=בחר והגדר את התוספים שלך
+Comment[hu]=Bővítőmodulok kiválasztása, beállítása
+Comment[is]=Velja og stilla íforrit
+Comment[it]=Scegli e configura i tuoi plugin
+Comment[ja]=プラグインを選択して設定します
+Comment[kk]=Плагин модулін таңдап алып баптау
+Comment[km]=ជ្រើស និង​កំណត់​រចនាសម្ព័ន្ធ​កម្មវិធី​ជំនួយ​របស់​អ្នក
+Comment[lt]=Pasirinkite ir konfigūruokite priedus
+Comment[ms]=Pilih dan Konfigur Plugin Anda
+Comment[nb]=Velg og sett opp programtilleggene
+Comment[nds]=Dien Modulen utsöken un instellen
+Comment[ne]=तपाईँको प्लगइन रोज्नुहोस् र कन्फिगर गर्नुहोस्
+Comment[nl]=Kies uw plugins en stel ze in
+Comment[nn]=Vel og set opp programtillegga
+Comment[pl]=Wybór i konfiguracja wtyczek
+Comment[pt]=Escolha e Configure os 'Plugins'
+Comment[pt_BR]=Escolha e Configure os Seus Plugins
+Comment[ro]=Alegeţi şi configuraţi modulele dumneavoastră
+Comment[ru]=Выберите и настройте модули
+Comment[sk]=Vyberte a nastavte si moduly
+Comment[sl]=Izberite in nastavite vstavke
+Comment[sr]=Изаберите и подесите ваше прикључке
+Comment[sr@Latn]=Izaberite i podesite vaše priključke
+Comment[sv]=Välj och anpassa insticksprogram
+Comment[ta]=சொருகுப்பொருள்களைத் தேர்ந்தெடுத்து வடிவமைக்கவும்
+Comment[tr]=Eklentilerinizi Seçin ve Yapılandırın:
+Comment[uk]=Виберіть та налаштуйте ваші втулки
+Comment[uz]=Plaginlarni tanlash va moslash
+Comment[uz@cyrillic]=Плагинларни танлаш ва мослаш
+Comment[zh_CN]=选择并配置您的插件
+Comment[zh_HK]=選擇及設定你的插件
+Comment[zh_TW]=選擇並設定您的外掛程式
diff --git a/kview/config/plugins/kviewpluginsconfig.h b/kview/config/plugins/kviewpluginsconfig.h
new file mode 100644
index 00000000..815a4de7
--- /dev/null
+++ b/kview/config/plugins/kviewpluginsconfig.h
@@ -0,0 +1,38 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef KVIEWPLUGINSCONFIG_H
+#define KVIEWPLUGINSCONFIG_H
+
+#include <ksettings/pluginpage.h>
+
+class KConfig;
+
+class KViewPluginsConfig : public KSettings::PluginPage
+{
+ Q_OBJECT
+ public:
+ KViewPluginsConfig( QWidget * parent, const char * name = 0, const QStringList & args = QStringList() );
+ ~KViewPluginsConfig();
+ private:
+ KConfig * m_config;
+};
+
+// vim: sw=4 ts=4 noet
+
+#endif // KVIEWPLUGINSCONFIG_H
diff --git a/kview/hi16-app-kview.png b/kview/hi16-app-kview.png
new file mode 100644
index 00000000..f4b40e4a
--- /dev/null
+++ b/kview/hi16-app-kview.png
Binary files differ
diff --git a/kview/hi22-app-kview.png b/kview/hi22-app-kview.png
new file mode 100644
index 00000000..5c2169b3
--- /dev/null
+++ b/kview/hi22-app-kview.png
Binary files differ
diff --git a/kview/hi32-app-kview.png b/kview/hi32-app-kview.png
new file mode 100644
index 00000000..b4f7def8
--- /dev/null
+++ b/kview/hi32-app-kview.png
Binary files differ
diff --git a/kview/hi48-app-kview.png b/kview/hi48-app-kview.png
new file mode 100644
index 00000000..7791f9da
--- /dev/null
+++ b/kview/hi48-app-kview.png
Binary files differ
diff --git a/kview/kimageviewer/Makefile.am b/kview/kimageviewer/Makefile.am
new file mode 100644
index 00000000..c451ac33
--- /dev/null
+++ b/kview/kimageviewer/Makefile.am
@@ -0,0 +1,18 @@
+# $Id$
+
+lib_LTLIBRARIES = libkimageviewer.la
+
+noinst_HEADERS = canvas.h viewer.h
+
+libkimageviewer_la_SOURCES = canvas.cpp viewer.cpp
+libkimageviewer_la_LDFLAGS = $(all_libraries) -no-undefined -version-info 0:0
+libkimageviewer_la_LIBADD = $(LIB_KPARTS)
+
+INCLUDES = $(all_includes)
+
+# kimageviewerinclude_HEADERS = canvas.h viewer.h
+# kimageviewerincludedir = $(includedir)/kimageviewer
+
+METASOURCES = AUTO
+
+kde_servicetypes_DATA = kimageviewercanvas.desktop kimageviewer.desktop
diff --git a/kview/kimageviewer/canvas.cpp b/kview/kimageviewer/canvas.cpp
new file mode 100644
index 00000000..9b2c987b
--- /dev/null
+++ b/kview/kimageviewer/canvas.cpp
@@ -0,0 +1,35 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2002 Matthias Kretz <kretz@kde.org>
+
+ 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.
+
+*/
+// $Id$
+
+#include "canvas.h"
+
+namespace KImageViewer
+{
+ Canvas::Canvas()
+ : m_iBlendEffect( 0 )
+ {
+ }
+
+ Canvas::~Canvas()
+ {
+ }
+} //namespace
+
+// vim: sw=4 ts=4
diff --git a/kview/kimageviewer/canvas.h b/kview/kimageviewer/canvas.h
new file mode 100644
index 00000000..61b565b4
--- /dev/null
+++ b/kview/kimageviewer/canvas.h
@@ -0,0 +1,348 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2002 Matthias Kretz <kretz@kde.org>
+
+ 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.
+
+*/
+// $Id$
+
+#ifndef KIMAGEVIEWER_CANVAS_H
+#define KIMAGEVIEWER_CANVAS_H
+
+class QColor;
+class QSize;
+class QImage;
+class QRect;
+class QPoint;
+class QWidget;
+
+#include <qstring.h>
+#include <qobjectdefs.h>
+#include <kdemacros.h>
+namespace KImageViewer
+{
+
+/**
+ * An image canvas widget
+ *
+ * @author Matthias Kretz <kretz@kde.org>
+ *
+ * You'll find an implementation in kdegraphics (KView). You may
+ * still use this interface in your program but it will only work
+ * if you have an implementation installed.
+ *
+ * This is what you have to do to get an image canvas embedded in
+ * your program:
+ *
+ * <pre>
+ QWidget * widget = KParts::ComponentFactory::createInstanceFromQuery<QWidget>( "KImageViewer/Canvas", QString::null, this );
+ m_canvas = static_cast<KImageViewer::Canvas *>( widget->qt_cast( "KImageViewer::Canvas" ) );
+ if( ! ( widget && m_canvas ) )
+ {
+ KMessageBox::error( this, "Could not find the Canvas!" );
+ kapp->quit();
+ }
+ setCentralWidget( widget );
+ connect( widget, SIGNAL( contextPress( const QPoint & ) ), SLOT( mySlot( const QPoint & ) ) );
+ connect( m_canvas->widget(), SIGNAL( contextPress( const QPoint & ) ), SLOT( mySlot( const QPoint & ) ) );
+ </pre>
+ *
+ * You can't connect signals or slots using KImageViewer::Canvas, because this interface
+ * doesn't inherit from QObject. But you can cast to QWidget and use that instead (or just
+ * keep the original pointer to QWidget around, like shown in the example).
+ *
+ * This interface is not guaranteed to be kept binary or source compatible
+ * until it's finished. So if you're using this interface please get in contact
+ * with me.
+ */
+class KDE_EXPORT Canvas
+{
+ public:
+ /**
+ * set the background color of the canvas
+ */
+ virtual void setBgColor( const QColor & ) = 0;
+
+ /**
+ * returns the current background color
+ */
+ virtual const QColor & bgColor() const = 0;
+
+ /**
+ * the depth of the contained image
+ */
+ virtual int imageDepth() const = 0;
+
+ /**
+ * the size of the unzoomed image
+ */
+ virtual QSize imageSize() const = 0;
+
+ /**
+ * the size of the zoomed (current) image
+ */
+ virtual QSize currentSize() const = 0;
+
+ /**
+ * returns the zoom factor
+ */
+ virtual double zoom() const = 0;
+
+ /**
+ * @return The current (unzoomed) image
+ * Take care that the canas may delete the image so you probably need to
+ * make a copy of the image if you want to keep it around.
+ */
+ virtual const QImage * image() const = 0;
+
+ /**
+ * Scrolls the content so that the point (x, y) is in the top-left corner.
+ */
+ virtual void setXYOffset( int x, int y ) = 0;
+
+ /**
+ * Returns the leftmost visible X coordinate of the image.
+ */
+ virtual int xOffset() const = 0;
+
+ /**
+ * Returns the topmost visible Y coordinate of the image.
+ */
+ virtual int yOffset() const = 0;
+
+ /**
+ * Returns whether to use fast or smooth scaling
+ */
+ virtual bool fastScale() const = 0;
+
+ /**
+ * Return whether the image should always be centered.
+ */
+ virtual bool centered() const = 0;
+
+ /**
+ * Return the selected rectangle. If nothing is selected the rectangle is
+ * empty but doesn't have to be null.
+ */
+ virtual QRect selection() const = 0;
+
+ /**
+ * Returns whether the aspect ratio of the image is kept
+ */
+ virtual bool keepAspectRatio() const = 0;
+
+ /**
+ * @return the number of available blend effects
+ */
+ virtual unsigned int numOfBlendEffects() const { return 0; }
+
+ /**
+ * @return the description of the blend effect
+ */
+ virtual QString blendEffectDescription( unsigned int ) const { return QString::null; }
+
+ /**
+ * Sets the blending effect used to create a transition between images
+ */
+ virtual void setBlendEffect( unsigned int idx ) { m_iBlendEffect = idx; }
+
+ /**
+ * @return the current blend effect index
+ */
+ virtual unsigned int blendEffect() const { return m_iBlendEffect; }
+
+ /**
+ * @return the current maximum image size
+ */
+ virtual const QSize & maximumImageSize() const = 0;
+
+ /**
+ * @return the current minimum image size
+ */
+ virtual const QSize & minimumImageSize() const = 0;
+
+ /**
+ * @return a pointer to the QWidget interface of this object
+ */
+ virtual QWidget * widget() = 0;
+
+ signals:
+ /**
+ * a mouse button was pressed and a context menu should be openend
+ */
+ virtual void contextPress( const QPoint & ) = 0;
+
+ /**
+ * the size of the image has changed (a new image was loaded, or the
+ * image was zoomed or cropped)
+ *
+ * it passes the new size of the image
+ */
+ virtual void imageSizeChanged( const QSize & ) = 0;
+
+ /**
+ * The zoom of the image has changed.
+ */
+ virtual void zoomChanged( double zoom ) = 0;
+
+ /**
+ * The selection has changed. Connect to this signal if you want to
+ * do something with a selection of the image (e.g. crop).
+ */
+ virtual void selectionChanged( const QRect & ) = 0;
+
+ /**
+ * Emitted when an image is finished being shown. If a blend effect is being used
+ * the signal is emitted when the effect is finished.
+ */
+ virtual void showingImageDone() = 0;
+
+ /**
+ * This signal is emitted whenever the canvas changes between image/no-image. For
+ * example, if someone calls @ref clear() hasImage( false ) is emitted if an image
+ * was shown before.
+ */
+ virtual void hasImage( bool ) = 0;
+
+ /**
+ * Some methods of the canvas not only change the way the image is shown (e.g. zoom)
+ * but also change the image itself (e.g. rotation) - @ref image() returns something
+ * different. If such a change happens this signal is emitted.
+ * It is not emitted when a new image is set with the @ref setImage() methods.
+ */
+ virtual void imageChanged() = 0;
+
+ /**
+ * The current mouse cursor position on the image.
+ */
+ virtual void cursorPos( const QPoint & ) = 0;
+
+ public slots:
+ /**
+ * Set if the image should always be centered if the canvas is
+ * bigger than the image.
+ */
+ virtual void setCentered( bool ) = 0;
+
+ /**
+ * Give the canvas a new image to show. The zoom level is kept.
+ */
+ virtual void setImage( const QImage & ) = 0;
+
+ /**
+ * Give the canvas a new image to show.
+ *
+ * You have to pass the size the image should have when it appears
+ * on screen.
+ */
+ virtual void setImage( const QImage &, const QSize & ) = 0;
+
+ /**
+ * Set the zoom to be used when showing the image.
+ */
+ virtual void setZoom( double ) = 0;
+
+ /**
+ * Fit the image into the requested width and height.
+ */
+ virtual void boundImageTo( const QSize & size ) = 0;
+
+ /**
+ * Set the maximum size of the image. If this is set the image will
+ * never exceed this size.
+ *
+ * If you set this to 0x0 the image size may be as big as possible
+ */
+ virtual void setMaximumImageSize( const QSize & ) = 0;
+
+ /**
+ * Set the minimum size of the image. If this is set the image will
+ * never be smaller than this size.
+ *
+ * If you set this to 0x0 the image size can be as small as possible
+ */
+ virtual void setMinimumImageSize( const QSize & ) = 0;
+
+ /**
+ * Resize the image to the given size. It will keep the aspect ratio
+ * as long as keepAspectRatio is true (default). The image will be as
+ * large as possible within the given constraints.
+ */
+ virtual void resizeImage( const QSize & ) = 0;
+
+ /**
+ * Hides the scrollbars of the canvas. It's still possible to scroll
+ * by moving the image with the mouse.
+ */
+ virtual void hideScrollbars( bool ) = 0;
+
+ /**
+ * Changes the zoom behaviour: Normally the aspect ratio of the image
+ * won't change, but if you want to allow it you may do.
+ */
+ virtual void setKeepAspectRatio( bool ) = 0;
+
+ /**
+ * If the canvas supports different methods for scaling you may
+ * switch between fast and smooth scaling.
+ *
+ * It defaults to smooth scaling.
+ */
+ virtual void setFastScale( bool ) = 0;
+
+ /**
+ * clears the canvas (no image loaded)
+ */
+ virtual void clear() = 0;
+
+ /**
+ * flip the image horizontally
+ *
+ * @param change If set to true the internal image will be changed, else
+ * only the shown image changes and @ref image() still returns
+ * the same as before this call.
+ */
+ virtual void flipHorizontal( bool change = false ) = 0;
+
+ /**
+ * flip the image vertically
+ *
+ * @param change If set to true the internal image will be changed, else
+ * only the shown image changes and @ref image() still returns
+ * the same as before this call.
+ */
+ virtual void flipVertical( bool change = false ) = 0;
+
+ /**
+ * rotate the image a degrees counterclockwise
+ *
+ * @param angle The angle in degrees that the image should be rotated.
+ * @param change If set to true the internal image will be changed, else
+ * only the shown image changes and @ref image() still returns
+ * the same as before this call.
+ */
+ virtual void rotate( double angle, bool change = false ) = 0;
+
+ protected:
+ Canvas();
+ virtual ~Canvas();
+ unsigned int m_iBlendEffect;
+
+}; //class Canvas
+} //namespace KImageViewer
+
+// vim:sw=4:ts=4
+
+#endif // KIMAGEVIEWER_CANVAS_H
diff --git a/kview/kimageviewer/kimageviewer.desktop b/kview/kimageviewer/kimageviewer.desktop
new file mode 100644
index 00000000..6a5c1287
--- /dev/null
+++ b/kview/kimageviewer/kimageviewer.desktop
@@ -0,0 +1,63 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KImageViewer/Viewer
+X-KDE-Derived=KParts/ReadWritePart
+Icon=image
+Comment=Embeddable Image Viewer Component
+Comment[af]=Inlegbare Beeld Aansig Komponent
+Comment[ar]=مكون عارض الصور القابل للدمج
+Comment[bg]=Модул за преглед на изображения
+Comment[br]=Parzh gweler skeudennoù enframmus
+Comment[bs]=Ugradiva komponenta za pregled slika
+Comment[ca]=Component visualitzador d'imatges encastable
+Comment[cs]=Komponenta pro zobrazování obrázků
+Comment[cy]=Cydran Mewnadeiladadwy Gwelydd Delweddau
+Comment[da]=Indlejrbar billedviserkomponent
+Comment[de]=Einbettungsfähige Bildbetrachter-Komponente
+Comment[el]=Ενσωματώσιμο συστατικό προβολέα εικόνων
+Comment[eo]=Enkonstruebla bildrigardilo
+Comment[es]=Componente empotrable para visualizar imágenes
+Comment[et]=Põimitav pildifailide näitaja komponent
+Comment[eu]=Irudi ikustailu txertagarri osagaia
+Comment[fa]=مؤلفۀ مشاهده‌گر تصویر نهفته‌شده
+Comment[fi]=Upotettava kuviennäyttökomponentti
+Comment[fr]=Composant afficheur d'images incorporable
+Comment[gl]=Componente de visualización integrable
+Comment[he]=רכיב מציג תמונות בר־הטבעה
+Comment[hi]=एम्बेडेबल छवि प्रदर्शक अवयव
+Comment[hr]=Umetljiva komponenta za gledanje slika
+Comment[hu]=Beágyazható képnézegető komponens
+Comment[is]=Ívefjanleg myndsjá
+Comment[it]=Componente integrabile per la visione di immagini
+Comment[ja]=埋め込み可能な画像ビューアコンポーネント
+Comment[kk]=Ендірілетін кескін қарау компоненті
+Comment[km]=សមាសភាគ​របស់​កម្មវិធី​មើល​រូបភាព​ដែល​អាច​បង្កប់​បាន
+Comment[lt]=Įdedamas piešinių peržiūros komponentas
+Comment[ms]=Komponen Pemapar Imej Boleh Benam
+Comment[nb]=Inkluderbar bildevisningskomponent
+Comment[nds]=Inbettbor Bildkiekerkomponent
+Comment[ne]=सम्मिलित छवि दर्शक अवयव
+Comment[nl]=Ingebed weergavecomponent voor afbeeldingen
+Comment[nn]=Inkluderbart komponent for biletvising
+Comment[nso]=Seripa seo se Robatsegago sa Molebeledi wa Ponagalo
+Comment[pl]=Składnik do przeglądania obrazków
+Comment[pt]=Componente Embebida de Visualização de Imagens
+Comment[pt_BR]=Componente Integrado do Visualizador de Imagens
+Comment[ro]=Componentă înglobată de vizualizare imagini
+Comment[ru]=Встраиваемый компонент просмотра изображений
+Comment[se]=Vuojuhanláhkái govvačájehanoassi
+Comment[sk]=Vložiteľný komponent prehliadač obrázkov
+Comment[sl]=Vključen dodatek za pregled slik
+Comment[sr]=Уградива компонента приказивача слика
+Comment[sr@Latn]=Ugradiva komponenta prikazivača slika
+Comment[sv]=Inbäddningsbar bildvisande komponent
+Comment[ta]=பொதிந்த பிம்ப காட்சி பகுதி
+Comment[tg]=Қисмати дар дохилсозандаи намоиши тасвирот
+Comment[tr]=Gömülebilir Resim Görüntüleme Bileşeni
+Comment[uk]=Вмонтовний компонент перегляду зображень
+Comment[ven]=Tshipida tsha muvhoni wa tshifanyiso tsho dzheniswaho
+Comment[xh]=Ingxenye Yombonisi Womfanekiso Olungisiweyo
+Comment[zh_CN]=可嵌入的图像查看器组件
+Comment[zh_HK]=可嵌入的圖像檢視器元件
+Comment[zh_TW]=可嵌入的影像檢視器元件
+Comment[zu]=Ilunga Lombukisi Wesithombe Esixubeneyo
diff --git a/kview/kimageviewer/kimageviewercanvas.desktop b/kview/kimageviewer/kimageviewercanvas.desktop
new file mode 100644
index 00000000..fa084475
--- /dev/null
+++ b/kview/kimageviewer/kimageviewercanvas.desktop
@@ -0,0 +1,60 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KImageViewer/Canvas
+Comment=Embeddable Image Viewer Canvas (widget that shows an image)
+Comment[af]=Inlegbare Beeld Aansig Kanvas (gui-element wat vertoon 'n Beeld)
+Comment[ar]= مساحة رسم لعرض الصور قابلة للدمج (كائن يعرض صورة)
+Comment[bg]=Модул за преглед на изображения (полето, в което се показва самото изображение)
+Comment[bs]=Ugradiva pozadina za pregled slika (grafički element koji prikazuje slike)
+Comment[ca]=Llenç visualitzador d'imatges encastable (estri que mostra una imatge)
+Comment[cs]=Pohltitelná komponenta pro zobrazování obrázků
+Comment[cy]=Cynfas Mewnadeiladadwy Gwelydd Delweddau (celfigyn sy'n dangos delwedd)
+Comment[da]=Indlejrbar billedviserlærred (kontrol der viser et billede)
+Comment[de]=Einbettungsfähiges Bildbetrachtermodul (Bildschirmausschnitt, der ein Bild anzeigt)
+Comment[el]=Ενσωματώσιμος Καμβάς Προβολής Εικόνων (γραφικό συστατικό που εμφανίζει μία εικόνα)
+Comment[eo]=Enkonstruebla bildrigardilo kromaĵo
+Comment[es]=Componente empotrable para visualizar lienzos (widget que muestra una imagen)
+Comment[et]=Põimitavad pildifailide näitaja lõuendid (element, mis näitab pilti)
+Comment[eu]=Irudi ikustailu txertagarriren ohila (irudi bat erakuts dezakeen tresnatxoa)
+Comment[fa]=صفحۀ مجازی مشاهده‌گر تصویر نهفته‌‌شده )عنصری که یک تصویر را نمایش می‌دهد)
+Comment[fi]=Upotettava kuviennäyttökomponentti (käyttöliittymäelementti joka näyttää kuvan)
+Comment[fr]=Composant afficheur d'images incorporable (widget qui affiche une image)
+Comment[gl]=Visor de imaxes integrado (complemento que amosa unha imaxe)
+Comment[he]=רכיב מציג תמונות בר־הטבעה (פריט המציג תמונה)
+Comment[hi]=एम्बेडेबल छवि प्रदर्शक केनवास (विजेट जो छवि दिखाता है)
+Comment[hr]=Umetljivo platno za pregled slika (widget koji pokazuje sliku)
+Comment[hu]=Beágyazható képnézegető objektum (képmegjelenítő)
+Comment[is]=Ívefjanleg myndsjá (græja sem birtir mynd)
+Comment[it]=Componente integrabile per la visione di immagini (widget che mostra un'immagine)
+Comment[ja]=埋め込み可能な画像ビューアキャンバス (画像を表示するウィジェット)
+Comment[kk]=Кескін қарауға арналған ендірілетін өріс (кескінді көрсететін бөлшегі)
+Comment[km]=ផ្នែក​របស់​កម្មវិធី​មើល​រូបភាព​ដែល​អាច​បង្កប់​បាន (ផ្នែក​ដែល​បង្ហាញ​រូបភាព)
+Comment[lt]=Įdedamas piešinių peržiūros paveikslas (valdiklis, kuris rodo paveikslėlį)
+Comment[ms]=Kanvas Pemapar Imej Boleh Benam (widget yang memaparkan imej)
+Comment[nb]=Inkluderbare bildevisningskomponenter (skjermelement som viser et bilde)
+Comment[nds]=Inbettbor Bildkieker-Rahmen (Element, dat en Bild wiest)
+Comment[ne]=सम्मिलित छवि दर्शक क्यानभास (छवि देखाउने विजेट)
+Comment[nl]=Ingebed weergave-canvas (widget die een afbeelding toont)
+Comment[nn]=Inkluderbart lerret for biletvising (skjermelement som viser eit bilete)
+Comment[nso]=Canvas yeo e Robatsegago ya Molebeledi wa Ponagalo (widget yeo e bontshago ponagalo)
+Comment[pl]=Obszar do przeglądania obrazków (wnętrze okienka, które pokazuje obrazek)
+Comment[pt]=Área de Visualização Embebida de Imagens (um item que mostra uma imagem)
+Comment[pt_BR]=Componente Integrado do Visualizador Canvas (componente que exibe uma imagem)
+Comment[ro]=Componentă înglobată de vizualizare imagini (widget)
+Comment[ru]=Встраиваемый элемент просмотра изображений (просмотр изображения в виджете)
+Comment[se]=Vuojuhahtti govvačájehanliinni (áhtá mii čájeha gova)
+Comment[sk]=Vložiteľný komponent prehliadač obrázkov (prvok, ktorý zobrazuje obrázky)
+Comment[sl]=Vključljivo platno za pregled slik (gradnik, ki prikaže sliko)
+Comment[sr]=Уградиво платно приказивача слика (контрола која показује слику)
+Comment[sr@Latn]=Ugradivo platno prikazivača slika (kontrola koja pokazuje sliku)
+Comment[sv]=Inbäddningsbar bildvisande duk (komponent som visar en bild)
+Comment[ta]=பொதிந்த பிம்ப காட்சி திரைவடிவம்(சாளரம் ஒரு பிம்பத்தை காட்டுகிறது)
+Comment[tg]=Ҷузъи дар дохилсозандаи намоиши тасвирот (намоиши тасвирот дар виджет)
+Comment[tr]=Gömülebilir Resim Görüntüleme Penceresi
+Comment[uk]=Вмонтовний компонент полотна перегляду зображень (віджет, що малює зображення)
+Comment[ven]=Muvhala wa muvhoni wa tshifanyiso tsho dzheniswaho (tshishumiswa tsha vhuthogwa tshine tsha sumbedza tshifanyiso)
+Comment[xh]=Iseyile Yombonisi Womfanekiso Olungisiweyo (widget ebonisa umfanekiso)
+Comment[zh_CN]=可嵌入的图像查看画布(显示图像的部件)
+Comment[zh_HK]=可嵌入的圖像檢視器畫布(顯示圖像的器件)
+Comment[zh_TW]=可嵌入的影像檢視器畫布(顯示影像的界面工具)
+Comment[zu]=Inkalivasi Yombukisi Wesithombe Esixubeneyo (i-widget ekhombisa isithombe)
diff --git a/kview/kimageviewer/viewer.cpp b/kview/kimageviewer/viewer.cpp
new file mode 100644
index 00000000..a74e0de9
--- /dev/null
+++ b/kview/kimageviewer/viewer.cpp
@@ -0,0 +1,36 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ 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.
+
+*/
+// $Id$
+
+#include "viewer.h"
+
+namespace KImageViewer
+{
+ Viewer::Viewer( QObject * parent, const char * name )
+ : KParts::ReadWritePart( parent, name )
+ {
+ }
+
+ Viewer::~Viewer()
+ {
+ }
+} //namespace
+
+#include "viewer.moc"
+// vim: sw=4 ts=4
diff --git a/kview/kimageviewer/viewer.h b/kview/kimageviewer/viewer.h
new file mode 100644
index 00000000..647fd9ba
--- /dev/null
+++ b/kview/kimageviewer/viewer.h
@@ -0,0 +1,99 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2002 Matthias Kretz <kretz@kde.org>
+
+ 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.
+
+*/
+// $Id$
+
+#ifndef KIMAGEVIEWER_VIEWER_H
+#define KIMAGEVIEWER_VIEWER_H
+
+#include <kparts/part.h>
+#include <kdemacros.h>
+namespace KParts
+{
+ class BrowserExtension;
+}
+
+namespace KImageViewer
+{
+ class Canvas;
+
+/**
+ * An image viewer KPart
+ *
+ * @author Matthias Kretz <kretz@kde.org>
+ *
+ * You'll find an implementation in kdegraphics (KView). You may
+ * still use this interface in your program but it will only work
+ * if you have an implementation installed
+ *
+ * WARNING: This interface is not guaranteed to be kept binary or source compatible
+ * until it's finished. So if you're using this interface please get in contact
+ * with me.
+ */
+class KDE_EXPORT Viewer : public KParts::ReadWritePart
+{
+ Q_OBJECT
+ public:
+ Viewer( QObject * parent = 0, const char * name = 0 );
+
+ virtual ~Viewer();
+
+ /**
+ * Return the canvas this viewer is using. The interface of the
+ * canvas is defined in kimageviewer/canvas.h
+ */
+ virtual Canvas * canvas() const = 0;
+
+ /**
+ * If the Viewer wants to be configurable
+ */
+ //virtual void createConfigurationDialogPages() = 0;
+
+ /**
+ * A pointer to the Browser Extension (if available). You should always
+ * check whether this returns a valid pointer.
+ */
+ virtual KParts::BrowserExtension * browserExtension() const { return 0; }
+
+ public slots:
+ /**
+ * Set a new Image. Close the old one and change the caption and file
+ * name and url and whatnot accordingly.
+ * So if you want to display a new image (not change the one shown) this
+ * is the method to use. Else take a look at Canvas::setImage().
+ */
+ virtual void newImage( const QImage & ) = 0;
+
+ /**
+ * Tell the view to reload the current image. The host for this view
+ * should make an Action available for reloading.
+ */
+ virtual void reload() = 0;
+
+ signals:
+ /**
+ * Emitted when the viewer opens a new image
+ */
+ void imageOpened( const KURL & );
+
+}; //class Viewer
+} //namespace KImageViewer
+
+// vim:sw=4:ts=4
+
+#endif // KIMAGEVIEWER_VIEWER_H
diff --git a/kview/kview.cpp b/kview/kview.cpp
new file mode 100644
index 00000000..a9af213e
--- /dev/null
+++ b/kview/kview.cpp
@@ -0,0 +1,698 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2003 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#include "kview.h"
+#include "kimageviewer/viewer.h"
+#include "kimageviewer/canvas.h"
+
+#include <ksettings/dialog.h>
+#include <ksettings/dispatcher.h>
+#include <kurl.h>
+#include <klibloader.h>
+#include <kmessagebox.h>
+#include <kparts/componentfactory.h>
+#include <kparts/plugin.h>
+#include <kparts/part.h>
+#include <kapplication.h>
+#include <kaction.h>
+#include <kstdaction.h>
+#include <kimageio.h>
+#include <kfiledialog.h>
+#include <klocale.h>
+#include <kwinmodule.h>
+#include <kmenubar.h>
+#include <kstatusbar.h>
+#include <kdebug.h>
+#include <kedittoolbar.h>
+#include <kstdaccel.h>
+#include <kprogress.h>
+
+#include <qimage.h>
+#include <qsize.h>
+#include <qscrollbar.h>
+#include <qstyle.h>
+#include <qclipboard.h>
+#include <qdragobject.h>
+#include <qvaluelist.h>
+#include <qtimer.h>
+#include <qdockarea.h>
+
+#include <assert.h>
+#include <kplugininfo.h>
+
+KView::KView()
+ : KParts::MainWindow( 0, "KView" )
+ , m_pViewer( 0 )
+ , m_pCanvas( 0 )
+ , m_pWinModule( new KWinModule( this, KWinModule::INFO_DESKTOP ) )
+ , m_bImageSizeChangedBlocked( false )
+ , m_bFullscreen( false )
+{
+ KParts::ReadWritePart * part = KParts::ComponentFactory::createPartInstanceFromLibrary<KParts::ReadWritePart>(
+ "libkviewviewer", this, "KViewViewer Widget", this, "KImageViewer Part" );
+ if( part )
+ {
+ m_pViewer = static_cast<KImageViewer::Viewer *>( part );
+ if( m_pViewer )
+ m_pCanvas = m_pViewer->canvas();
+ }
+
+ kdDebug( 4600 ) << "m_pViewer = " << m_pViewer << endl;
+
+ if( m_pCanvas )
+ {
+ setupActions( part );
+
+ setCentralWidget( part->widget() );
+
+ setStandardToolBarMenuEnabled( true );
+
+ connect( part->widget(), SIGNAL( imageSizeChanged( const QSize & ) ),
+ SLOT( imageSizeChanged( const QSize & ) ) );
+ connect( part->widget(), SIGNAL( selectionChanged( const QRect & ) ),
+ SLOT( selectionChanged( const QRect & ) ) );
+ connect( part->widget(), SIGNAL( contextPress( const QPoint & ) ),
+ SLOT( contextPress( const QPoint & ) ) );
+
+ connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
+ SLOT( clipboardDataChanged() ) );
+
+ connect( m_pViewer, SIGNAL( started( KIO::Job * ) ),
+ this, SLOT( jobStarted( KIO::Job * ) ) );
+ connect( m_pViewer, SIGNAL( completed() ),
+ this, SLOT( jobCompleted() ) );
+ connect( m_pViewer, SIGNAL( completed( bool ) ),
+ this, SLOT( jobCompleted( bool ) ) );
+ connect( m_pViewer, SIGNAL( canceled( const QString & ) ),
+ this, SLOT( jobCanceled( const QString & ) ) );
+ connect( m_pViewer, SIGNAL( imageOpened( const KURL & ) ),
+ m_paRecent, SLOT( addURL( const KURL & ) ) );
+
+ connect( m_pCanvas->widget(), SIGNAL( cursorPos( const QPoint & ) ), SLOT( cursorPos( const QPoint & ) ) );
+
+ m_paRecent->loadEntries( KGlobal::config() );
+ if (!initialGeometrySet())
+ resize(500, 350);
+ readSettings();
+ m_pViewer->widget()->installEventFilter( this );
+
+ // reload configuration when it's changed by the conf dlg
+ KSettings::Dispatcher::self()->registerInstance( instance(), this, SLOT( readSettings() ) );
+
+ setPluginLoadingMode( LoadPluginsIfEnabled );
+ createGUI( part );
+
+ // create status bar (hidden by default)
+ statusBar()->insertItem( "", STATUSBAR_SPEED_ID, 0, true );
+ statusBar()->setItemFixed( STATUSBAR_SPEED_ID,
+ 8 + fontMetrics().width( i18n( "%1/s" ).arg( KIO::convertSize( 999000 ) ) ) );
+ statusBar()->insertItem( "", STATUSBAR_CURSOR_ID, 0, true );
+ statusBar()->setItemFixed( STATUSBAR_CURSOR_ID, 8 + fontMetrics().width( "8888, 8888" ) );
+ statusBar()->insertItem( "", STATUSBAR_SIZE_ID, 0, true );
+ statusBar()->setItemFixed( STATUSBAR_SIZE_ID, 8 + fontMetrics().width( "8888 x 8888" ) );
+
+ statusBar()->insertItem( QString::null, STATUSBAR_SELECTION_ID );
+
+ m_pProgressBar = new KProgress( statusBar() );
+ m_pProgressBar->setFixedSize( 140, fontMetrics().height() );
+ statusBar()->addWidget( m_pProgressBar, 0, true );
+ m_pProgressBar->hide();
+
+ setAutoSaveSettings();
+ m_paShowMenubar->setChecked( ! menuBar()->isHidden() );
+
+ // show progress info dialog if the statusbar is hidden
+ m_pViewer->setProgressInfoEnabled( statusBar()->isHidden() );
+
+ // set small minimum size
+ setMinimumSize( 0, 0 );
+ }
+ else
+ {
+ KMessageBox::error( this, i18n( "An error occurred while loading the KViewViewer KPart. Check your installation." ) );
+ QTimer::singleShot( 0, kapp, SLOT( quit() ) );
+ }
+}
+
+KView::~KView()
+{
+ saveSettings( KGlobal::config() );
+ KGlobal::config()->sync();
+}
+
+void KView::load( const KURL & url )
+{
+ if( m_pViewer )
+ {
+ m_pViewer->openURL( url );
+ if( url.isLocalFile() )
+ {
+ // XXX: this code is what
+ //KRecentDirs::add( QString::fromLatin1( ":load_image" ), url.directory() );
+ // would do:
+ QString directory = url.directory();
+ QString key = QString::fromLatin1( "load_image" );
+ KConfig * config = KGlobal::config();
+
+ config->setGroup( QString::fromLatin1( "Recent Dirs" ) );
+ QStringList result = config->readPathListEntry( key );
+ // make sure the dir is first in history
+ result.remove( directory );
+ result.prepend( directory );
+ while( result.count() > 3 )
+ result.remove( result.fromLast() );
+ config->writePathEntry( key, result );
+ config->sync();
+ }
+ }
+}
+
+void KView::loadFromStdin()
+{
+ if( m_pViewer )
+ {
+ QFile file;
+ file.open( IO_ReadOnly, stdin );
+ QImage image( file.readAll() );
+ file.close();
+ m_pViewer->newImage( image );
+ }
+}
+
+QSize KView::sizeForCentralWidgetSize( QSize size )
+{
+ // add size of the dockareas
+ kdDebug( 4600 ) << "sizeForCentralWidgetSize " << size << endl;
+ size.rheight() += topDock()->height() + bottomDock()->height();
+ size.rwidth() += leftDock()->width() + rightDock()->width() - 2;
+ kdDebug( 4600 ) << "added Dockareas: " << size << endl;
+ KStatusBar * sb = statusBar();
+ size.rheight() += sb->isHidden() ? 0 : sb->height();
+ kdDebug( 4600 ) << "added Statusbar: " << size << endl;
+ KMenuBar * mb = menuBar();
+ if( ! mb->isHidden() )
+ {
+ size.rheight() += mb->heightForWidth( width() );
+ if( style().styleHint( QStyle::SH_MainWindow_SpaceBelowMenuBar, this ) )
+ size.rheight() += dockWindowsMovable() ? 1 : 2;
+ }
+ kdDebug( 4600 ) << "added Menubar: " << size << endl;
+ return size;
+}
+
+bool KView::queryClose()
+{
+ return m_pViewer->closeURL();
+}
+
+void KView::saveProperties( KConfig * /*config*/ )
+{
+ // save session data:
+ // What URL is currently open
+ // somehow the plugins have to get a chance to store their data
+}
+
+void KView::readProperties( KConfig * /*config*/ )
+{
+ // read session data
+}
+
+void KView::saveSettings( KConfig * config )
+{
+ // write settings to config/kviewrc
+ kdDebug( 4600 ) << k_funcinfo << endl;
+ m_paRecent->saveEntries( config );
+}
+
+void KView::readSettings() // KConfig * config )
+{
+ // read settings from config/kviewrc
+ kdDebug( 4600 ) << k_funcinfo << endl;
+ KConfigGroup cfgGroup( KGlobal::config(), "KView General" );
+ m_nResizeMode = cfgGroup.readNumEntry( "Resize Mode", 2 );
+ kdDebug( 4600 ) << "m_nResizeMode = " << m_nResizeMode << endl;
+ loadPlugins();
+}
+
+bool KView::eventFilter( QObject * obj, QEvent * ev )
+{
+ if( obj == m_pViewer->widget() && ev->type() == QEvent::Resize )
+ {
+ if( m_nResizeMode == ResizeImage )
+ handleResize();
+ }
+ return KParts::MainWindow::eventFilter( obj, ev );
+}
+
+void KView::imageSizeChanged( const QSize & /*size*/ )
+{
+ QSize size = m_pCanvas->imageSize();
+ statusBar()->changeItem( QString( "%1 x %2" ).arg( size.width() ).arg( size.height() ), STATUSBAR_SIZE_ID );
+ handleResize();
+}
+
+void KView::selectionChanged( const QRect & rect )
+{
+ kdDebug( 4600 ) << k_funcinfo << rect << endl;
+ if( rect.isNull() )
+ statusBar()->changeItem( QString::null, STATUSBAR_SELECTION_ID );
+ else
+ statusBar()->changeItem( QString( "%1, %2 - %3 x %4" ).arg( rect.x() ).arg( rect.y() ).arg( rect.width() ).arg( rect.height() ), STATUSBAR_SELECTION_ID );
+ action( "crop" )->setEnabled( ! rect.isNull() );
+}
+
+void KView::contextPress( const QPoint & point )
+{
+ QPopupMenu * pop = ( QPopupMenu* )factory()->container( "popupmenu", this );
+ pop->popup( point );
+}
+
+void KView::slotOpenFile()
+{
+ KURL url = KFileDialog::getImageOpenURL( ":load_image", this );
+ load( url );
+}
+
+void KView::slotOpenRecent( const KURL & url )
+{
+ load( url );
+}
+
+void KView::slotClose()
+{
+ if( m_pViewer->closeURL() )
+ m_pCanvas->clear();
+}
+
+void KView::slotCopy()
+{
+ QClipboard *cb = QApplication::clipboard();
+ cb->setSelectionMode( false );
+
+ QRect selectarea = m_pCanvas->selection();
+ if( selectarea.isEmpty() )
+ {
+ kdDebug( 4600 ) << k_funcinfo << " copy whole image" << endl;
+ cb->setImage( *m_pCanvas->image() );
+ }
+ else
+ {
+ kdDebug( 4600 ) << k_funcinfo << " copy selected area of image" << endl;
+ cb->setImage( m_pCanvas->image()->copy( selectarea ) );
+ }
+}
+
+void KView::slotPaste()
+{
+ // Get QImage from clipboard and create a new image.
+ QClipboard *cb = QApplication::clipboard();
+ QImage img = cb->image();
+ if( ! img.isNull() )
+ m_pViewer->newImage( img );
+}
+
+void KView::slotCrop()
+{
+ QRect selectarea = m_pCanvas->selection();
+ kdDebug( 4600 ) << "Crop following area: " << selectarea.x() << ", " << selectarea.y() << ", " << selectarea.width() << ", " << selectarea.height() << endl;
+
+ if( selectarea.isNull() )
+ return;
+ const QImage * origimg = m_pCanvas->image();
+ if( origimg == 0 )
+ return;
+
+ m_pCanvas->setImage( origimg->copy( selectarea ) );
+ m_pViewer->setModified( true );
+}
+
+void KView::slotUpdateFullScreen( bool set )
+{
+ m_bFullscreen = set;
+ if( set )
+ { // switch to FullScreen mode
+ saveMainWindowSettings( KGlobal::config(), "nonFullScreen MainWindow" );
+ showFullScreen();
+ applyMainWindowSettings( KGlobal::config(), "FullScreen MainWindow" );
+ m_paShowMenubar->setChecked( ! menuBar()->isHidden() );
+ }
+ else
+ { // leave FullScreen mode
+ saveMainWindowSettings( KGlobal::config(), "FullScreen MainWindow" );
+ showNormal();
+ applyMainWindowSettings( KGlobal::config(), "nonFullScreen MainWindow" );
+ m_paShowMenubar->setChecked( ! menuBar()->isHidden() );
+ handleResize();
+ }
+}
+
+void KView::slotToggleMenubar()
+{
+ if( menuBar()->isVisible() )
+ menuBar()->hide();
+ else
+ menuBar()->show();
+ handleResize();
+}
+
+void KView::slotPreferences()
+{
+ // construct KCD for KView app
+ static KSettings::Dialog * dlg = 0;
+ if( ! dlg )
+ {
+ dlg = new KSettings::Dialog( this );
+ //dlg = new KConfigureDialog( KConfigureDialog::Configurable, this );
+ //dlg->addPluginInfos( KPluginInfo::fromKPartsInstanceName( instance()->instanceName(), KGlobal::config(), "KParts Plugins" ) );
+ }
+ dlg->show();
+}
+
+void KView::slotConfigureToolbars()
+{
+ saveMainWindowSettings( KGlobal::config(), "MainWindow" );
+ KEditToolbar dlg( factory() );
+ connect( &dlg, SIGNAL( newToolbarConfig() ), SLOT( slotNewToolbarConfig() ) );
+ dlg.exec();
+}
+
+void KView::slotNewToolbarConfig()
+{
+ applyMainWindowSettings( KGlobal::config(), "MainWindow" );
+}
+
+void KView::reloadConfig()
+{
+ readSettings(); //KGlobal::config() );
+}
+
+void KView::enableAction( const char * name, bool b )
+{
+ KAction * a = actionCollection()->action( name );
+ if( a )
+ a->setEnabled( b );
+ else
+ kdWarning( 4600 ) << k_funcinfo << " unknown action" << endl;
+}
+
+void KView::clipboardDataChanged()
+{
+ QClipboard * cb = QApplication::clipboard();
+ cb->setSelectionMode( false );
+ bool hasImage = QImageDrag::canDecode( cb->data( QClipboard::Clipboard ) );
+ m_paPaste->setEnabled( hasImage );
+}
+
+void KView::jobStarted( KIO::Job * job )
+{
+ if( job )
+ {
+ connect( job, SIGNAL( percent( KIO::Job *, unsigned long ) ), this, SLOT( loadingProgress( KIO::Job *, unsigned long ) ) );
+ connect( job, SIGNAL( speed( KIO::Job *, unsigned long ) ), this, SLOT( speedProgress( KIO::Job *, unsigned long ) ) );
+ //connect( job, SIGNAL( infoMessage( KIO::Job *, const QString & ) ), this, SLOT() );
+ loadingProgress( job, 0 );
+ speedProgress( job, 0 );
+ }
+}
+
+void KView::jobCompleted()
+{
+ jobCompleted( false );
+}
+
+void KView::jobCompleted( bool /*hasPending*/ )
+{
+ loadingProgress( 0, 101 );
+ statusBar()->changeItem( "", STATUSBAR_SPEED_ID );
+}
+
+void KView::jobCanceled( const QString & errorMsg )
+{
+ statusBar()->message( errorMsg );
+ jobCompleted();
+}
+
+void KView::loadingProgress( KIO::Job *, unsigned long percent )
+{
+ if( percent > 100 )
+ {
+ m_pProgressBar->hide();
+ return;
+ }
+
+ if( ! m_pProgressBar->isVisible() )
+ m_pProgressBar->show();
+
+ m_pProgressBar->setValue( percent );
+}
+
+void KView::speedProgress( KIO::Job *, unsigned long bytesPerSecond )
+{
+ QString sizeStr;
+
+ if( bytesPerSecond > 0 )
+ sizeStr = i18n( "%1/s" ).arg( KIO::convertSize( bytesPerSecond ) );
+ else
+ sizeStr = i18n( "Stalled" );
+
+ statusBar()->changeItem( sizeStr, STATUSBAR_SPEED_ID );
+}
+
+void KView::slotSetStatusBarText( const QString & msg )
+{
+ kdDebug( 4600 ) << k_funcinfo << endl;
+ statusBar()->message( msg );
+ if( statusBar()->isHidden() )
+ KMessageBox::information( this, msg );
+}
+
+void KView::cursorPos( const QPoint & pos )
+{
+ statusBar()->changeItem( QString( "%1, %2" ).arg( pos.x() ).arg( pos.y() ), STATUSBAR_CURSOR_ID );
+}
+
+void KView::setupActions( QObject * partobject )
+{
+ // File
+ KStdAction::open( this, SLOT( slotOpenFile() ), actionCollection() );
+ m_paRecent = KStdAction::openRecent( this, SLOT( slotOpenRecent( const KURL & ) ), actionCollection() );
+ KAction * aClose = KStdAction::close( this, SLOT( slotClose() ), actionCollection() );
+ aClose->setEnabled( false );
+ connect( m_pViewer->widget(), SIGNAL( hasImage( bool ) ), aClose, SLOT( setEnabled( bool ) ) );
+
+ QObject * extension = partobject->child( 0, "KParts::BrowserExtension", false );
+ if( extension )
+ {
+ QStrList slotNames = extension->metaObject()->slotNames();
+ if( slotNames.contains( "print()" ) )
+ KStdAction::print( extension, SLOT( print() ), actionCollection(), "print" );
+ if( slotNames.contains( "del()" ) )
+ ( void )new KAction( i18n( "&Delete" ), "editdelete", SHIFT+Key_Delete,
+ extension, SLOT( del() ), actionCollection(), "del" );
+ connect( extension, SIGNAL( enableAction( const char *, bool ) ), SLOT( enableAction( const char *, bool ) ) );
+ }
+ KStdAction::quit( this, SLOT( close() ), actionCollection() );
+
+ // Edit
+ KAction * aCopy = KStdAction::copy( this, SLOT( slotCopy() ), actionCollection() );
+ aCopy->setEnabled( false );
+ connect( m_pViewer->widget(), SIGNAL( hasImage( bool ) ), aCopy, SLOT( setEnabled( bool ) ) );
+ m_paPaste = KStdAction::paste( this, SLOT( slotPaste() ), actionCollection() );
+ clipboardDataChanged(); //enable or disable paste
+ KAction * aCrop = new KAction( i18n( "Cr&op" ), Key_C, this, SLOT( slotCrop() ), actionCollection(), "crop" );
+ aCrop->setEnabled( false );
+
+ KAction * aReload = new KAction( i18n( "&Reload" ), "reload", KStdAccel::shortcut( KStdAccel::Reload ), partobject,
+ SLOT( reload() ), actionCollection(), "reload" );
+ aReload->setEnabled( false );
+ connect( m_pViewer->widget(), SIGNAL( hasImage( bool ) ), aReload, SLOT( setEnabled( bool ) ) );
+
+ // Settings
+ m_paShowMenubar = KStdAction::showMenubar( this, SLOT( slotToggleMenubar() ), actionCollection() );
+ createStandardStatusBarAction();
+ m_paShowStatusBar = ::qt_cast<KToggleAction*>( action( "options_show_statusbar" ) );
+ if( m_paShowStatusBar )
+ connect( m_paShowStatusBar, SIGNAL( toggled( bool ) ), SLOT( statusbarToggled( bool ) ) );
+ m_paShowFullScreen = KStdAction::fullScreen( 0, 0, actionCollection(), this );
+ connect( m_paShowFullScreen, SIGNAL( toggled( bool )), this, SLOT( slotUpdateFullScreen( bool )));
+ KStdAction::preferences( this, SLOT( slotPreferences() ), actionCollection() );
+ KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()),
+actionCollection());
+ KStdAction::configureToolbars( this, SLOT( slotConfigureToolbars() ), actionCollection() );
+}
+
+void KView::handleResize()
+{
+ if( m_bImageSizeChangedBlocked )
+ return;
+ m_bImageSizeChangedBlocked = true;
+ setUpdatesEnabled( false );
+ switch( m_nResizeMode )
+ {
+ case ResizeWindow:
+ fitWindowToImage();
+ fitWindowToImage();
+ break;
+ case ResizeImage:
+ m_pCanvas->boundImageTo( m_pViewer->widget()->size() );
+ break;
+ case BestFit:
+ QSize imageSize = m_pCanvas->imageSize();
+ if( imageSize.isEmpty() )
+ return;
+
+ // Compare the image size and the maximum available space in the
+ // display canvas i.e. will the image fit without resizing ?
+ QSize maxCanvas = maxCanvasSize();
+ if( ( maxCanvas.height() >= imageSize.height() )
+ && ( maxCanvas.width() >= imageSize.width() ) )
+ {
+ //Image can be displayed at full size
+ m_pCanvas->setZoom( 1.0 );
+ }
+ else
+ {
+ // Image is too big for the available canvas.
+ m_pCanvas->boundImageTo( maxCanvas );
+ }
+ // We assume the displayed image size has changed and we must resize
+ // the window around it (using the code for ResizeWindow).
+ fitWindowToImage();
+ fitWindowToImage();
+ break;
+ }
+ setUpdatesEnabled( true );
+ m_bImageSizeChangedBlocked = false;
+}
+
+void KView::fitWindowToImage()
+{
+ if( m_bFullscreen ) // don't do anything in fullscreen mode
+ return;
+
+ bool centeredOrig = m_pCanvas->centered();
+ m_pCanvas->setCentered( false );
+
+ QSize imagesize = m_pCanvas->currentSize();
+ if( imagesize.isEmpty() )
+ return;
+
+ QSize winsize = sizeForCentralWidgetSize( imagesize );
+ QRect workarea = m_pWinModule->workArea();
+
+ QScrollBar * sb = new QScrollBar( Qt::Horizontal, this );
+ int scrollbarwidth = sb->height();
+ delete sb;
+
+ if( winsize.width() > workarea.width() )
+ {
+ winsize.setWidth( workarea.width() );
+ winsize.rheight() += scrollbarwidth;
+ if( winsize.height() > workarea.height() )
+ winsize.setHeight( workarea.height() );
+ }
+ else if( winsize.height() > workarea.height() )
+ {
+ winsize.setHeight( workarea.height() );
+ winsize.rwidth() += scrollbarwidth;
+ if( winsize.width() > workarea.width() )
+ winsize.setWidth( workarea.width() );
+ }
+
+ QRect winrect( geometry() );
+ winrect.setSize( winsize );
+
+ int xdiff = winrect.x() + winrect.width() - workarea.x() - workarea.width();
+ int ydiff = winrect.y() + winrect.height() - workarea.y() - workarea.height();
+
+ if( xdiff > 0 )
+ {
+ winrect.rLeft() -= xdiff;
+ winrect.rRight() -= xdiff;
+ }
+ if( ydiff > 0 )
+ {
+ winrect.rTop() -= ydiff;
+ winrect.rBottom() -= ydiff;
+ }
+
+ setGeometry( winrect );
+
+ m_pCanvas->setCentered( centeredOrig );
+}
+
+QSize KView::barSize( int mainwinwidth, BarSizeFrom from )
+{
+ int height = 0;
+ int width = 0;
+ if( toolBar()->isVisibleTo( this ) )
+ {
+ switch( toolBar()->barPos() )
+ {
+ case KToolBar::Top:
+ case KToolBar::Bottom:
+ height += toolBar()->height();
+ break;
+ case KToolBar::Left:
+ case KToolBar::Right:
+ width += toolBar()->width();
+ break;
+ case KToolBar::Flat:
+ height += kapp->style().pixelMetric( QStyle::PM_DockWindowHandleExtent );
+ break;
+ case KToolBar::Floating:
+ break;
+ case KToolBar::Unmanaged:
+ break;
+ }
+ }
+ if( menuBar()->isVisibleTo( this ) && ( ! menuBar()->isTopLevelMenu() ) )
+ height += menuBar()->heightForWidth( mainwinwidth + ( ( from == FromImageSize ) ? width : 0 ) );
+ if( statusBar()->isVisibleTo( this ) )
+ height += statusBar()->height();
+
+ return QSize( width, height );
+}
+
+QSize KView::maxCanvasSize()
+{
+ QSize workarea = m_pWinModule->workArea().size();
+ QSize framesize = frameSize() - size();
+ QSize maxcanvassize = workarea - framesize - barSize( workarea.width() - framesize.width(), FromWidgetSize );
+ kdDebug( 4600 ) << "maxcanvassize = " << maxcanvassize.width() << "x" << maxcanvassize.height() << endl;
+ return maxcanvassize;
+}
+
+
+void KView::loadPlugins()
+{
+ createGUI( 0 );
+ createShellGUI( false );
+ createGUI( m_pViewer );
+}
+
+void KView::statusbarToggled( bool sbvisible )
+{
+ kdDebug( 4600 ) << k_funcinfo << sbvisible << endl;
+ m_pViewer->setProgressInfoEnabled( !sbvisible );
+}
+
+// vim:sw=4:ts=4
+
+#include "kview.moc"
+
diff --git a/kview/kview.desktop b/kview/kview.desktop
new file mode 100644
index 00000000..55b28991
--- /dev/null
+++ b/kview/kview.desktop
@@ -0,0 +1,95 @@
+[Desktop Entry]
+Type=Application
+Exec=kview -caption "%c" %i %m %U
+Icon=kview
+Path=
+DocPath=kview/index.html
+Terminal=false
+GenericName=Image Viewer
+GenericName[af]=Beeld Aansig
+GenericName[ar]=عارض صور
+GenericName[bg]=Преглед на изображения
+GenericName[br]=Gweler ar skeudennoù
+GenericName[bs]=Preglednik slika
+GenericName[ca]=Visualitzador d'imatges
+GenericName[cs]=Prohlížeč obrázků
+GenericName[cy]=Gwelydd Delweddau
+GenericName[da]=Billedfremviser
+GenericName[de]=Bildbetrachter
+GenericName[el]=Προβολέας εικόνων
+GenericName[eo]=Bildorigardilo
+GenericName[es]=Visor de imágenes
+GenericName[et]=Pildifailide näitaja
+GenericName[eu]=Irudi ikustailua
+GenericName[fa]=مشاهده‌گر تصویر
+GenericName[fi]=Kuvannäytin
+GenericName[fr]=Afficheur d'images
+GenericName[ga]=Amharcán Íomhánna
+GenericName[gl]=Visor de imaxes
+GenericName[he]=מציג תמונות
+GenericName[hi]=छवि प्रदर्शक
+GenericName[hr]=Preglednik slika
+GenericName[hu]=Képnézegető
+GenericName[is]=Myndaskoðari
+GenericName[it]=Visore di immagini
+GenericName[ja]=画像ビューア
+GenericName[kk]=Кескіндерді қарау
+GenericName[km]=កម្មវិធី​មើល​រូបភាព
+GenericName[lt]=Paveikslėlių žiūriklis
+GenericName[lv]=Attēlu Skatītājs
+GenericName[ms]=Paparan Imej
+GenericName[mt]=Werrej tal-istampi
+GenericName[nb]=Bildefremviser
+GenericName[nds]=Bildkieker
+GenericName[ne]=छवि दर्शक
+GenericName[nl]=Afbeeldingenweergaveprogramma
+GenericName[nn]=Biletvisar
+GenericName[nso]=Molebeledi wa Ponagalo
+GenericName[pa]=ਚਿੱਤਰ ਦਰਸ਼ਕ
+GenericName[pl]=Przeglądarka obrazków
+GenericName[pt]=Visualizador de Imagens
+GenericName[pt_BR]=Visualizador de Imagens
+GenericName[ro]=Vizualizor de imagini
+GenericName[ru]=Просмотр изображений
+GenericName[rw]=Mugaraza Shusho
+GenericName[se]=Govvačájeheaddji
+GenericName[sk]=Prehliadač obrázkov
+GenericName[sl]=Pregledovalnik slik
+GenericName[sr]=Приказивач слика
+GenericName[sr@Latn]=Prikazivač slika
+GenericName[sv]=Bildvisare
+GenericName[ta]=பிம்ப காட்சி
+GenericName[tg]=Намоиши тасвирот
+GenericName[th]=เครื่องมือแสดงภาพ
+GenericName[tr]=Resim Göstericisi
+GenericName[uk]=Переглядач зображень
+GenericName[uz]=Rasm koʻruvchi
+GenericName[uz@cyrillic]=Расм кўрувчи
+GenericName[ven]=Tshivhoni tsha Mutaleli
+GenericName[wa]=Håyneu d' imådjes
+GenericName[xh]=Umboniseli Womfanekiso
+GenericName[zh_CN]=图片查看程序
+GenericName[zh_HK]=圖像檢視器
+GenericName[zh_TW]=影像檢視程式
+GenericName[zu]=Umbonisi Womfanekiso
+MimeType=image/gif;image/x-xpm;image/x-xbm;image/jpeg;image/x-bmp;image/png;image/x-ico;image/x-portable-bitmap;image/x-portable-pixmap;image/x-portable-greymap;image/tiff;image/jp2;
+Name=KView
+Name[af]=K-bekyk
+Name[ar]=برنامج KView
+Name[cy]=KGweld
+Name[eo]=Rigardilo
+Name[hi]=के-व्यू
+Name[hr]=Preglednik slika
+Name[lv]=KSkatīt
+Name[ne]=केडीई दर्शक
+Name[pl]=Przeglądarka obrazków
+Name[pt_BR]=KVisualização
+Name[sv]=Kview
+Name[ta]=கேகாட்சி
+Name[th]=ดูภาพ - K
+Name[ven]=U vhona ha K
+Name[zh_TW]=KView 檢視器
+InitialPreference=3
+X-KDE-StartupNotify=true
+X-DCOP-ServiceType=Multi
+Categories=Qt;KDE;Graphics;
diff --git a/kview/kview.h b/kview/kview.h
new file mode 100644
index 00000000..0f523efc
--- /dev/null
+++ b/kview/kview.h
@@ -0,0 +1,124 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2003 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef KVIEW_H
+#define KVIEW_H
+
+#include <config.h>
+
+#include <kapplication.h>
+#include <kparts/mainwindow.h>
+
+namespace KParts {
+ class ReadWritePart;
+}
+namespace KImageViewer {
+ class Canvas;
+ class Viewer;
+}
+class QSize;
+class QRect;
+class KAction;
+class KToggleAction;
+class KRecentFilesAction;
+class KWinModule;
+class QStringList;
+class KProgress;
+
+class KView : public KParts::MainWindow
+{
+ Q_OBJECT
+ public:
+ KView();
+ virtual ~KView();
+ void load( const KURL & url );
+ void loadFromStdin();
+ QSize sizeForCentralWidgetSize( QSize );
+ KImageViewer::Viewer * viewer() const { return m_pViewer; }
+
+ protected:
+ bool queryClose();
+ void saveProperties( KConfig * );
+ void readProperties( KConfig * );
+ void saveSettings( KConfig * );
+
+ virtual bool eventFilter( QObject *, QEvent * );
+
+ protected slots:
+ void readSettings(); //KConfig * );
+ void imageSizeChanged( const QSize & );
+ void selectionChanged( const QRect & );
+ void contextPress( const QPoint & );
+ void slotOpenFile();
+ void slotOpenRecent( const KURL & );
+ void slotClose();
+ void slotCopy();
+ void slotPaste();
+ void slotCrop();
+ void slotUpdateFullScreen( bool );
+ void slotToggleMenubar();
+ void slotPreferences();
+ void slotConfigureToolbars();
+ void slotNewToolbarConfig();
+ void reloadConfig();
+ void enableAction( const char *, bool );
+ void clipboardDataChanged();
+ void jobStarted( KIO::Job * );
+ void jobCompleted();
+ void jobCompleted( bool );
+ void jobCanceled( const QString & );
+ void loadingProgress( KIO::Job *, unsigned long );
+ void speedProgress( KIO::Job *, unsigned long );
+ void slotSetStatusBarText( const QString & );
+ void cursorPos( const QPoint & ); // write the cursor pos to the statusbar
+ void loadPlugins();
+ void statusbarToggled( bool );
+
+ private:
+ enum BarSizeFrom { FromImageSize, FromWidgetSize };
+ enum ResizeMode { ResizeWindow = 0, ResizeImage = 1, NoResize = 2, BestFit = 3 };
+ enum StatusBarItem { STATUSBAR_SPEED_ID, STATUSBAR_CURSOR_ID, STATUSBAR_SIZE_ID, STATUSBAR_SELECTION_ID };
+ void setupActions( QObject * );
+ void handleResize();
+ void fitWindowToImage();
+ QSize barSize( int, BarSizeFrom );
+ QSize maxCanvasSize();
+
+ KImageViewer::Viewer * m_pViewer;
+ KImageViewer::Canvas * m_pCanvas;
+ KWinModule * m_pWinModule;
+
+ // Actions:
+ KAction * m_paOpenFile;
+ KAction * m_paPaste;
+ KRecentFilesAction * m_paRecent;
+ KAction * m_paQuit;
+ KToggleFullScreenAction * m_paShowFullScreen;
+ KToggleAction * m_paShowMenubar;
+ KToggleAction * m_paShowStatusBar;
+
+ int m_nResizeMode;
+ bool m_bImageSizeChangedBlocked;
+ bool m_bFullscreen;
+
+ KProgress * m_pProgressBar;
+};
+
+// vim:sw=4:ts=4
+
+#endif // KVIEW_H
diff --git a/kview/kviewcanvas/ChangeLog b/kview/kviewcanvas/ChangeLog
new file mode 100644
index 00000000..1edb3529
--- /dev/null
+++ b/kview/kviewcanvas/ChangeLog
@@ -0,0 +1,18 @@
+2003-09-27 Matthias Kretz <kretz@kde.org>
+
+ * config/confmodules.cpp:
+ Call m_config->sync() in save() and use a real KConfig object instead of
+ a KSimpleConfig.
+ * kimagecanvas.cpp:
+ Renamed readSettings to loadSettings and call it in the ctor.
+
+2003-08-19 Matthias Kretz <kretz@kde.org>
+
+ * kimagecanvas.cpp:
+ Fix checkBounds() to always keep the aspect ratio.
+ Create the factory with it's own KInstance.
+ * kimagecanvas.{h,cpp}:
+ New method boundImageTo( QSize ). Fits the image into the
+ requested width and height.
+
+# vim: sw=4 ts=4 tw=80 noet
diff --git a/kview/kviewcanvas/Makefile.am b/kview/kviewcanvas/Makefile.am
new file mode 100644
index 00000000..27e45d9f
--- /dev/null
+++ b/kview/kviewcanvas/Makefile.am
@@ -0,0 +1,18 @@
+SUBDIRS = config test
+
+kde_module_LTLIBRARIES = libkviewcanvas.la
+INCLUDES = -I$(top_srcdir)/kview $(all_includes)
+
+noinst_HEADERS = kimageholder.h kimagecanvas.h
+
+libkviewcanvas_la_SOURCES = kimageholder.cpp kimagecanvas.cpp
+libkviewcanvas_la_LDFLAGS = $(all_libraries) -module -no-undefined -avoid-version
+libkviewcanvas_la_LIBADD = $(LIB_KPARTS) $(LIB_KDEPRINT) $(LIB_KUTILS) \
+ $(top_builddir)/kview/kimageviewer/libkimageviewer.la
+
+METASOURCES = AUTO
+
+kde_services_DATA = kviewcanvas.desktop
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/kviewcanvas.pot
diff --git a/kview/kviewcanvas/config/Makefile.am b/kview/kviewcanvas/config/Makefile.am
new file mode 100644
index 00000000..b22a1ad5
--- /dev/null
+++ b/kview/kviewcanvas/config/Makefile.am
@@ -0,0 +1,16 @@
+kde_module_LTLIBRARIES = kcm_kviewcanvasconfig.la
+INCLUDES = $(all_includes)
+
+noinst_HEADERS = confmodules.h
+
+kcm_kviewcanvasconfig_la_SOURCES = generalconfigwidget.ui confmodules.cpp
+kcm_kviewcanvasconfig_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) -module -avoid-version
+kcm_kviewcanvasconfig_la_LIBADD = $(LIB_KDEUI)
+
+kcm_kviewcanvasconfig_DATA = kviewcanvasconfig.desktop
+kcm_kviewcanvasconfigdir = $(kde_servicesdir)/kconfiguredialog
+
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/kcm_kviewcanvasconfig.pot
diff --git a/kview/kviewcanvas/config/confmodules.cpp b/kview/kviewcanvas/config/confmodules.cpp
new file mode 100644
index 00000000..c5e47dac
--- /dev/null
+++ b/kview/kviewcanvas/config/confmodules.cpp
@@ -0,0 +1,145 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2003 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#include "confmodules.h"
+#include "generalconfigwidget.h"
+#include "defaults.h"
+
+#include <qlayout.h>
+#include <qcheckbox.h>
+#include <qframe.h>
+
+#include <klocale.h>
+#include <ksimpleconfig.h>
+#include <kcolorbutton.h>
+#include <klistview.h>
+#include <knuminput.h>
+#include <kgenericfactory.h>
+
+typedef KGenericFactory<KViewCanvasConfig, QWidget> KViewCanvasConfigFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_kviewcanvasconfig, KViewCanvasConfigFactory( "kcm_kviewcanvasconfig" ) )
+
+KViewCanvasConfig::KViewCanvasConfig( QWidget * parent, const char *, const QStringList & args )
+ : KCModule( KViewCanvasConfigFactory::instance(), parent, args )
+ , m_config( new KConfig( "kviewcanvasrc" ) )
+{
+ QBoxLayout * layout = new QVBoxLayout( this );
+ layout->setAutoAdd( true );
+
+ m_pWidget = new GeneralConfigWidget( this );
+ m_pWidget->m_pMinWidth ->setRange( 1, 200 );
+ m_pWidget->m_pMinHeight->setRange( 1, 200 );
+ m_pWidget->m_pMaxWidth ->setRange( 1, 10000 );
+ m_pWidget->m_pMaxHeight->setRange( 1, 10000 );
+
+ // clear m_items
+ m_items.clear();
+
+ for( unsigned int i = 1; i <= Defaults::numOfBlendEffects; ++i )
+ {
+ QCheckListItem * item = new QCheckListItem( m_pWidget->m_pListView, i18n( Defaults::blendEffectDescription[ i ] ), QCheckListItem::CheckBox );
+ m_items.append( item );
+ }
+
+ connect( m_pWidget->m_pListView, SIGNAL( clicked( QListViewItem * ) ), this, SLOT( configChanged() ) );
+ connect( m_pWidget->m_pListView, SIGNAL( spacePressed( QListViewItem * ) ), this, SLOT( configChanged() ) );
+
+ connect( m_pWidget->m_pSmoothScaling, SIGNAL( toggled( bool ) ), this, SLOT( configChanged() ) );
+ connect( m_pWidget->m_pKeepRatio, SIGNAL( toggled( bool ) ), this, SLOT( configChanged() ) );
+ connect( m_pWidget->m_pCenterImage, SIGNAL( toggled( bool ) ), this, SLOT( configChanged() ) );
+ connect( m_pWidget->m_bgColor, SIGNAL( changed( const QColor & ) ), this, SLOT( configChanged() ) );
+ connect( m_pWidget->m_pMinWidth, SIGNAL( valueChanged( int ) ), this, SLOT( configChanged() ) );
+ connect( m_pWidget->m_pMaxWidth, SIGNAL( valueChanged( int ) ), this, SLOT( configChanged() ) );
+ connect( m_pWidget->m_pMinHeight, SIGNAL( valueChanged( int ) ), this, SLOT( configChanged() ) );
+ connect( m_pWidget->m_pMaxHeight, SIGNAL( valueChanged( int ) ), this, SLOT( configChanged() ) );
+
+ load();
+}
+
+KViewCanvasConfig::~KViewCanvasConfig()
+{
+}
+
+void KViewCanvasConfig::save()
+{
+ KConfigGroup cfgGroup( m_config, "Settings" );
+ cfgGroup.writeEntry( "Smooth Scaling", m_pWidget->m_pSmoothScaling->isChecked() );
+ cfgGroup.writeEntry( "Keep Aspect Ratio", m_pWidget->m_pKeepRatio->isChecked() );
+ cfgGroup.writeEntry( "Center Image", m_pWidget->m_pCenterImage->isChecked() );
+
+ cfgGroup.writeEntry( "Background Color", m_pWidget->m_bgColor->color() );
+
+ cfgGroup.writeEntry( "Minimum Width" , m_pWidget->m_pMinWidth->value() );
+ cfgGroup.writeEntry( "Minimum Height", m_pWidget->m_pMinHeight->value() );
+ cfgGroup.writeEntry( "Maximum Width" , m_pWidget->m_pMaxWidth->value() );
+ cfgGroup.writeEntry( "Maximum Height", m_pWidget->m_pMaxHeight->value() );
+
+ KConfigGroup cfgGroup2( m_config, "Blend Effects" );
+ QCheckListItem *item = m_items.first();
+ for( int i = 1; item; item = m_items.next(), ++i )
+ cfgGroup2.writeEntry( QString::number( i ), item->isOn() );
+ m_config->sync();
+}
+
+void KViewCanvasConfig::load()
+{
+ KConfigGroup cfgGroup( m_config, "Settings" );
+ m_pWidget->m_pSmoothScaling->setChecked( cfgGroup.readBoolEntry( "Smooth Scaling", Defaults::smoothScaling ) );
+ m_pWidget->m_pKeepRatio->setChecked( cfgGroup.readBoolEntry( "Keep Aspect Ratio", Defaults::keepAspectRatio ) );
+ m_pWidget->m_pCenterImage->setChecked( cfgGroup.readBoolEntry( "Center Image", Defaults::centerImage ) );
+
+ m_pWidget->m_bgColor->setColor( cfgGroup.readColorEntry( "Background Color", &Defaults::bgColor ) );
+
+ m_pWidget->m_pMinWidth ->setValue( cfgGroup.readNumEntry( "Minimum Width" , Defaults::minSize.width() ) );
+ m_pWidget->m_pMinHeight->setValue( cfgGroup.readNumEntry( "Minimum Height", Defaults::minSize.height() ) );
+ m_pWidget->m_pMaxWidth ->setValue( cfgGroup.readNumEntry( "Maximum Width" , Defaults::maxSize.width() ) );
+ m_pWidget->m_pMaxHeight->setValue( cfgGroup.readNumEntry( "Maximum Height", Defaults::maxSize.height() ) );
+
+ KConfigGroup cfgGroup2( m_config, "Blend Effects" );
+ QCheckListItem * item = m_items.first();
+ for( int i = 1; item; item = m_items.next(), ++i )
+ item->setOn( cfgGroup2.readBoolEntry( QString::number( i ), false ) );
+}
+
+void KViewCanvasConfig::defaults()
+{
+ m_pWidget->m_pSmoothScaling->setChecked( Defaults::smoothScaling );
+ m_pWidget->m_pKeepRatio->setChecked( Defaults::keepAspectRatio );
+ m_pWidget->m_pCenterImage->setChecked( Defaults::centerImage );
+
+ m_pWidget->m_bgColor->setColor( Defaults::bgColor );
+
+ m_pWidget->m_pMinWidth ->setValue( Defaults::minSize.width() );
+ m_pWidget->m_pMinHeight->setValue( Defaults::minSize.height() );
+ m_pWidget->m_pMaxWidth ->setValue( Defaults::maxSize.width() );
+ m_pWidget->m_pMaxHeight->setValue( Defaults::maxSize.height() );
+
+ QCheckListItem * item = m_items.first();
+ for( int i = 1; item; item = m_items.next(), ++i )
+ item->setOn( false );
+ emit changed( true );
+}
+
+void KViewCanvasConfig::configChanged()
+{
+ emit changed( true );
+}
+
+// vim:sw=4:ts=4
+
+#include "confmodules.moc"
diff --git a/kview/kviewcanvas/config/confmodules.h b/kview/kviewcanvas/config/confmodules.h
new file mode 100644
index 00000000..f7dfe262
--- /dev/null
+++ b/kview/kviewcanvas/config/confmodules.h
@@ -0,0 +1,51 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2003 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef CONFMODULES_H
+#define CONFMODULES_H
+
+#include <kcmodule.h>
+#include <qptrlist.h>
+
+class GeneralConfigWidget;
+class QCheckListItem;
+class KConfig;
+
+class KViewCanvasConfig : public KCModule
+{
+ Q_OBJECT
+ public:
+ KViewCanvasConfig( QWidget * parent, const char * name = 0, const QStringList & args = QStringList() );
+ ~KViewCanvasConfig();
+
+ void load();
+ void save();
+ void defaults();
+
+ private slots:
+ void configChanged();
+
+ private:
+ KConfig * m_config;
+ GeneralConfigWidget * m_pWidget;
+ QPtrList<QCheckListItem> m_items;
+};
+
+// vim:sw=4:ts=4
+
+#endif // CONFMODULES_H
diff --git a/kview/kviewcanvas/config/defaults.h b/kview/kviewcanvas/config/defaults.h
new file mode 100644
index 00000000..0a92d651
--- /dev/null
+++ b/kview/kviewcanvas/config/defaults.h
@@ -0,0 +1,46 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef DEFAULTS_H
+#define DEFAULTS_H
+
+#include <klocale.h>
+#include <qsize.h>
+#include <qcolor.h>
+
+namespace Defaults {
+ static const bool smoothScaling = false;
+ static const bool keepAspectRatio = true;
+ static const bool centerImage = true;
+ static const QColor bgColor( Qt::black );
+ static const QSize minSize( 1, 1 );
+ static const QSize maxSize( 10000, 10000 );
+ static const unsigned int numOfBlendEffects = 4;
+ static const char * blendEffectDescription[ 6 ] = {
+ I18N_NOOP( "No Blending" ),
+ I18N_NOOP( "Wipe From Left" ),
+ I18N_NOOP( "Wipe From Right" ),
+ I18N_NOOP( "Wipe From Top" ),
+ I18N_NOOP( "Wipe From Bottom" ),
+ I18N_NOOP( "Alpha Blend" )
+ };
+}
+
+#endif // DEFAULTS_H
+
+// vim: sw=4 ts=4
diff --git a/kview/kviewcanvas/config/generalconfigwidget.ui b/kview/kviewcanvas/config/generalconfigwidget.ui
new file mode 100644
index 00000000..b4646381
--- /dev/null
+++ b/kview/kviewcanvas/config/generalconfigwidget.ui
@@ -0,0 +1,300 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>GeneralConfigWidget</class>
+<author>Matthias Kretz &lt;kretz@kde.org&gt;</author>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>GeneralConfigWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>398</width>
+ <height>327</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KIntNumInput" row="0" column="1">
+ <property name="name">
+ <cstring>m_pMinHeight</cstring>
+ </property>
+ <property name="label">
+ <string>Minimum height:</string>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="maxValue">
+ <number>200</number>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The height of the image shown will not get smaller than the size you enter here.
+A value of 10 would cause a 1x1 image to be stretched vertically by a factor of 10.</string>
+ </property>
+ </widget>
+ <widget class="KIntNumInput" row="1" column="1">
+ <property name="name">
+ <cstring>m_pMaxHeight</cstring>
+ </property>
+ <property name="label">
+ <string>Maximum height:</string>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="maxValue">
+ <number>100000</number>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The height of the image shown will not get bigger than the size you enter here.
+A value of 100 would cause a 1000x1000 image to be compressed vertically by a factor of 0.1.</string>
+ </property>
+ </widget>
+ <widget class="KIntNumInput" row="0" column="0">
+ <property name="name">
+ <cstring>m_pMinWidth</cstring>
+ </property>
+ <property name="label">
+ <string>Minimum width:</string>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="maxValue">
+ <number>200</number>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The width of the image shown will not get smaller than the size you enter here.
+A value of 10 would cause a 1x1 image to be stretched horizontally by a factor of 10.</string>
+ </property>
+ </widget>
+ <widget class="KIntNumInput" row="1" column="0">
+ <property name="name">
+ <cstring>m_pMaxWidth</cstring>
+ </property>
+ <property name="label">
+ <string>Maximum width:</string>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="maxValue">
+ <number>100000</number>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The width of the image shown will not get bigger than the size you enter here.
+A value of 100 would cause a 1000x1000 image to be compressed horizontally by a factor of 0.1.</string>
+ </property>
+ </widget>
+ <spacer row="1" column="2">
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>MinimumExpanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="0" column="2">
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>MinimumExpanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Choose which blend effects should be used:</string>
+ </property>
+ </widget>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>Effect</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>m_pListView</cstring>
+ </property>
+ <property name="selectionMode" stdset="0">
+ <enum>NoSelection</enum>
+ </property>
+ <property name="fullWidth">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Every effect selected may be used to create a transition effect between the images. If you select multiple effects they will be chosen randomly.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_pSmoothScaling</cstring>
+ </property>
+ <property name="text">
+ <string>Use smooth scaling (high quality but slower)</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_pKeepRatio</cstring>
+ </property>
+ <property name="text">
+ <string>Keep aspect ratio</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If this is checked KView will always try to keep the aspect ratio. That means if the width is scaled with a factor x, the height is scaled with the same factor.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_pCenterImage</cstring>
+ </property>
+ <property name="text">
+ <string>Center image</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox" row="0" column="1">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>&amp;Background Color</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KColorButton">
+ <property name="name">
+ <cstring>m_bgColor</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>151</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<tabstops>
+ <tabstop>m_pSmoothScaling</tabstop>
+ <tabstop>m_pKeepRatio</tabstop>
+ <tabstop>m_pCenterImage</tabstop>
+ <tabstop>m_pMinWidth</tabstop>
+ <tabstop>m_pMinHeight</tabstop>
+ <tabstop>m_pMaxWidth</tabstop>
+ <tabstop>m_pMaxHeight</tabstop>
+ <tabstop>m_pListView</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>klistview.h</includehint>
+ <includehint>kcolorbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/kview/kviewcanvas/config/kviewcanvasconfig.desktop b/kview/kviewcanvas/config/kviewcanvasconfig.desktop
new file mode 100644
index 00000000..7ce31c64
--- /dev/null
+++ b/kview/kviewcanvas/config/kviewcanvasconfig.desktop
@@ -0,0 +1,118 @@
+[Desktop Entry]
+Icon=kview
+Type=Service
+ServiceTypes=KCModule
+
+X-KDE-ModuleType=Library
+X-KDE-Library=kviewcanvasconfig
+X-KDE-FactoryName=KViewCanvasConfigFactory
+X-KDE-ParentApp=kview
+X-KDE-ParentComponents=kviewcanvas
+X-KDE-Weight=1
+X-KDE-CfgDlgHierarchy=Viewer
+
+Name=Viewer
+Name[ar]=العارض
+Name[bg]=Визуализатор
+Name[br]=Gweler
+Name[bs]=Preglednik
+Name[ca]=Visualitzador
+Name[cs]=Prohlížeč
+Name[cy]=Gwelydd
+Name[da]=Fremviser
+Name[de]=Betrachter
+Name[el]=Προβολέας
+Name[eo]=Rigardilo
+Name[es]=Visor
+Name[et]=Näitaja
+Name[eu]=Ikustailua
+Name[fa]=مشاهده‌گر
+Name[fi]=Näytin
+Name[fr]=Afficheur
+Name[gl]=Visor
+Name[he]=מציג
+Name[hi]=प्रदर्शक
+Name[hu]=Nézegető
+Name[is]=Birtir
+Name[it]=Visore
+Name[ja]=ビューア
+Name[kk]=Кескінді қарау
+Name[km]=កម្មវិធី​មើល
+Name[lt]=Žiūriklis
+Name[ms]=Pemapar
+Name[nb]=Fremviser
+Name[nds]=Kieker
+Name[ne]=दर्शक
+Name[nl]=Weergaveprogramma
+Name[nn]=Framvisar
+Name[pa]=ਦਰਸ਼ਕ
+Name[pl]=Przeglądarka obrazków
+Name[pt]=Visualizador
+Name[pt_BR]=Visualizador
+Name[ro]=Vizualizor
+Name[ru]=Просмотрщик
+Name[se]=Čájeheaddji
+Name[sk]=Prehliadač
+Name[sl]=Pregledovalnik
+Name[sr]=Приказивач
+Name[sr@Latn]=Prikazivač
+Name[sv]=Visning
+Name[ta]=காட்சி
+Name[tg]=Намоишгар
+Name[tr]=Görüntüleyici
+Name[uk]=Переглядач
+Name[uz]=Koʻruvchi
+Name[uz@cyrillic]=Кўрувчи
+Name[wa]=Håyneu
+Name[zh_CN]=查看器
+Name[zh_HK]=檢視器
+Comment=General KViewCanvas Configuration
+Comment[ar]=اعدادات KViewCanvas العامة
+Comment[bg]=Общи настройки на визуализатора (KViewCanvas)
+Comment[bs]=Opšte KViewCanvas postavke
+Comment[ca]=Configuració general de KViewCanvas
+Comment[cs]=Obecné nastavení KView
+Comment[cy]=Ffurfweddiad Cyffredinol KGweldCynfas
+Comment[da]=Generel indstilling af KViewCanvas
+Comment[de]=Allgemeine Einstellungen für KViewCanvas
+Comment[el]=Γενική ρύθμιση του KViewCanvas
+Comment[eo]=Ĝenerala Agordo de KViewCanvas
+Comment[es]=Configuración general de KViewCanvas
+Comment[et]=KView lõuendite üldine seadistus
+Comment[eu]=KViewCanvas konfigurazio orokorra
+Comment[fa]=پیکربندی عمومی KViewCanvas
+Comment[fi]=Yleiset KViewCanvas -asetukset
+Comment[fr]=Configuration générale de KViewCanvas
+Comment[gl]=Configuración xeral de KViewCanvas
+Comment[he]=הגדרות KViewCanvas כלליות
+Comment[hi]=सामान्य के-व्यू-केनवास कॉन्फ़िगरेशन
+Comment[hu]=A KViewCanvas általános beállításai
+Comment[is]=Almennar stillingar KViewCanvas
+Comment[it]=Configurazione generale per KViewCanvas
+Comment[ja]=KViewCanvas の一般的な設定
+Comment[kk]=KViewCanvas өрісінің жалпы баптаулары
+Comment[km]=ការ​កំណត់​រចនាសម្ព័ន្ធ​ទូទៅ​សម្រាប់ KViewCanvas
+Comment[lt]=Bendrasis KViewCanvas konfigūravimas
+Comment[ms]=Konfigurasi KViewCanvas Umum
+Comment[nb]=Generelt oppsett av KViewCanvas
+Comment[nds]=Allgemeen Instellen för KViewCanvas
+Comment[ne]=साधारण केडीई दृश्य क्यानभास कन्फिगरेसन
+Comment[nl]=Algemene KViewCanvas instellingen
+Comment[nn]=Generelt oppsett av KViewCanvas
+Comment[pl]=Ogólna konfiguracja KViewCanvas
+Comment[pt]=Configuração Geral do KViewCanvas
+Comment[pt_BR]=Configuração Geral do Canvas com o KView
+Comment[ro]=Configurare KViewCanvas general
+Comment[ru]=Общая настройка KViewCanvas
+Comment[sk]=Všeobecné nastavenie KViewCanvas
+Comment[sl]=Splošne nastavitve KViewCanvas
+Comment[sr]=Општа подешавања за KViewCanvas
+Comment[sr@Latn]=Opšta podešavanja za KViewCanvas
+Comment[sv]=Allmän inställning av Kviews duk
+Comment[ta]=பொதுவான கேகாட்சி சித்திரவடிவ வடிவமைப்பு
+Comment[tg]=Танзимоти умумии KViewCanvas
+Comment[tr]=Genel KView Ekran Ayarları
+Comment[uk]=Загальні параметри KViewCanvas
+Comment[zh_CN]=KViewCanvas 常规配置
+Comment[zh_HK]=一般 KViewCanvas 設定
+Comment[zh_TW]=一般 KViewCanvas 設定
diff --git a/kview/kviewcanvas/kimagecanvas.cpp b/kview/kviewcanvas/kimagecanvas.cpp
new file mode 100644
index 00000000..6c54850f
--- /dev/null
+++ b/kview/kviewcanvas/kimagecanvas.cpp
@@ -0,0 +1,953 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#include "kimagecanvas.h"
+#include "kimageholder.h"
+#include "version.h"
+#include "config/defaults.h"
+
+#include <qcolor.h>
+#include <qimage.h>
+#include <qapplication.h>
+#include <qwmatrix.h>
+#include <qtimer.h>
+
+#include <kpixmap.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <ksettings/dispatcher.h>
+#include <kconfig.h>
+
+#define KIMAGECANVAS_WIPESIZE 5
+
+const int MOUSECURSORHIDETIME = 3000;
+
+//extern bool qt_use_xrender;
+
+typedef KGenericFactory<KImageCanvas> KImageCanvasFactory;
+K_EXPORT_COMPONENT_FACTORY( libkviewcanvas,
+ KImageCanvasFactory( "kviewcanvas" ) )
+
+KImageCanvas::KImageCanvas( QWidget * parent, const char * name, const QStringList & )
+ : QScrollView( parent, name, WResizeNoErase | WStaticContents )
+ , m_client( 0 )
+ , m_oldClient( 0 )
+ , m_image( 0 )
+ , m_imageTransformed( 0 )
+ , m_pixmap( 0 )
+ , m_pTimer( new QTimer( this, "KImageCanvas/Timer" ) )
+ , m_maxsize( Defaults::maxSize )
+ , m_minsize( Defaults::minSize )
+ , m_currentsize( 0, 0 )
+ , m_zoom( 1.0 )
+ , m_fastscale( ! Defaults::smoothScaling )
+ , m_keepaspectratio( Defaults::keepAspectRatio )
+ , m_bImageChanged( false )
+ , m_bSizeChanged( false )
+ , m_bNeedNewPixmap( false )
+ , m_bCentered( Defaults::centerImage )
+ , m_bImageUpdateScheduled( false )
+ , m_bNewImage( false )
+ , m_iBlendTimerId( 0 )
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ setFrameStyle( QFrame::NoFrame );
+ setResizePolicy( QScrollView::Manual );
+ setMinimumSize( 0, 0 );
+ setBgColor( Defaults::bgColor );
+
+ connect( this, SIGNAL( imageChanged() ), this, SLOT( slotImageChanged() ) );
+ connect( m_pTimer, SIGNAL( timeout() ), this, SLOT( hideCursor() ) );
+
+ KSettings::Dispatcher::self()->registerInstance(
+ KImageCanvasFactory::instance(), this,
+ SLOT( loadSettings() ) );
+
+ viewport()->setFocusProxy( this );
+ clear();
+
+ QWidget::setMouseTracking( true );
+ viewport()->setMouseTracking( true );
+ m_cursor.setShape( Qt::CrossCursor );
+ viewport()->setCursor( m_cursor );
+ m_pTimer->start( MOUSECURSORHIDETIME, true );
+
+ loadSettings();
+}
+
+KImageCanvas::~KImageCanvas()
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ delete m_image; m_image = 0;
+ delete m_pixmap; m_pixmap = 0;
+}
+
+void KImageCanvas::setBgColor( const QColor & color )
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ viewport()->setPaletteBackgroundColor( color );
+ if( m_client )
+ m_client->setPaletteBackgroundColor( color );
+}
+
+const QColor & KImageCanvas::bgColor() const
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ return viewport()->paletteBackgroundColor();
+}
+
+int KImageCanvas::imageDepth() const
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ if( ! m_image )
+ return 0;
+
+ return m_image->depth();
+}
+
+QSize KImageCanvas::imageSize() const
+{
+ //kdDebug( 4620 ) << k_funcinfo << endl;
+ if( ! m_image )
+ return QSize( 0, 0 );
+
+ return m_matrix.isIdentity() ? m_image->size() : m_matrix.mapRect( QRect( QPoint(), m_image->size() ) ).size();
+}
+
+QSize KImageCanvas::currentSize() const
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ if( ! m_image )
+ return QSize( 0, 0 );
+
+ return m_currentsize;
+}
+
+const QImage * KImageCanvas::image() const
+{
+ if( m_imageTransformed )
+ return m_imageTransformed;
+ return m_image;
+}
+
+QRect KImageCanvas::selection() const
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ if( m_client )
+ return m_selection;
+ else
+ return QRect();
+}
+
+void KImageCanvas::setCentered( bool centered )
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ if( m_bCentered != centered )
+ {
+ m_bCentered = centered;
+ center();
+ }
+}
+
+void KImageCanvas::setImage( const QImage & newimage )
+{
+ bool emitHasImage = m_image ? false : true;
+ m_matrix.reset();
+ matrixChanged();
+ delete m_image;
+ m_image = new QImage( newimage );
+ m_bNewImage = true;
+ // don't emit the signal here - call the slot directly
+ slotImageChanged();
+
+ sizeFromZoom( m_zoom );
+ updateImage();
+ if( emitHasImage && m_image )
+ emit hasImage( true );
+}
+
+void KImageCanvas::setImage( const QImage & newimage, const QSize & size )
+{
+ kdDebug( 4620 ) << k_funcinfo << size << endl;
+ bool emitHasImage = m_image ? false : true;
+ m_matrix.reset();
+ matrixChanged();
+ delete m_image;
+ m_image = new QImage( newimage );
+ m_bNewImage = true;
+ // don't emit the signal here - call the slot directly
+ slotImageChanged();
+
+ resizeImage( size );
+ updateImage();
+ if( emitHasImage && m_image )
+ emit hasImage( true );
+}
+
+void KImageCanvas::setZoom( double zoom )
+{
+ kdDebug( 4620 ) << k_funcinfo << zoom << endl;
+ if( m_image == 0 )
+ return;
+
+ if( zoom > 0.0 && m_zoom != zoom )
+ {
+ m_zoom = zoom;
+ sizeFromZoom( m_zoom );
+ emit zoomChanged( m_zoom );
+ updateImage();
+ }
+}
+
+void KImageCanvas::boundImageTo( const QSize & size )
+{
+ bool keepAspectRatio = m_keepaspectratio;
+ m_keepaspectratio = true;
+ resizeImage( size );
+ m_keepaspectratio = keepAspectRatio;
+}
+
+void KImageCanvas::setMaximumImageSize( const QSize & maxsize )
+{
+ kdDebug( 4620 ) << k_funcinfo << maxsize << endl;
+ if( ( ! m_minsize.isEmpty() ) &&
+ ( maxsize.width() < m_minsize.width() || maxsize.height() < m_minsize.height() ) )
+ {
+ kdWarning( 4620 ) << "the new maximum image size is smaller than the minimum size" << endl;
+ return;
+ }
+
+ m_maxsize = maxsize;
+
+ resizeImage( m_currentsize );
+}
+
+void KImageCanvas::setMinimumImageSize( const QSize & minsize )
+{
+ kdDebug( 4620 ) << k_funcinfo << minsize << endl;
+ if( ( ! m_maxsize.isEmpty() ) &&
+ ( minsize.width() > m_maxsize.width() || minsize.height() > m_maxsize.height() ) )
+ {
+ kdWarning( 4620 ) << "the new minimum image size is greater than the maximum size" << endl;
+ return;
+ }
+
+ m_minsize = minsize;
+
+ resizeImage( m_currentsize );
+}
+
+void KImageCanvas::resizeImage( const QSize & newsize )
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ if( m_image == 0 )
+ return;
+
+ QSize size = newsize;
+
+ // check that it fits into min and max sizes
+ checkBounds( size );
+
+ // calculate the new zoom factor
+ zoomFromSize( size );
+
+ if( size != m_currentsize )
+ {
+ m_currentsize = size;
+ sizeChanged();
+
+ updateImage();
+ }
+}
+
+void KImageCanvas::hideScrollbars( bool hidden )
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ if( hidden )
+ {
+ setVScrollBarMode( AlwaysOff );
+ setHScrollBarMode( AlwaysOff );
+ }
+ else
+ {
+ setVScrollBarMode( Auto );
+ setHScrollBarMode( Auto );
+ }
+}
+
+void KImageCanvas::setKeepAspectRatio( bool aspect )
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ m_keepaspectratio = aspect;
+}
+
+unsigned int KImageCanvas::numOfBlendEffects() const
+{
+ return Defaults::numOfBlendEffects;
+}
+
+QString KImageCanvas::blendEffectDescription( unsigned int idx ) const
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ switch( idx )
+ {
+ case NoBlending:
+ kdWarning( 4620 ) << k_funcinfo << " shouldn't be called with an index of 0 - That's always not really defined\n";
+ return i18n( Defaults::blendEffectDescription[ 0 ] );
+ case AlphaBlend:
+ return i18n( Defaults::blendEffectDescription[ 5 ] );
+ case WipeFromLeft:
+ return i18n( Defaults::blendEffectDescription[ 1 ] );
+ case WipeFromRight:
+ return i18n( Defaults::blendEffectDescription[ 2 ] );
+ case WipeFromTop:
+ return i18n( Defaults::blendEffectDescription[ 3 ] );
+ case WipeFromBottom:
+ return i18n( Defaults::blendEffectDescription[ 4 ] );
+ }
+ kdError( 4620 ) << "Effect description for effect with index " << idx << " doesn't exist\n";
+ return QString::null;
+}
+
+bool KImageCanvas::eventFilter( QObject * obj, QEvent * ev )
+{
+ if( ( obj == m_client || obj == m_oldClient ) && ev->type() == QEvent::MouseMove )
+ mouseMoveEvent( static_cast<QMouseEvent*>( ev ) );
+ return QScrollView::eventFilter( obj, ev );
+}
+
+void KImageCanvas::setFastScale( bool fastscale )
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ m_fastscale = fastscale;
+ if( m_fastscale )
+ {
+ // wo do scaling with a matrix now, so the m_imageTransformed isn't needed anymore
+ delete m_imageTransformed;
+ m_imageTransformed = 0;
+ }
+ else
+ {
+ matrixChanged(); // set the flag to dirty so that a new m_imageTransformed will be created
+ // else we very relyably get a crash
+ }
+ updateImage();
+}
+
+void KImageCanvas::clear()
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ bool emitHasImage = m_image ? true : false;
+ delete m_image;
+ m_image = 0;
+ m_currentsize -= m_currentsize; //zero size
+ if( m_client )
+ m_client->clear();
+ if( emitHasImage && ! m_image )
+ emit hasImage( false );
+}
+
+void KImageCanvas::flipHorizontal( bool change )
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ if( m_image == 0 )
+ return;
+
+ if( change )
+ {
+ QWMatrix matrix( 1.0F, 0.0F, 0.0F, -1.0F, 0.0F, 0.0F );
+ *m_image = m_image->xForm( matrix );
+ emit imageChanged();
+ }
+ else
+ {
+ m_matrix.scale( 1.0, -1.0 );
+ matrixChanged();
+ }
+ // size didn't change
+ updateImage();
+}
+
+void KImageCanvas::flipVertical( bool change )
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ if( m_image == 0 )
+ return;
+
+ if( change )
+ {
+ QWMatrix matrix( -1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F );
+ *m_image = m_image->xForm( matrix );
+ emit imageChanged();
+ }
+ else
+ {
+ m_matrix.scale( -1.0, 1.0 );
+ matrixChanged();
+ }
+ // size didn't change
+ updateImage();
+}
+
+void KImageCanvas::rotate( double a, bool change )
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ if( m_image == 0 )
+ return;
+
+ if( change )
+ {
+ QWMatrix matrix;
+ matrix.rotate( a );
+ *m_image = m_image->xForm( matrix );
+ emit imageChanged();
+ }
+ else
+ {
+ m_matrix.rotate( a );
+ matrixChanged();
+ }
+ //adjust m_currentsize
+ sizeFromZoom( m_zoom );
+ updateImage();
+}
+
+void KImageCanvas::checkBounds( QSize & newsize )
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ if( m_keepaspectratio )
+ {
+ // check that the new size has the same aspect ratio the original image had
+ QSize origsize = imageSize();
+ double x1 = double( origsize.height() ) / double( newsize.height() );
+ double x2 = double( origsize.width() ) / double( newsize.width() );
+ if( ( newsize * x1 != origsize ) || ( newsize * x2 != origsize ) )
+ {
+ // not OK
+ kdDebug( 4620 ) << "checkBounds: the aspect ratio wasn't kept changing from " << newsize << endl;
+ // the user want's that the aspect ratio doesn't change. The
+ // question is: make it larger or smaller?
+ // we make it smaller (we depend on that in boundImageTo)
+ newsize = origsize / KMAX( x1, x2 );
+ kdDebug( 4620 ) << "checkBounds: to " << newsize << endl;
+ }
+ }
+ if( ( ! m_maxsize.isEmpty() ) &&
+ ( newsize.width() > m_maxsize.width() || newsize.height() > m_maxsize.height() ) )
+ {
+ kdDebug( 4620 ) << "checkBounds: the new size is bigger than the max size" << endl;
+ if( m_keepaspectratio )
+ {
+ double x1 = double( m_maxsize.height() ) / double( newsize.height() );
+ double x2 = double( m_maxsize.width() ) / double( newsize.width() );
+ double x = KMIN( x1, x2 );//( x1 > x2 ) ? x2 : x1;
+ newsize *= x;
+ }
+ else
+ newsize = newsize.boundedTo( m_maxsize );
+ }
+ if( ( ! m_minsize.isEmpty() ) &&
+ ( newsize.width() < m_minsize.width() || newsize.height() < m_minsize.height() ) )
+ {
+ kdDebug( 4620 ) << "checkBounds: the new size is smaller than the min size" << endl;
+ if( m_keepaspectratio )
+ {
+ double x1 = double( m_minsize.height() ) / double( newsize.height() );
+ double x2 = double( m_minsize.width() ) / double( newsize.width() );
+ double x = KMAX( x1, x2 );//( x1 > x2 ) ? x1 : x2;
+ newsize *= x;
+ }
+ else
+ newsize = newsize.expandedTo( m_minsize );
+ }
+ // if it still won't fit we have a problem: we can't keep the aspect ratio or we have
+ // to violate the min/max settings
+ if( ( ! m_maxsize.isEmpty() ) &&
+ ( newsize.width() > m_maxsize.width() || newsize.height() > m_maxsize.height() ) )
+ {
+ kdDebug( 4620 ) << "checkBounds: Sorry, I can't keep the aspect ratio." << endl;
+ newsize = newsize.boundedTo( m_maxsize );
+ }
+}
+
+void KImageCanvas::zoomFromSize( const QSize & newsize )
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ if( ! m_image )
+ return;
+
+ QSize originalsize = imageSize();
+ double widthzoom = double( newsize.width() ) / double( originalsize.width() );
+ double heightzoom = double( newsize.height() ) / double( originalsize.height() );
+ double zoom = ( widthzoom + heightzoom ) / 2;
+ if( zoom != m_zoom )
+ {
+ m_zoom = zoom;
+ emit zoomChanged( m_zoom );
+ }
+}
+
+void KImageCanvas::sizeFromZoom( double zoom )
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ if( ! m_image )
+ return;
+
+ QSize newsize = zoom * imageSize();
+ kdDebug( 4620 ) << "change size from " << imageSize() << " to " << newsize << endl;
+ resizeImage( newsize );
+}
+
+void KImageCanvas::updateImage()
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ if( ! m_bImageUpdateScheduled )
+ QTimer::singleShot( 0, this, SLOT( slotUpdateImage() ) );
+ m_bImageUpdateScheduled = true;
+}
+
+void KImageCanvas::slotUpdateImage()
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ m_bImageUpdateScheduled = false;
+ if( m_image == 0 )
+ return;
+
+ //only update if something was changed
+ if( m_bImageChanged || m_bSizeChanged || m_bMatrixChanged )
+ {
+ kdDebug( 4620 ) << "actually updating the image now" << endl;
+ QApplication::setOverrideCursor( WaitCursor );
+ if( m_bNewImage || ! m_client )
+ {
+ finishNewClient();
+ m_oldClient = m_client;
+ m_client = createNewClient();
+ }
+ m_client->setImage( pixmap() );
+
+ if( m_bSizeChanged || m_bNewImage )
+ {
+ QSize sh = m_client->sizeHint();
+ if( ! sh.isValid() )
+ sh = QSize( 0, 0 );
+ m_client->resize( sh );
+ resizeContents( sh.width(), sh.height() );
+ center();
+ }
+ QRect drawRect = m_client->drawRect();
+ switch( m_iBlendEffect )
+ {
+ case NoBlending:
+ break;
+ case AlphaBlend:
+ break;
+ case WipeFromLeft:
+ drawRect.setRight( KIMAGECANVAS_WIPESIZE + contentsX() );
+ m_client->setDrawRect( drawRect );
+ break;
+ case WipeFromRight:
+ drawRect.rLeft() += KMIN( drawRect.width() - KIMAGECANVAS_WIPESIZE, contentsX() + visibleWidth() );
+ m_client->setDrawRect( drawRect );
+ break;
+ case WipeFromTop:
+ drawRect.setBottom( KIMAGECANVAS_WIPESIZE + contentsY() );
+ m_client->setDrawRect( drawRect );
+ break;
+ case WipeFromBottom:
+ drawRect.setTop( KMIN( drawRect.height() - KIMAGECANVAS_WIPESIZE, contentsY() + visibleHeight() ) );
+ m_client->setDrawRect( drawRect );
+ break;
+ }
+ m_client->update();
+ m_iBlendTimerId = startTimer( 5 );
+ QApplication::restoreOverrideCursor();
+ }
+
+ m_bNewImage = false;
+ m_bImageChanged = false;
+ m_bSizeChanged = false;
+ m_bMatrixChanged = false;
+}
+
+void KImageCanvas::mouseMoveEvent( QMouseEvent * )
+{
+ if( m_cursor.shape() == Qt::BlankCursor )
+ {
+ m_cursor.setShape( Qt::CrossCursor );
+ viewport()->setCursor( m_cursor );
+ if( m_client )
+ m_client->setCursor( m_cursor );
+ }
+ m_pTimer->start( MOUSECURSORHIDETIME, true );
+}
+
+
+void KImageCanvas::resizeEvent( QResizeEvent * ev )
+{
+ kdDebug( 4620 ) << "KImageCanvas resized to " << ev->size() << endl;
+ QScrollView::resizeEvent( ev );
+ center();
+}
+
+void KImageCanvas::contentsMousePressEvent( QMouseEvent * ev )
+{
+ if ( ev->button() == RightButton )
+ emit contextPress( ev->globalPos() );
+ QScrollView::contentsMousePressEvent( ev );
+}
+
+void KImageCanvas::contentsWheelEvent( QWheelEvent * ev )
+{
+ //kdDebug( 4620 ) << k_funcinfo << endl;
+ // Ctrl+Wheelmouse changes the zoom.
+ // Wheelmouse scrolls around
+ if ( ev->state() & ControlButton )
+ {
+ int delta = ev->delta() / 120;
+ double zoom = m_zoom;
+ // make zoom a value of 1/16, 1/15, 1/14, .. , 1/2, 1, 2, 3, .. , 15, 16
+ bool done = false;
+ for( int i = 15; i > 0; --i )
+ {
+ if( zoom <= ( 1.0 / i ) )
+ {
+ if( zoom < ( 1.0 / ( i + 0.5 ) ) )
+ zoom = ( 1.0 / ( i + 1 ) );
+ else
+ zoom = ( 1.0 / i );
+ done = true;
+ // zoom = 1/16, 1/15, .. , 1/2, 1
+ double x = 1.0 / zoom - delta;
+ if( x == 0 )
+ zoom = 2.0;
+ else
+ zoom = 1.0 / x;
+ break;
+ }
+ }
+ if( ! done )
+ for( int i = 2; i < 17; ++i )
+ {
+ if( zoom < (double)i )
+ {
+ if( zoom < ( i - 0.5 ) )
+ zoom = i - 1.0;
+ else
+ zoom = (double)i;
+ done = true;
+ // zoom = 1, 2, .., 15, 16
+ zoom = zoom + delta;
+ if( zoom < 0.9 )
+ zoom = 0.5;
+ break;
+ }
+ }
+ if( ! done )
+ {
+ zoom = 16.0;
+ zoom = zoom + delta;
+ if( zoom > 16.0 )
+ zoom = 16.0;
+ }
+ kdDebug( 4620 ) << "Mousewheel: oldzoom = " << m_zoom << " newzoom = " << zoom << endl;
+ ev->accept();
+ bool oldscale = fastScale();
+ setFastScale( true );
+ setZoom( zoom );
+ setFastScale( oldscale );
+ }
+ else
+ QScrollView::contentsWheelEvent( ev );
+}
+
+void KImageCanvas::keyPressEvent( QKeyEvent * ev )
+{
+ //kdDebug( 4620 ) << k_funcinfo << endl;
+ switch( ev->key() )
+ {
+ case Key_Down:
+ ev->accept();
+ verticalScrollBar()->addLine();
+ break;
+ case Key_Up:
+ ev->accept();
+ verticalScrollBar()->subtractLine();
+ break;
+ case Key_Left:
+ ev->accept();
+ horizontalScrollBar()->subtractLine();
+ break;
+ case Key_Right:
+ ev->accept();
+ horizontalScrollBar()->addLine();
+ break;
+ case Key_PageUp:
+ ev->accept();
+ verticalScrollBar()->subtractPage();
+ break;
+ case Key_PageDown:
+ ev->accept();
+ verticalScrollBar()->addPage();
+ break;
+ default:
+ ev->ignore();
+ break;
+ }
+}
+
+void KImageCanvas::timerEvent( QTimerEvent * ev )
+{
+ if( ev->timerId() == m_iBlendTimerId )
+ {
+ QRect drawRect = m_client->drawRect();
+ switch( m_iBlendEffect )
+ {
+ case NoBlending:
+ finishNewClient();
+ break;
+ case AlphaBlend:
+ finishNewClient();
+ //if( qt_use_xrender )
+ //{
+ //}
+ //else
+ //{
+ //kdWarning( 4620 ) << "no XRender" << endl;
+ //finishNewClient();
+ //}
+ break;
+ case WipeFromLeft:
+ drawRect.rRight() += KIMAGECANVAS_WIPESIZE;
+ m_client->setDrawRect( drawRect );
+ m_client->update( drawRect.right() - KIMAGECANVAS_WIPESIZE, 0, KIMAGECANVAS_WIPESIZE, m_client->height() );
+ if( drawRect.right() >= contentsX() + visibleWidth() )
+ finishNewClient();
+ break;
+ case WipeFromRight:
+ drawRect.rLeft() -= KIMAGECANVAS_WIPESIZE;
+ m_client->setDrawRect( drawRect );
+ m_client->update( drawRect.left(), 0, KIMAGECANVAS_WIPESIZE, m_client->height() );
+ if( drawRect.left() <= contentsX() )
+ finishNewClient();
+ break;
+ case WipeFromTop:
+ drawRect.rBottom() += KIMAGECANVAS_WIPESIZE;
+ m_client->setDrawRect( drawRect );
+ m_client->update( 0, drawRect.bottom() - KIMAGECANVAS_WIPESIZE, m_client->width(), KIMAGECANVAS_WIPESIZE );
+ if( drawRect.bottom() >= contentsY() + visibleHeight() )
+ finishNewClient();
+ break;
+ case WipeFromBottom:
+ drawRect.rTop() -= KIMAGECANVAS_WIPESIZE;
+ m_client->setDrawRect( drawRect );
+ m_client->update( 0, drawRect.top(), m_client->width(), KIMAGECANVAS_WIPESIZE );
+ if( drawRect.top() <= contentsY() )
+ finishNewClient();
+ break;
+ default:
+ kdFatal( 4620 ) << "unknown Blend Effect" << endl;
+ break;
+ }
+ }
+ else
+ killTimer( ev->timerId() );
+}
+
+void KImageCanvas::hideCursor()
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ m_cursor.setShape( Qt::BlankCursor );
+ viewport()->setCursor( m_cursor );
+ if( m_client )
+ m_client->setCursor( m_cursor );
+}
+
+const KPixmap KImageCanvas::pixmap()
+{
+ kdDebug( 4620 ) << k_funcinfo << ( m_bNeedNewPixmap ? "convert from Image" : "use old copy" ) << endl;
+ // create a new Pixmap in m_pixmap if needed
+ if( m_bNeedNewPixmap )
+ {
+ // only do it again if requested
+ m_bNeedNewPixmap = false;
+ // ok, the old one may go now
+ delete m_pixmap;
+
+ // if smoothscaling is wanted and the transformation matrix or the image
+ // itself changed...
+ if( ! m_fastscale && ( m_bMatrixChanged || m_bImageChanged ) )
+ {
+ delete m_imageTransformed;
+ // we create a new image transformed by the matrix
+ m_imageTransformed = new QImage( m_matrix.isIdentity() ? *m_image : m_image->xForm( m_matrix ) );
+ kdDebug( 4620 ) << "Size of m_image: " << m_image->size() << endl;
+ kdDebug( 4620 ) << "Size of m_imageTransformed: " << m_imageTransformed->size() << endl;
+ }
+ // smoothScale or fast scaling via m_matrix
+ m_pixmap = new KPixmap();
+ m_pixmap->convertFromImage( m_fastscale ? *m_image : m_imageTransformed->smoothScale( m_currentsize ), KPixmap::ColorOnly );
+ }
+ if( m_fastscale )
+ {
+ // fast scaling is needed so we need to scale now
+ QWMatrix matrix( m_matrix );
+ matrix.scale( m_zoom, m_zoom );
+ if( ! matrix.isIdentity() )
+ return m_pixmap->xForm( matrix );
+ }
+ return *m_pixmap;
+}
+
+void KImageCanvas::slotImageChanged()
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ m_bImageChanged = true;
+ m_bNeedNewPixmap = true;
+}
+
+void KImageCanvas::loadSettings()
+{
+ KConfigGroup cfgGroup( KImageCanvasFactory::instance()->config(),
+ "Settings" );
+ setFastScale( ! cfgGroup.readBoolEntry( "Smooth Scaling", ! fastScale() ) );
+ setKeepAspectRatio( cfgGroup.readBoolEntry( "Keep Aspect Ratio",
+ keepAspectRatio() ) );
+ setCentered( cfgGroup.readBoolEntry( "Center Image", centered() ) );
+
+ setBgColor( cfgGroup.readColorEntry( "Background Color", &bgColor() ) );
+
+ setMinimumImageSize( QSize( cfgGroup.readNumEntry( "Minimum Width",
+ minimumImageSize().width() ), cfgGroup.readNumEntry(
+ "Minimum Height", minimumImageSize().height() ) ) );
+ setMaximumImageSize( QSize( cfgGroup.readNumEntry( "Maximum Width",
+ maximumImageSize().width() ), cfgGroup.readNumEntry(
+ "Maximum Height", maximumImageSize().height() ) ) );
+
+ KConfigGroup blendConfig( KImageCanvasFactory::instance()->config(),
+ "Blend Effects" );
+ /* TODO
+ m_vEffects.clear();
+ for( unsigned int i = 1; i <= numOfBlendEffects(); ++i )
+ {
+ if( blendConfig.readBoolEntry( QString::number( i ), false ) )
+ m_vEffects.push_back( i );
+ }
+ // and now tell the canvas what blend effect to use
+ switchBlendEffect();
+ */
+}
+
+void KImageCanvas::selected( const QRect & rect )
+{
+ //kdDebug( 4620 ) << k_funcinfo << rect << endl;
+ m_selection = rect;
+ if( ! m_selection.isNull() )
+ {
+ m_selection.setTop( int( ( m_selection.top() + 0.5 ) / m_zoom ) );
+ m_selection.setLeft( int( ( m_selection.left() + 0.5 ) / m_zoom ) );
+ m_selection.setRight( int( ( m_selection.right() + 0.5 ) / m_zoom ) );
+ m_selection.setBottom( int( ( m_selection.bottom() + 0.5 ) / m_zoom ) );
+ }
+ //kdDebug( 4620 ) << "m_selection = " << m_selection << endl;
+ emit selectionChanged( m_selection );
+}
+
+void KImageCanvas::mapCursorPos( const QPoint & pos )
+{
+ QPoint mapped( static_cast<int>( ( pos.x() + 0.5 ) / m_zoom ), static_cast<int>( ( pos.y() + 0.5 ) / m_zoom ) );
+ //kdDebug( 4620 ) << k_funcinfo << pos << " -> " << mapped << endl;
+ emit cursorPos( mapped );
+}
+
+void KImageCanvas::sizeChanged()
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ m_bSizeChanged = true;
+ if( ! m_fastscale )
+ m_bNeedNewPixmap = true;
+ emit imageSizeChanged( m_currentsize );
+}
+
+void KImageCanvas::matrixChanged()
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ m_bMatrixChanged = true;
+ m_bNeedNewPixmap = true;
+}
+
+void KImageCanvas::center()
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ if( m_bCentered && m_client )
+ {
+ int x = 0;
+ int y = 0;
+
+ int scrollbarwidth = ( height() >= m_currentsize.height() ) ? 0 : verticalScrollBar()->width();
+ int scrollbarheight = ( width() - scrollbarwidth >= m_currentsize.width() ) ? 0 : horizontalScrollBar()->height();
+ scrollbarwidth = ( height() - scrollbarheight >= m_currentsize.height() ) ? 0 : verticalScrollBar()->width();
+
+ int availheight = height() - scrollbarheight;
+ int availwidth = width() - scrollbarwidth;
+
+ if( availwidth > m_currentsize.width() )
+ x = ( availwidth - m_currentsize.width() ) / 2;
+ if( availheight > m_currentsize.height() )
+ y = ( availheight - m_currentsize.height() ) / 2;
+
+ kdDebug( 4620 ) << "center with left top at " << x << ", " << y << endl;
+ moveChild( m_client, x, y );
+ }
+}
+
+void KImageCanvas::finishNewClient()
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ killTimer( m_iBlendTimerId );
+ if( m_client )
+ m_client->setDrawRect( m_client->rect() );
+ delete m_oldClient;
+ m_oldClient = 0;
+ emit showingImageDone();
+}
+
+KImageHolder * KImageCanvas::createNewClient()
+{
+ kdDebug( 4620 ) << k_funcinfo << endl;
+ KImageHolder * client = new KImageHolder( viewport() );
+ client->setMinimumSize( 0, 0 );
+ client->setMouseTracking( true );
+ client->installEventFilter( this );
+ setFocusProxy( client );
+ client->setFocusPolicy( QWidget::StrongFocus );
+ client->setFocus();
+
+ addChild( client, 0, 0 );
+
+ connect( client, SIGNAL( contextPress( const QPoint& ) ), SIGNAL( contextPress( const QPoint& ) ) );
+ connect( client, SIGNAL( cursorPos( const QPoint & ) ), SLOT( mapCursorPos( const QPoint & ) ) );
+ connect( client, SIGNAL( selected( const QRect & ) ), SLOT( selected( const QRect & ) ) );
+ connect( client, SIGNAL( wannaScroll( int, int ) ), SLOT( scrollBy( int, int ) ) );
+
+ return client;
+}
+
+#include "kimagecanvas.moc"
+
+// vim:sw=4:ts=4
diff --git a/kview/kviewcanvas/kimagecanvas.h b/kview/kviewcanvas/kimagecanvas.h
new file mode 100644
index 00000000..8a0bffda
--- /dev/null
+++ b/kview/kviewcanvas/kimagecanvas.h
@@ -0,0 +1,366 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+// $Id$
+
+#ifndef _KIMAGECANVAS_H
+#define _KIMAGECANVAS_H
+
+#include "kimageviewer/canvas.h"
+
+#include <qscrollview.h>
+#include <qwmatrix.h>
+#include <qcursor.h>
+#include <qrect.h>
+
+#include <kdemacros.h>
+
+class KImageHolder;
+class QColor;
+class QImage;
+class KPixmap;
+
+/**
+ * @short KViewCanvas
+ * @author Matthias Kretz <kretz@kde.org>
+ * @version $Id$
+ */
+class KDE_EXPORT KImageCanvas : public QScrollView, public KImageViewer::Canvas
+{
+ Q_OBJECT
+ public:
+ /**
+ * KImageCanvas Constructor
+ */
+ KImageCanvas( QWidget * parent, const char * name, const QStringList & args );
+
+ /**
+ * KImageCanvas Destructor
+ */
+ virtual ~KImageCanvas();
+
+ /**
+ * set the background color of the canvas
+ */
+ void setBgColor( const QColor & );
+
+ /**
+ * returns the current background color
+ */
+ const QColor & bgColor() const;
+
+ /**
+ * the depth of the contained image
+ */
+ int imageDepth() const;
+
+ /**
+ * the size of the unzoomed image
+ */
+ QSize imageSize() const;
+
+ /**
+ * the size of the zoomed (current) image
+ */
+ QSize currentSize() const;
+
+ /**
+ * returns the zoom factor
+ */
+ double zoom() const { return m_zoom; }
+
+ /**
+ * returns the current (unzoomed) image
+ */
+ const QImage * image() const;
+
+ /**
+ * Scrolls the content so that the point (x, y) is in the top-left corner.
+ */
+ void setXYOffset( int x, int y ) { setContentsPos( x, y ); }
+
+ /**
+ * Returns the leftmost visible X coordinate of the image.
+ */
+ int xOffset() const { return contentsX(); }
+
+ /**
+ * Returns the topmost visible Y coordinate of the image.
+ */
+ int yOffset() const { return contentsY(); }
+
+ /**
+ * Returns whether to use fast or smooth scaling
+ */
+ bool fastScale() const { return m_fastscale; }
+
+ /**
+ * Return whether the image should always be centered.
+ */
+ bool centered() const { return m_bCentered; }
+
+ /**
+ * Return the selected rectangle
+ */
+ QRect selection() const;
+
+ /**
+ * Returns whether the aspect ratio of the image is kept
+ */
+ bool keepAspectRatio() const { return m_keepaspectratio; }
+
+ /**
+ * @return the number of available blend effects
+ */
+ unsigned int numOfBlendEffects() const;
+
+ /**
+ * @return the description of the blend effect
+ */
+ QString blendEffectDescription( unsigned int ) const;
+
+ /**
+ * @return the current maximum image size
+ */
+ const QSize & maximumImageSize() const { return m_maxsize; }
+
+ /**
+ * @return the current minimum image size
+ */
+ const QSize & minimumImageSize() const { return m_minsize; }
+
+ /**
+ * @return a pointer to the QWidget interface of this object
+ */
+ QWidget * widget() { return static_cast<QWidget *>( this ); }
+
+ bool eventFilter( QObject *, QEvent * );
+
+ signals:
+ /**
+ * a mouse button was pressed and a context menu should be openend
+ */
+ void contextPress( const QPoint& );
+
+ /**
+ * the size of the image has changed (a new image was loaded, or the
+ * image was zoomed or cropped)
+ *
+ * it passes the new size of the image
+ */
+ void imageSizeChanged( const QSize & );
+
+ /**
+ * The zoom of the image has changed.
+ */
+ void zoomChanged( double zoom );
+
+ /**
+ * The selection has changed. Connect to this signal if you want to
+ * do something with a selection of the image (e.g. crop).
+ */
+ void selectionChanged( const QRect & );
+
+ /**
+ * Emitted when an image is finished being shown. If a blend effect is being used
+ * the signal is emitted when the effect is finished.
+ */
+ void showingImageDone();
+
+ /**
+ * This signal is emitted whenever the canvas changes between image/no-image. For
+ * example, if someone calls @ref clear() hasImage( false ) is emitted if an image
+ * was shown before.
+ */
+ void hasImage( bool );
+
+ /**
+ * Some methods of the canvas not only change the way the image is shown (e.g. zoom)
+ * but also change the image itself (e.g. rotation) - @ref image() returns something
+ * different. If such a change happens this signal is emitted.
+ * It is not emitted when a new image is set with the @ref setImage() methods.
+ */
+ void imageChanged();
+
+ /**
+ * The current mouse cursor position on the image.
+ */
+ void cursorPos( const QPoint & );
+
+ public slots:
+ /**
+ * Set if the image should always be centered if the canvas is
+ * bigger than the image.
+ */
+ void setCentered( bool );
+
+ /**
+ * give the canvas a new image to show. The zoom level is kept.
+ */
+ void setImage( const QImage & );
+
+ /**
+ * Give the canvas a new image to show.
+ *
+ * You have to pass the size the image should have when it appears
+ * on screen.
+ */
+ void setImage( const QImage &, const QSize & );
+
+ /**
+ * set the zoom to be used when showing the image
+ */
+ void setZoom( double );
+
+ /**
+ * Fit the image into the requested width and height.
+ */
+ void boundImageTo( const QSize & size );
+
+ /**
+ * Set the maximum size of the image. If this is set the image will
+ * never exceed this size.
+ *
+ * If you set this to 0x0 the image size may be as big as possible
+ */
+ void setMaximumImageSize( const QSize & );
+
+ /**
+ * Set the minimum size of the image. If this is set the image will
+ * never be smaller than this size.
+ *
+ * If you set this to 0x0 the image size can be as small as possible
+ */
+ void setMinimumImageSize( const QSize & );
+
+ /**
+ * Resize the image to the given size. It will keep the aspect ratio
+ * as long as keepAspectRatio is true (default). The image will be as
+ * large as possible within the given constraints.
+ */
+ void resizeImage( const QSize & );
+
+ /**
+ * Hides the scrollbars of the canvas. It's still possible to scroll
+ * by moving the image with the mouse.
+ */
+ void hideScrollbars( bool );
+
+ /**
+ * Changes the zoom behaviour: Normally the aspect ratio of the image
+ * won't change, but if you want to allow it you may do.
+ */
+ void setKeepAspectRatio( bool );
+
+ /**
+ * If the canvas supports different methods for scaling you may
+ * switch between fast and smooth scaling.
+ *
+ * It defaults to smooth scaling.
+ */
+ void setFastScale( bool );
+
+ /**
+ * clears the canvas (no image loaded)
+ */
+ void clear();
+
+ /**
+ * flip the image horizontally
+ */
+ void flipHorizontal( bool change = false );
+
+ /**
+ * flip the image vertically
+ */
+ void flipVertical( bool change = false );
+
+ /**
+ * rotate the image a degrees counterclockwise
+ */
+ void rotate( double a, bool change = false );
+
+ protected:
+ void checkBounds( QSize & newsize );
+ void zoomFromSize( const QSize & );
+ void sizeFromZoom( double );
+ void updateImage();
+
+ void mouseMoveEvent( QMouseEvent * );
+ void resizeEvent( QResizeEvent * );
+ void contentsMousePressEvent( QMouseEvent * );
+ void contentsWheelEvent( QWheelEvent * );
+ void keyPressEvent( QKeyEvent * );
+ void timerEvent( QTimerEvent * );
+
+ protected slots:
+ void slotUpdateImage();
+ void hideCursor();
+ void slotImageChanged();
+ void loadSettings();
+
+ private slots:
+ void selected( const QRect & ); // map rect to unzoomed rect
+ void mapCursorPos( const QPoint & );
+
+ private:
+ enum BlendEffect {
+ NoBlending = 0,
+ WipeFromLeft = 1,
+ WipeFromRight = 2,
+ WipeFromTop = 3,
+ WipeFromBottom = 4,
+ AlphaBlend = 5
+ };
+ const KPixmap pixmap();
+ void sizeChanged();
+ void matrixChanged();
+ void center();
+ void finishNewClient();
+ KImageHolder * createNewClient();
+
+ KImageHolder * m_client;
+ KImageHolder * m_oldClient;
+ QImage * m_image; //unzoomed copy of the current image
+ QImage * m_imageTransformed; //xForm( m_matrix ) copy of the current image
+ KPixmap * m_pixmap; //copy of the current pixmap (if ( m_fastscale ) it's unzoomed else it's m_imageTransformed.smoothScale()d)
+
+ QTimer * m_pTimer; // timer for single shot to hide the cursor
+ QCursor m_cursor; // the cursor show in the canvas (for auto-hiding)
+
+ QWMatrix m_matrix; // the current transformation matrix
+ QSize m_maxsize, m_minsize;
+ QSize m_currentsize;
+
+ double m_zoom;
+ bool m_fastscale;
+ bool m_keepaspectratio;
+ bool m_bImageChanged;
+ bool m_bSizeChanged;
+ bool m_bMatrixChanged;
+ bool m_bNeedNewPixmap;
+ bool m_bCentered;
+ bool m_bImageUpdateScheduled;
+ bool m_bNewImage;
+ int m_iBlendTimerId;
+
+ QRect m_selection; //unzoomed selection rect
+};
+
+// vim:sw=4:ts=4
+
+#endif // _KIMAGECANVAS_H
diff --git a/kview/kviewcanvas/kimageholder.cpp b/kview/kviewcanvas/kimageholder.cpp
new file mode 100644
index 00000000..9009c7fc
--- /dev/null
+++ b/kview/kviewcanvas/kimageholder.cpp
@@ -0,0 +1,371 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+//$Id$
+
+#include <assert.h>
+
+#include <qcolor.h>
+#include <qwidget.h>
+#include <qimage.h>
+#include <qpainter.h>
+#include <qpen.h>
+#include <qmovie.h>
+#include <qpixmap.h>
+
+#include <kpixmap.h>
+#include <kdebug.h>
+
+#include "kimageholder.h"
+
+KImageHolder::KImageHolder( QWidget * parent, const char * name )
+ : QWidget( parent, name, Qt::WResizeNoErase | Qt::WRepaintNoErase )
+ , m_selected( false )
+ , m_bSelecting( false )
+ , m_scrollTimerId( 0 )
+ , m_xOffset( 0 )
+ , m_yOffset( 0 )
+ , m_pen( new QPen( QColor( 255, 255, 255 ), 0, DashLine ) )
+ , m_pPixmap( 0 )
+ , m_pDoubleBuffer( 0 )
+ , m_pCheckboardPixmap( 0 )
+{
+ setBackgroundMode( QWidget::NoBackground );
+}
+
+KImageHolder::~KImageHolder()
+{
+ delete m_pen;
+ delete m_pPixmap;
+ delete m_pDoubleBuffer;
+ delete m_pCheckboardPixmap;
+ m_pen = 0;
+ m_pPixmap = 0;
+ m_pDoubleBuffer = 0;
+ m_pCheckboardPixmap = 0;
+}
+
+void KImageHolder::mousePressEvent( QMouseEvent *ev )
+{
+ //kdDebug( 4620 ) << k_funcinfo << " ev->state() = " << ev->state() << endl;
+ // if the right mouse button is pressed emit the contextPress signal
+ if ( ev->button() == RightButton )
+ {
+ emit contextPress( mapToGlobal( ev->pos() ) );
+ return;
+ }
+
+ if( m_pPixmap == 0 )
+ return;
+
+ if( ev->button() == LeftButton || ev->button() == MidButton )
+ {
+ m_scrollpos = ev->globalPos();
+ m_selectionStartPoint = ev->pos();
+ }
+}
+
+void KImageHolder::mouseMoveEvent( QMouseEvent *ev )
+{
+ //FIXME: when scrolling the cursorpos shouldn't change
+ if( this->rect().contains( ev->pos(), false ) )
+ emit cursorPos( ev->pos() );
+ //kdDebug( 4620 ) << k_funcinfo << " ev->state() = " << ev->state() << endl;
+ if( ev->state() & LeftButton || ev->state() & MidButton )
+ {
+ // scroll when a modifier and left button or the middle button is pressed
+ if( ev->state() & AltButton || ev->state() & ControlButton || ev->state() & ShiftButton || ev->state() & MidButton )
+ {
+ QPoint difference = m_scrollpos - ev->globalPos();
+ emit wannaScroll( difference.x(), difference.y() );
+ }
+ else // create a selection
+ {
+ QWidget * parentwidget = ( QWidget* )parent();
+ if( ! m_bSelecting )
+ {
+ m_bSelecting = true;
+ if( m_selected ) {
+ // remove old rubberband
+ eraseSelect();
+ m_selected = false;
+ }
+
+ m_selection.setLeft( m_selectionStartPoint.x() );
+ m_selection.setRight( m_selectionStartPoint.x() );
+ m_selection.setTop( m_selectionStartPoint.y() );
+ m_selection.setBottom( m_selectionStartPoint.y() );
+ }
+ // currently called only on drag,
+ // so assume a selection has been started
+ bool erase = m_selected;
+
+ if( !m_selected )
+ m_selected = true;
+
+ // Autoscrolling:
+ // For every pixel the mouse leaves the image canvas the canvas
+ // should scroll faster. The scrolling should be independent from
+ // the mouse movement. Therefor I need a timer to do the scroll
+ // movement:
+ // e.g.: m_xOffset=-1 => scroll to the left 1 px per 50ms
+ // -2 => scroll to the left 2 px per 50ms
+ // 2 => scroll to the right 2 px per 50ms
+ // ...
+ m_xOffset = mapTo( parentwidget, ev->pos() ).x();
+ m_yOffset = mapTo( parentwidget, ev->pos() ).y();
+ if( m_xOffset > 0 )
+ {
+ m_xOffset -= parentwidget->width();
+ if( m_xOffset < 0 )
+ m_xOffset = 0;
+ }
+ if( m_yOffset > 0 )
+ {
+ m_yOffset -= parentwidget->height();
+ if( m_yOffset < 0 )
+ m_yOffset = 0;
+ }
+ if( m_scrollTimerId != 0 && m_xOffset == 0 && m_yOffset == 0 )
+ {
+ killTimer( m_scrollTimerId );
+ m_scrollTimerId = 0;
+ }
+ else if( m_scrollTimerId == 0 && ( m_xOffset != 0 || m_yOffset != 0 ) )
+ m_scrollTimerId = startTimer( 50 );
+
+ int r = ev->x() < width() ? ( ev->x() < 0 ? 0 : ev->x() ) : width() - 1;
+ int b = ev->y() < height() ? ( ev->y() < 0 ? 0 : ev->y() ) : height() - 1;
+
+ if( r != m_selection.right() || b != m_selection.bottom() )
+ {
+ if( erase )
+ eraseSelect();
+
+ m_selection.setRight( r );
+ m_selection.setBottom( b );
+ emit selected( m_selection.normalize() );
+
+ QPainter painter( this );
+ drawSelect( painter );
+ }
+ }
+ m_scrollpos = ev->globalPos();
+ m_selectionStartPoint = ev->pos();
+ }
+}
+
+void KImageHolder::mouseReleaseEvent( QMouseEvent * ev )
+{
+ if( m_bSelecting )
+ {
+ m_xOffset = m_yOffset = 0;
+ if( m_scrollTimerId != 0 )
+ {
+ killTimer( m_scrollTimerId );
+ m_scrollTimerId = 0;
+ }
+ }
+ if( ev->state() & LeftButton || ev->state() & MidButton )
+ if( m_bSelecting )
+ m_bSelecting = false;
+ else
+ clearSelection();
+}
+
+void KImageHolder::drawSelect( QPainter & painter )
+{
+ painter.save();
+ painter.setRasterOp( XorROP );
+ painter.setPen( *m_pen );
+ painter.drawRect( m_selection.normalize() );
+ painter.restore();
+}
+
+void KImageHolder::eraseSelect()
+{
+ QRegion r( m_selection.normalize() );
+ QRect inner = m_selection.normalize();
+ inner.rLeft() += 1;
+ inner.rTop() += 1;
+ inner.rRight() -= 1;
+ inner.rBottom() -= 1;
+ r -= inner;
+
+ QMemArray<QRect> rects = r.rects();
+
+ if( m_pDoubleBuffer )
+ for( unsigned int i = 0; i < rects.size(); ++i )
+ bitBlt( this, rects[ i ].topLeft(), m_pDoubleBuffer, rects[ i ], CopyROP );
+ else
+ for( unsigned int i = 0; i < rects.size(); ++i )
+ bitBlt( this, rects[ i ].topLeft(), m_pPixmap, rects[ i ], CopyROP );
+}
+
+void KImageHolder::clearSelection()
+{
+ if( m_selected )
+ {
+ eraseSelect();
+ m_selected = false;
+ }
+ m_selection.setSize( QSize( 0, 0 ) );
+ emit selected( m_selection );
+}
+
+void KImageHolder::setImage( const KPixmap & pix )
+{
+ clearSelection();
+
+ setPixmap( pix );
+}
+
+void KImageHolder::setImage( const QImage & image )
+{
+ clearSelection();
+ kdDebug( 4620 ) << "converting Image to Pixmap" << endl;
+ KPixmap pix( image );
+
+ setPixmap( pix );
+}
+
+void KImageHolder::setImage( const QMovie & /*movie*/ )
+{
+ clearSelection();
+ //setMovie( movie );
+ kdWarning( 4620 ) << "setImage( QMovie ) not implemented" << endl;
+}
+
+void KImageHolder::clear()
+{
+ delete m_pPixmap;
+ m_pPixmap = 0;
+ delete m_pDoubleBuffer;
+ m_pDoubleBuffer = 0;
+ hide();
+ clearSelection();
+}
+
+QRect KImageHolder::selection() const
+{
+ if( m_selected )
+ return m_selection.normalize();
+ else
+ return QRect();
+}
+
+QSize KImageHolder::sizeHint() const
+{
+ if( m_pPixmap )
+ return m_pPixmap->size();
+ return QSize( 0, 0 );
+}
+
+void KImageHolder::paintEvent( QPaintEvent *ev )
+{
+ QPainter painter( this );
+ painter.setClipRegion( ev->region().intersect( m_drawRect ) );
+ if( m_pPixmap )
+ {
+ if( m_pPixmap->mask() )
+ {
+ if( ! m_pDoubleBuffer )
+ {
+ m_pDoubleBuffer = new KPixmap( m_pPixmap->size() );
+ QPainter p( m_pDoubleBuffer );
+ p.drawTiledPixmap( m_pDoubleBuffer->rect(), checkboardPixmap() );
+ p.end();
+ bitBlt( m_pDoubleBuffer, QPoint( 0, 0 ), m_pPixmap, m_pPixmap->rect() );
+ }
+ painter.drawPixmap( 0, 0, *m_pDoubleBuffer );
+ }
+ else
+ painter.drawPixmap( 0, 0, *m_pPixmap );
+ }
+ if( m_selected )
+ drawSelect( painter );
+}
+
+void KImageHolder::timerEvent( QTimerEvent * ev )
+{
+ if( ev->timerId() != m_scrollTimerId )
+ return;
+
+ emit wannaScroll( m_xOffset, m_yOffset );
+}
+
+void KImageHolder::setPixmap( const KPixmap & pixmap )
+{
+ kdDebug( 4620 ) << k_funcinfo << " " << pixmap.width() << 'x' << pixmap.height() << endl;
+ delete m_pPixmap;
+ delete m_pDoubleBuffer;
+ m_pDoubleBuffer = 0;
+ m_pPixmap = new KPixmap( pixmap );
+ m_drawRect = m_pPixmap->rect();
+ show();
+}
+
+const KPixmap & KImageHolder::checkboardPixmap()
+{
+ if( ! m_pCheckboardPixmap )
+ {
+ const char * xpm[] = {
+ "32 32 2 1",
+ " c #666666",
+ "X c #999999",
+ " XXXXXXXXXXXXXXXX",
+ " XXXXXXXXXXXXXXXX",
+ " XXXXXXXXXXXXXXXX",
+ " XXXXXXXXXXXXXXXX",
+ " XXXXXXXXXXXXXXXX",
+ " XXXXXXXXXXXXXXXX",
+ " XXXXXXXXXXXXXXXX",
+ " XXXXXXXXXXXXXXXX",
+ " XXXXXXXXXXXXXXXX",
+ " XXXXXXXXXXXXXXXX",
+ " XXXXXXXXXXXXXXXX",
+ " XXXXXXXXXXXXXXXX",
+ " XXXXXXXXXXXXXXXX",
+ " XXXXXXXXXXXXXXXX",
+ " XXXXXXXXXXXXXXXX",
+ " XXXXXXXXXXXXXXXX",
+ "XXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXX ",
+ "XXXXXXXXXXXXXXXX ",
+ };
+ m_pCheckboardPixmap = new KPixmap( xpm );
+ }
+ return *m_pCheckboardPixmap;
+}
+
+#include "kimageholder.moc"
+
+// vim:sw=4:ts=4
diff --git a/kview/kviewcanvas/kimageholder.h b/kview/kviewcanvas/kimageholder.h
new file mode 100644
index 00000000..780ce372
--- /dev/null
+++ b/kview/kviewcanvas/kimageholder.h
@@ -0,0 +1,105 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+// $Id$
+
+#ifndef _KIMAGEHOLDER_H
+#define _KIMAGEHOLDER_H
+
+#include <qwidget.h>
+class QRect;
+class QPainter;
+class QPen;
+class QPixmap;
+class KPixmap;
+class QPoint;
+
+/**
+ * @short Image widget
+ * @version $Id$
+ */
+class KImageHolder : public QWidget
+{
+ Q_OBJECT
+ public:
+ KImageHolder( QWidget *parent = 0, const char * name = 0 );
+
+ virtual ~KImageHolder();
+
+ void clearSelection();
+
+ void setImage( const KPixmap & );
+ void setImage( const QImage & );
+ void setImage( const QMovie & );
+
+ /**
+ * clears the ImageHolder
+ */
+ void clear();
+
+ /**
+ * the selected rect
+ */
+ QRect selection() const;
+
+ QSize sizeHint() const;
+
+ void setDrawRect( const QRect & rect ) { m_drawRect = rect; }
+ const QRect & drawRect() const { return m_drawRect; }
+
+ signals:
+ void contextPress( const QPoint& );
+ void selected( const QRect & );
+ void wannaScroll( int dx, int dy );
+ void cursorPos( const QPoint & );
+
+ protected:
+ void mousePressEvent( QMouseEvent * );
+ void mouseMoveEvent( QMouseEvent * );
+ void mouseReleaseEvent( QMouseEvent * );
+ void paintEvent( QPaintEvent * );
+ virtual void timerEvent( QTimerEvent * );
+
+ private:
+ void drawSelect( QPainter & );
+ void eraseSelect();
+
+ void setPixmap( const KPixmap & );
+
+ private:
+ QRect m_selection;
+ QRect m_drawRect;
+ QPoint m_scrollpos;
+ QPoint m_selectionStartPoint;
+
+ const KPixmap & checkboardPixmap();
+
+ bool m_selected;
+ bool m_bSelecting;
+ int m_scrollTimerId;
+ int m_xOffset, m_yOffset;
+
+ QPen *m_pen;
+
+ KPixmap * m_pPixmap;
+ KPixmap * m_pDoubleBuffer;
+ KPixmap * m_pCheckboardPixmap;
+};
+
+// vim:sw=4:ts=4
+
+#endif // _KIMAGEHOLDER_H
diff --git a/kview/kviewcanvas/kviewcanvas.desktop b/kview/kviewcanvas/kviewcanvas.desktop
new file mode 100644
index 00000000..ecc7ddfd
--- /dev/null
+++ b/kview/kviewcanvas/kviewcanvas.desktop
@@ -0,0 +1,63 @@
+[Desktop Entry]
+Type=Service
+Name=KView Image Viewer Widget
+Name[af]=K-bekyk Beeld Aansig Gui-element
+Name[ar]=كائن عارض الصور KView
+Name[br]=Widget gweler skeudennoù KView
+Name[bs]=KView predglednik slika - grafički element
+Name[ca]=Estri visualitzador d'imatges KView
+Name[cs]=Komponenta prohlížeče obrázků KView
+Name[cy]=Celfigyn Gwelydd Delweddau KGweld
+Name[da]=KView-billedviserkontrol
+Name[de]=KView Bildanzeige-Bildschirmausschnitt
+Name[el]=Γραφικό συστατικό προβολέα εικόνων του KView
+Name[eo]=Bildrigardilo fenestro
+Name[es]=Widget visor de imágenes de KView
+Name[et]=KView pildifailide näitaja element
+Name[eu]=KView irudi ikustailu botoia
+Name[fa]=عنصر مشاهده‌گر تصویر KView
+Name[fi]=KView-kuviennäyttökomponentti
+Name[fr]=Widget visualisateur d'images KView
+Name[gl]=Complemento do visor de Imaxes KView
+Name[he]=פריט מציג תמונות ל־KView
+Name[hi]=के-व्यू छवि प्रदर्शक विजेट
+Name[hr]=KView widget za pregled slika
+Name[hu]=KView képnézegető grafikus elem
+Name[is]=KView myndbirtigræja
+Name[it]=Widget visore immagini KView
+Name[ja]=KView 画像ビューアウィジェット
+Name[kk]=KView кескінді көрсететін бөлшегі
+Name[km]=ធាតុ​ក្រាហ្វិក​កម្មវិធី​មើល​រូបភាព KView
+Name[lt]=KView paveikslėlių žiūriklio valdiklis
+Name[ms]=Widget Pemapar Imej KView
+Name[nb]=KView bilde-fremviserelement
+Name[nds]=KView-Bildkiekrahmen
+Name[ne]=केडीई दृश्य छवि दर्शक विजेट
+Name[nl]=KView afbeeldingwidget
+Name[nn]=KView biletvisarelement
+Name[nso]=KView Widget ya Molebeledi wa Ponagalo
+Name[pl]=Okienko przeglądarki obrazków KView
+Name[pt]=Elemento de Visualização de Imagens do KView
+Name[pt_BR]=Componente de Visualização de Imagens do KVisualização
+Name[ro]=Widget vizualizare imagini KView
+Name[ru]=Виджет с просмотром изображения KView
+Name[se]=KView govvačájehanáhta
+Name[sk]=Prvok prehliadača obrázkov KView
+Name[sl]=Gradnik pregledovalnika slik KView
+Name[sr]=KView, контрола за приказ слика
+Name[sr@Latn]=KView, kontrola za prikaz slika
+Name[sv]=Kview bildvisande komponent
+Name[ta]=கேகாட்சி பிம்பக் காட்சி சாளரம்
+Name[tg]=Виджет бо намоиши тасвироти KView
+Name[tr]=KView Resim Görüntüleme Parçacığı
+Name[uk]=Віджет переглядача зображень KView
+Name[ven]=Tshishumiswa tsha vhuthogwa tsha muvhoni wa tshifanyiso tsha mbonalelo ya K
+Name[wa]=Ahesse håyneu d' imådjes KView
+Name[xh]=Widget Yombonisi Womfanekiso we KView
+Name[zh_CN]=KView 图像查看器部件
+Name[zh_HK]=KView 圖像檢視器器件
+Name[zh_TW]=KView 影像檢視器界面工具
+Name[zu]=I-widget Yombukisi Wesithombe se-KView
+X-KDE-Library=libkviewcanvas
+InitialPreference=2
+ServiceTypes=KImageViewer/Canvas
diff --git a/kview/kviewcanvas/test/Makefile.am b/kview/kviewcanvas/test/Makefile.am
new file mode 100644
index 00000000..1fc3e92c
--- /dev/null
+++ b/kview/kviewcanvas/test/Makefile.am
@@ -0,0 +1,9 @@
+INCLUDES = -I$(top_srcdir)/kview $(all_includes)
+
+METASOURCES = AUTO
+
+check_PROGRAMS = test
+
+test_SOURCES = main.cpp test.cpp
+test_LDFLAGS = $(KDE_RPATH) $(all_libraries)
+test_LDADD = $(LIB_KPARTS) $(top_builddir)/kview/kimageviewer/libkimageviewer.la
diff --git a/kview/kviewcanvas/test/main.cpp b/kview/kviewcanvas/test/main.cpp
new file mode 100644
index 00000000..360fdefd
--- /dev/null
+++ b/kview/kviewcanvas/test/main.cpp
@@ -0,0 +1,51 @@
+#include "test.h"
+#include <kapplication.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+
+static const char description[] =
+ I18N_NOOP("A KDE KPart Application");
+
+static const char version[] = "v0.1";
+
+static KCmdLineOptions options[] =
+{
+ { "+[URL]", I18N_NOOP( "Image to open" ), 0 },
+ KCmdLineLastOption
+};
+
+int main(int argc, char **argv)
+{
+ KAboutData about("kimageviewertest", I18N_NOOP("KImageViewerTest"), version, description, KAboutData::License_GPL, "(C) 2001 Matthias Kretz", 0, 0, "kretz@kde.org");
+ about.addAuthor( "Matthias Kretz", 0, "kretz@kde.org" );
+ KCmdLineArgs::init(argc, argv, &about);
+ KCmdLineArgs::addCmdLineOptions( options );
+ KApplication app;
+
+ if (app.isRestored())
+ RESTORE(KImageViewerTest)
+ else
+ {
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+ if ( args->count() == 0 )
+ {
+ KImageViewerTest *widget = new KImageViewerTest;
+ widget->show();
+ }
+ else
+ {
+ int i = 0;
+ for (; i < args->count(); i++ )
+ {
+ KImageViewerTest *widget = new KImageViewerTest;
+ widget->show();
+ widget->load( args->url( i ) );
+ }
+ }
+ args->clear();
+ }
+
+ return app.exec();
+}
diff --git a/kview/kviewcanvas/test/test.cpp b/kview/kviewcanvas/test/test.cpp
new file mode 100644
index 00000000..8422f944
--- /dev/null
+++ b/kview/kviewcanvas/test/test.cpp
@@ -0,0 +1,46 @@
+/*
+ * kimageviewertest.cpp
+ *
+ * Copyright (c) 2001 Matthias Kretz <kretz@kde.org>
+ */
+#include "test.h"
+#include <kimageviewer/canvas.h>
+
+#include <kurl.h>
+#include <klibloader.h>
+#include <kmessagebox.h>
+#include <kparts/componentfactory.h>
+
+#include <qimage.h>
+
+KImageViewerTest::KImageViewerTest()
+ : KParts::MainWindow( 0L, "KImageViewerTest" )
+{
+ QWidget * widget = KParts::ComponentFactory::createInstanceFromQuery<QWidget>(
+ "KImageViewer/Canvas", QString::null, this );
+ if( widget )
+ {
+ m_part = dynamic_cast<KImageViewer::Canvas *>( widget );
+ setCentralWidget( widget );
+ }
+ else
+ {
+ KMessageBox::error(this, "Could not find our Part!");
+ kapp->quit();
+ }
+}
+
+KImageViewerTest::~KImageViewerTest()
+{
+}
+
+void KImageViewerTest::load(const KURL& url)
+{
+ QImage image( url.fileName() );
+ if( m_part )
+ m_part->setImage( image );
+ else
+ KMessageBox::error(this, "can't load the file");
+}
+
+#include "test.moc"
diff --git a/kview/kviewcanvas/test/test.h b/kview/kviewcanvas/test/test.h
new file mode 100644
index 00000000..b6a85188
--- /dev/null
+++ b/kview/kviewcanvas/test/test.h
@@ -0,0 +1,25 @@
+#ifndef KIMAGEVIEWERTEST_H
+#define KIMAGEVIEWERTEST_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <kapplication.h>
+#include <kparts/mainwindow.h>
+
+namespace KImageViewer { class Canvas; };
+
+class KImageViewerTest : public KParts::MainWindow
+{
+ Q_OBJECT
+public:
+ KImageViewerTest();
+ virtual ~KImageViewerTest();
+ void load(const KURL& url);
+
+private:
+ KImageViewer::Canvas *m_part;
+};
+
+#endif // KIMAGEVIEWERTEST_H
diff --git a/kview/kviewui.rc b/kview/kviewui.rc
new file mode 100644
index 00000000..a444bcc4
--- /dev/null
+++ b/kview/kviewui.rc
@@ -0,0 +1,50 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KView" version="12">
+ <MenuBar>
+ <Menu name="file"><text>&amp;File</text>
+ <DefineGroup name="open_merge_group" append="open_merge"/>
+ <DefineGroup name="save_merge_group" append="save_merge"/>
+ <Action name="print" append="print_merge"/>
+ <!--<Merge /> This creates an extra separator in the file menu-->
+ </Menu>
+ <Menu name="edit"><text>&amp;Edit</text>
+ <Action name="crop" />
+ <Action name="reload" />
+ <Separator />
+ <Action name="del" />
+ <Merge />
+ </Menu>
+ <Merge />
+ <Menu name="settings"><text>&amp;Settings</text>
+ <DefineGroup name="show_merge_group" append="show_merge" />
+ <Separator append="show_merge"/>
+ </Menu>
+ <Menu name="help"><text>&amp;Help</text>
+ <DefineGroup name="about_merge_group" append="about_merge"/>
+ </Menu>
+ </MenuBar>
+ <ToolBar name="mainToolBar" noMerge="1"><text>Main Toolbar</text>
+ <Action name="file_open"/>
+ <Action name="file_save"/>
+ <Action name="print"/>
+ <Action name="file_print_preview"/>
+ <Separator/>
+ <Action name="edit_undo"/>
+ <Action name="edit_redo"/>
+ <Action name="edit_cut"/>
+ <Action name="edit_copy"/>
+ <Action name="edit_paste"/>
+ <Separator/>
+ <Action name="reload"/>
+ </ToolBar>
+ <Menu name="popupmenu">
+ <Action name="file_open"/>
+ <DefineGroup name="file_group"/>
+ <Separator/>
+ <Action name="options_show_menubar"/>
+ <Action name="fullscreen"/>
+ <Separator/>
+ <Action name="del"/>
+ <Merge/>
+ </Menu>
+</kpartgui>
diff --git a/kview/kviewviewer/ChangeLog b/kview/kviewviewer/ChangeLog
new file mode 100644
index 00000000..e76a70cd
--- /dev/null
+++ b/kview/kviewviewer/ChangeLog
@@ -0,0 +1,68 @@
+2003-10-06 Matthias Kretz <kretz@kde.org>
+
+ * config/kviewviewerpluginsconfig.cpp:
+ Don't show an empty config page in the pluginselector (there are no
+ KView plugins with config options, yet).
+
+2003-08-22 Matthias Kretz <kretz@kde.org>
+
+ * confmodules.*
+ moved to kviewcanvas/config
+ * generalconfigwidget.ui
+ moved to kviewcanvas/config
+
+2003-08-19 Matthias Kretz <kretz@kde.org>
+
+ * kviewvieweriface.h:
+ Everything is gone, let's see if this interface will stay
+ around...
+ * Makefile.am:
+ Added own messages target
+ * kviewviewer.{h,cpp}:
+ Remove image cache again. It's making more problems than it's
+ worth. The speedup is minimal. A real speedup would probably be
+ to preload images and/or cache the QPixmaps.
+ Problems I had: At some point no new image would be shown
+ anymore. Also the memory usage was too high and the kernel
+ does disk caching anyway, so the QImage caching is just a
+ minor optimization.
+
+2003-04-03 Matthias Kretz <kretz@kde.org>
+
+ * kviewviewer.cpp:
+ s/QUriDrag/KURLDrag/
+
+2003-03-11 Matthias Kretz <kretz@kde.org>
+
+ * kviewviewer.cpp:
+ uhm, fix a biiiig memory leak: the cache wasn't deleted on
+ part destruction
+
+2003-03-06 Matthias Kretz <kretz@kde.org>
+
+ * kviewviewer.desktop:
+ Changed MimeType field to support pbm, pnm, ppm and pgm. And
+ added the image/jp2 type.
+ Name change: Image Viewer Part -> KView Image Viewer. Somehow
+ the part needs to be identified with KView.
+
+2003-03-04 Matthias Kretz <kretz@kde.org>
+
+ * kviewvieweriface.h:
+ New interface header. This is probably going to be KView
+ specific stuff or become a DCOP interface (or both) have to
+ look into that some more...
+ It has only one method so far: setCacheSize( uint ) for
+ setting the maximum size of the QImage cache of the viewer.
+ * kviewviewer.cpp:
+ Cache QImages in a QCache.
+ This introduces a few problems: If a newer version is
+ available on file the cache will be used because the
+ modification time isn't checked.
+ Also the watching of files doesn't work anymore if the image
+ is loaded from the cache.
+ * kviewviewer.{cpp,h,rc}, kviewviewer_ro.rc:
+ added "rotate clockwise" and changed icon of CCW (patch by
+ Adriaan de Groot)
+
+# vim: sw=4 ts=4 tw=80 noet
diff --git a/kview/kviewviewer/Makefile.am b/kview/kviewviewer/Makefile.am
new file mode 100644
index 00000000..0aa490ec
--- /dev/null
+++ b/kview/kviewviewer/Makefile.am
@@ -0,0 +1,21 @@
+SUBDIRS = test config
+
+kde_module_LTLIBRARIES = libkviewviewer.la
+INCLUDES = -I$(top_srcdir)/kview $(all_includes)
+
+noinst_HEADERS = kviewkonqextension.h kviewviewer.h
+
+libkviewviewer_la_SOURCES = printimagesettings.ui imagesettings.cpp kviewkonqextension.cpp kviewviewer.cpp
+libkviewviewer_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined
+libkviewviewer_la_LIBADD = $(LIB_KDEPRINT) $(LIB_KUTILS) \
+ $(top_builddir)/kview/kimageviewer/libkimageviewer.la
+
+METASOURCES = AUTO
+
+kde_services_DATA = kviewviewer.desktop
+
+partdir = $(kde_datadir)/kviewviewer
+part_DATA = kviewviewer.rc kviewviewer_ro.rc kviewpopup.rc
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/kviewviewer.pot
diff --git a/kview/kviewviewer/config/Makefile.am b/kview/kviewviewer/config/Makefile.am
new file mode 100644
index 00000000..fe65e613
--- /dev/null
+++ b/kview/kviewviewer/config/Makefile.am
@@ -0,0 +1,17 @@
+INCLUDES = $(all_includes)
+
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = kcm_kviewviewerpluginsconfig.la
+
+noinst_HEADERS = kviewviewerpluginsconfig.h
+
+kcm_kviewviewerpluginsconfig_la_SOURCES = kviewviewerpluginsconfig.cpp
+kcm_kviewviewerpluginsconfig_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+kcm_kviewviewerpluginsconfig_la_LIBADD = $(LIB_KUTILS)
+
+kcm_kviewviewerpluginsconfig_DATA = kviewviewerpluginsconfig.desktop
+kcm_kviewviewerpluginsconfigdir = $(kde_servicesdir)/kconfiguredialog
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/kcm_kviewviewerpluginsconfig.pot
diff --git a/kview/kviewviewer/config/kviewviewerpluginsconfig.cpp b/kview/kviewviewer/config/kviewviewerpluginsconfig.cpp
new file mode 100644
index 00000000..04b9e982
--- /dev/null
+++ b/kview/kviewviewer/config/kviewviewerpluginsconfig.cpp
@@ -0,0 +1,48 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#include "kviewviewerpluginsconfig.h"
+
+#include <kpluginselector.h>
+#include <kgenericfactory.h>
+#include <klocale.h>
+#include <kglobal.h>
+#include <ksimpleconfig.h>
+#include <kplugininfo.h>
+
+#include <qstring.h>
+
+typedef KGenericFactory<KViewViewerPluginsConfig, QWidget> KViewViewerPluginsConfigFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_kviewviewerpluginsconfig, KViewViewerPluginsConfigFactory( "kcm_kviewviewerpluginsconfig" ) )
+
+KViewViewerPluginsConfig::KViewViewerPluginsConfig( QWidget * parent, const char *, const QStringList & args )
+ : KSettings::PluginPage( KViewViewerPluginsConfigFactory::instance(), parent, args )
+{
+ m_config = new KSimpleConfig( "kviewviewerrc" );
+ pluginSelector()->addPlugins( QString::fromAscii( "kviewviewer" ), i18n( "Viewer" ), QString::null, m_config );
+ pluginSelector()->setShowEmptyConfigPage( false );
+}
+
+KViewViewerPluginsConfig::~KViewViewerPluginsConfig()
+{
+ delete m_config;
+}
+
+// vim: sw=4 ts=4 noet
+
+#include "kviewviewerpluginsconfig.moc"
diff --git a/kview/kviewviewer/config/kviewviewerpluginsconfig.desktop b/kview/kviewviewer/config/kviewviewerpluginsconfig.desktop
new file mode 100644
index 00000000..d2faedfd
--- /dev/null
+++ b/kview/kviewviewer/config/kviewviewerpluginsconfig.desktop
@@ -0,0 +1,118 @@
+[Desktop Entry]
+Icon=plugin
+Type=Service
+ServiceTypes=KCModule
+
+X-KDE-ModuleType=Library
+X-KDE-Library=kviewviewerpluginsconfig
+X-KDE-FactoryName=KViewViewerPluginsConfigFactory
+X-KDE-ParentApp=kview
+X-KDE-ParentComponents=kviewviewer
+X-KDE-Weight=2
+X-KDE-CfgDlgHierarchy=Viewer
+
+Name=Plugins
+Name[ar]=البرامج المساعدة
+Name[bg]=Приставки
+Name[br]=Lugantoù
+Name[bs]=Dodaci
+Name[ca]=Connectors
+Name[cs]=Moduly
+Name[cy]=Ategion
+Name[da]=Plugin
+Name[de]=Module
+Name[el]=Πρόσθετα
+Name[eo]=Kromaĵoj
+Name[es]=Extensiones
+Name[et]=Pluginad
+Name[eu]=Pluginak
+Name[fa]=وصله‌ها
+Name[fi]=Liitännäiset
+Name[fr]=Modules externes
+Name[ga]=Breiseáin
+Name[he]=תוספים
+Name[hi]=प्लगइन्स
+Name[hr]=Umetci
+Name[hu]=Bővítőmodulok
+Name[is]=Íforrit
+Name[it]=Plugin
+Name[ja]=プラグイン
+Name[kk]=Плагин модулі
+Name[km]=កម្មវិធី​ជំនួយ
+Name[lt]=Priedai
+Name[ms]=Plugin
+Name[nb]=Programtillegg
+Name[nds]=Modulen
+Name[ne]=प्लगइन
+Name[nn]=Programtillegg
+Name[pa]=ਪਲੱਗਿੰਨ
+Name[pl]=Wtyczki
+Name[pt]='Plugins'
+Name[ro]=Module
+Name[ru]=Модули
+Name[rw]=Amacomeka
+Name[se]=Lassemoduvllat
+Name[sk]=Moduly
+Name[sl]=Vstavki
+Name[sr]=Прикључци
+Name[sr@Latn]=Priključci
+Name[sv]=Insticksprogram
+Name[ta]=சொருகுப்பொருள்
+Name[tg]=Модулҳо
+Name[tr]=Eklentiler
+Name[uk]=Втулки
+Name[uz]=Plaginlar
+Name[uz@cyrillic]=Плагинлар
+Name[wa]=Tchôke-divins
+Name[zh_CN]=插件
+Name[zh_HK]=插件
+Name[zh_TW]=外掛程式
+Comment=Choose and Configure Your Plugins
+Comment[bg]=Избор и настройване на приставки
+Comment[br]=Dibabit ha kefluniut ho lugentoù
+Comment[bs]=Izaberite i podesite vaše dodatke
+Comment[ca]=Escolliu i configureu els connectors
+Comment[cs]=Zvolte a nastavte si moduly
+Comment[da]=Vælg og indstil dine plugin
+Comment[de]=Auswahl und Einrichtung der Module
+Comment[el]=Επιλέξτε και ρυθμίστε τα πρόσθετα σας
+Comment[eo]=Elektu kaj agordu viajn kromprogramojn
+Comment[es]=Seleccione y configure sus extensiones
+Comment[et]=Pluginate valimine ja seadistamine
+Comment[eu]=Aukeratu eta konfigurau zure pluginak
+Comment[fa]=وصله‌های خود را انتخاب و پیکربندی کنید
+Comment[fi]=Valitse ja muokkaa liitännäisten asetuksia
+Comment[fr]=Choisissez et configurez vos modules externes
+Comment[gl]=Elexir e Configurar as súas Extensións
+Comment[he]=בחר והגדר את התוספים שלך
+Comment[hu]=Bővítőmodulok kiválasztása, beállítása
+Comment[is]=Velja og stilla íforrit
+Comment[it]=Scegli e configura i tuoi plugin
+Comment[ja]=プラグインを選択して設定します
+Comment[kk]=Плагин модулін таңдап алып баптау
+Comment[km]=ជ្រើស និង​កំណត់​រចនាសម្ព័ន្ធ​កម្មវិធី​ជំនួយ​របស់​អ្នក
+Comment[lt]=Pasirinkite ir konfigūruokite priedus
+Comment[ms]=Pilih dan Konfigur Plugin Anda
+Comment[nb]=Velg og sett opp programtilleggene
+Comment[nds]=Dien Modulen utsöken un instellen
+Comment[ne]=तपाईँको प्लगइन रोज्नुहोस् र कन्फिगर गर्नुहोस्
+Comment[nl]=Kies uw plugins en stel ze in
+Comment[nn]=Vel og set opp programtillegga
+Comment[pl]=Wybór i konfiguracja wtyczek
+Comment[pt]=Escolha e Configure os 'Plugins'
+Comment[pt_BR]=Escolha e Configure os Seus Plugins
+Comment[ro]=Alegeţi şi configuraţi modulele dumneavoastră
+Comment[ru]=Выберите и настройте модули
+Comment[sk]=Vyberte a nastavte si moduly
+Comment[sl]=Izberite in nastavite vstavke
+Comment[sr]=Изаберите и подесите ваше прикључке
+Comment[sr@Latn]=Izaberite i podesite vaše priključke
+Comment[sv]=Välj och anpassa insticksprogram
+Comment[ta]=சொருகுப்பொருள்களைத் தேர்ந்தெடுத்து வடிவமைக்கவும்
+Comment[tr]=Eklentilerinizi Seçin ve Yapılandırın:
+Comment[uk]=Виберіть та налаштуйте ваші втулки
+Comment[uz]=Plaginlarni tanlash va moslash
+Comment[uz@cyrillic]=Плагинларни танлаш ва мослаш
+Comment[zh_CN]=选择并配置您的插件
+Comment[zh_HK]=選擇及設定你的插件
+Comment[zh_TW]=選擇並設定您的外掛程式
diff --git a/kview/kviewviewer/config/kviewviewerpluginsconfig.h b/kview/kviewviewer/config/kviewviewerpluginsconfig.h
new file mode 100644
index 00000000..4f2b30ab
--- /dev/null
+++ b/kview/kviewviewer/config/kviewviewerpluginsconfig.h
@@ -0,0 +1,38 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef KVIEWVIEWERPLUGINSCONFIG_H
+#define KVIEWVIEWERPLUGINSCONFIG_H
+
+#include <ksettings/pluginpage.h>
+
+class KConfig;
+
+class KViewViewerPluginsConfig : public KSettings::PluginPage
+{
+ Q_OBJECT
+ public:
+ KViewViewerPluginsConfig( QWidget * parent, const char * name = 0, const QStringList & args = QStringList() );
+ ~KViewViewerPluginsConfig();
+ private:
+ KConfig * m_config;
+};
+
+// vim: sw=4 ts=4 noet
+
+#endif // KVIEWVIEWERPLUGINSCONFIG_H
diff --git a/kview/kviewviewer/imagesettings.cpp b/kview/kviewviewer/imagesettings.cpp
new file mode 100644
index 00000000..4f483db7
--- /dev/null
+++ b/kview/kviewviewer/imagesettings.cpp
@@ -0,0 +1,73 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#include "imagesettings.h"
+
+#include <qcheckbox.h>
+#include <qlayout.h>
+
+#include <klocale.h>
+#include <kdialog.h>
+
+ImageSettings::ImageSettings( QWidget * parent, const char * name )
+ : KPrintDialogPage( parent, name )
+ , m_pFitImage( 0 )
+{
+ setTitle( i18n( "Image Settings" ) );
+
+ QBoxLayout * layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() );
+ m_pFitImage = new QCheckBox( i18n( "Fit image to page size" ), this );
+ m_pFitImage->setChecked( true );
+ layout->addWidget( m_pFitImage );
+ m_pCenter = new QCheckBox( i18n( "Center image on page" ), this );
+ m_pCenter->setChecked( true );
+ layout->addWidget( m_pCenter );
+ layout->insertStretch( -1, 0 );
+}
+
+ImageSettings::~ImageSettings()
+{
+}
+
+void ImageSettings::setOptions( const QMap<QString, QString> & opts )
+{
+ m_pFitImage->setChecked( opts[ "app-kviewviewer-fitimage" ] == "1" );
+ m_pCenter->setChecked( opts[ "app-kviewviewer-center" ] == "1" );
+}
+
+void ImageSettings::getOptions( QMap<QString, QString> & opts, bool include_def )
+{
+ if( m_pFitImage->isChecked() )
+ opts[ "app-kviewviewer-fitimage" ] = "1";
+ else if( include_def )
+ opts[ "app-kviewviewer-fitimage" ] = "0";
+
+ if( m_pCenter->isChecked() )
+ opts[ "app-kviewviewer-center" ] = "1";
+ else if( include_def )
+ opts[ "app-kviewviewer-center" ] = "0";
+}
+
+bool ImageSettings::isValid( QString & /*msg*/ )
+{
+ return true;
+}
+
+#include "imagesettings.moc"
+
+// vim:sw=4:ts=4
diff --git a/kview/kviewviewer/imagesettings.h b/kview/kviewviewer/imagesettings.h
new file mode 100644
index 00000000..5d7bf88e
--- /dev/null
+++ b/kview/kviewviewer/imagesettings.h
@@ -0,0 +1,45 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef IMAGESETTINGS_H
+#define IMAGESETTINGS_H
+
+#include <kdeprint/kprintdialogpage.h>
+
+class QCheckBox;
+
+class ImageSettings : public KPrintDialogPage
+{
+ Q_OBJECT
+ public:
+ ImageSettings( QWidget * parent = 0, const char * name = 0 );
+ ~ImageSettings();
+
+ void setOptions( const QMap<QString, QString> & opts );
+ void getOptions( QMap<QString, QString> & opts, bool include_def = false );
+ bool isValid( QString & msg );
+
+ private:
+ QCheckBox * m_pFitImage;
+ QCheckBox * m_pCenter;
+};
+
+// vim:sw=4:ts=4
+
+#endif // IMAGESETTINGS_H
+
diff --git a/kview/kviewviewer/kviewkonqextension.cpp b/kview/kviewviewer/kviewkonqextension.cpp
new file mode 100644
index 00000000..40876b7c
--- /dev/null
+++ b/kview/kviewviewer/kviewkonqextension.cpp
@@ -0,0 +1,105 @@
+/* This file is part of the KDE project
+ Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
+ 2001 Matthias Kretz <kretz@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; 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#include "kviewkonqextension.h"
+#include "kviewviewer.h"
+#include "kimageviewer/canvas.h"
+#include "imagesettings.h"
+
+#include <qpainter.h>
+#include <qimage.h>
+#include <qpaintdevicemetrics.h>
+
+#include <kprinter.h>
+#include <kdebug.h>
+#include <kglobal.h>
+#include <klocale.h>
+
+KViewKonqExtension::KViewKonqExtension( KImageViewer::Canvas * canvas,
+ KViewViewer *parent, const char *name )
+ : KParts::BrowserExtension( parent, name ),
+ m_pViewer( parent ),
+ m_pCanvas( canvas )
+{
+ KGlobal::locale()->insertCatalogue("kview");
+}
+
+void KViewKonqExtension::setXYOffset( int x, int y )
+{
+ m_pCanvas->setXYOffset( x, y );
+}
+
+int KViewKonqExtension::xOffset()
+{
+ return m_pCanvas->xOffset();
+}
+
+int KViewKonqExtension::yOffset()
+{
+ return m_pCanvas->yOffset();
+}
+
+void KViewKonqExtension::print()
+{
+ if( ! m_pCanvas->image() )
+ {
+ kdError( 4610 ) << "No image to print" << endl;
+ return;
+ }
+
+ KPrinter printer;//( true, QPrinter::ScreenResolution );
+ printer.addDialogPage( new ImageSettings );
+ printer.setDocName( "KView: " + m_pViewer->url().fileName( false ) );
+
+ if ( !printer.setup( ((KViewViewer *)parent())->widget(), i18n("Print %1").arg(m_pViewer->url().fileName( false )) ) )
+ return;
+
+ QPainter painter;
+ painter.begin( &printer );
+
+ QPaintDeviceMetrics metrics( painter.device() );
+ kdDebug( 4610 ) << "metrics: " << metrics.width() << "x" << metrics.height() << endl;
+ QPoint pos( 0, 0 );
+
+ QImage imagetoprint;
+ if( printer.option( "app-kviewviewer-fitimage" ) == "1" )
+ imagetoprint = m_pCanvas->image()->smoothScale( metrics.width(), metrics.height(), QImage::ScaleMin );
+ else
+ imagetoprint = *m_pCanvas->image();
+
+ if( printer.option( "app-kviewviewer-center" ) == "1" )
+ {
+ pos.setX( ( metrics.width() - imagetoprint.width() ) / 2 );
+ pos.setY( ( metrics.height() - imagetoprint.height() ) / 2 );
+ }
+
+ painter.drawImage( pos, imagetoprint );
+ painter.end();
+}
+
+void KViewKonqExtension::del()
+{
+ m_pViewer->slotDel();
+}
+
+// vim:sw=4:ts=4
+
+#include "kviewkonqextension.moc"
+
diff --git a/kview/kviewviewer/kviewkonqextension.h b/kview/kviewviewer/kviewkonqextension.h
new file mode 100644
index 00000000..b7692f31
--- /dev/null
+++ b/kview/kviewviewer/kviewkonqextension.h
@@ -0,0 +1,52 @@
+/* This file is part of the KDE project
+ Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
+ 2001 Matthias Kretz <kretz@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; 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, Boston, MA 02110-1301, USA.
+
+*/
+#ifndef __kviewkonqextension_h__
+#define __kviewkonqextension_h__
+
+#include <kparts/browserextension.h>
+
+namespace KImageViewer { class Canvas; }
+class KViewViewer;
+
+class KViewKonqExtension: public KParts::BrowserExtension
+{
+ friend class KViewViewer; // it can emit our signals
+ Q_OBJECT
+ public:
+ KViewKonqExtension( KImageViewer::Canvas *, KViewViewer *parent, const char *name = 0 );
+ virtual ~KViewKonqExtension() {}
+
+ virtual void setXYOffset( int x, int y );
+ virtual int xOffset();
+ virtual int yOffset();
+
+ public slots:
+ // Automatically detected by konqueror and kview
+ void print();
+ void del();
+
+ private:
+ KViewViewer * m_pViewer;
+ KImageViewer::Canvas * m_pCanvas;
+};
+
+// vim:sw=4:ts=4
+
+#endif
diff --git a/kview/kviewviewer/kviewpopup.rc b/kview/kviewviewer/kviewpopup.rc
new file mode 100644
index 00000000..ad4ece69
--- /dev/null
+++ b/kview/kviewviewer/kviewpopup.rc
@@ -0,0 +1,7 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="kview_popup" version="1">
+ <Menu name="popupmenu">
+ <Separator />
+ <Action name="saveimageas" />
+ </Menu>
+</kpartgui>
diff --git a/kview/kviewviewer/kviewviewer.cpp b/kview/kviewviewer/kviewviewer.cpp
new file mode 100644
index 00000000..bab325ec
--- /dev/null
+++ b/kview/kviewviewer/kviewviewer.cpp
@@ -0,0 +1,883 @@
+/* This file is part of the KDE project
+
+ Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
+ 2001-2003 Matthias Kretz <kretz@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; 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#include "kviewviewer.h"
+#include "kimageviewer/canvas.h"
+#include "version.h"
+
+#include <ksettings/dispatcher.h>
+
+#include <unistd.h>
+#include <assert.h>
+
+#include <qbuffer.h>
+#include <qlayout.h>
+#include <qvbox.h>
+#include <qlabel.h>
+#include <qregexp.h>
+
+#include <kpushbutton.h>
+#include <kpassivepopup.h>
+#include <kdebug.h>
+#include <kio/job.h>
+#include <kxmlguifactory.h>
+#include <kfiledialog.h>
+#include <kparts/genericfactory.h>
+#include <kparts/componentfactory.h>
+#include <kparts/plugin.h>
+#include <kmessagebox.h>
+#include <ktempfile.h>
+#include <kapplication.h>
+#include <kimageio.h>
+#include <kstdaccel.h>
+#include <kdirwatch.h>
+#include <kurldrag.h>
+#include <krecentdocument.h>
+
+typedef KParts::GenericFactory<KViewViewer> KViewViewerFactory;
+K_EXPORT_COMPONENT_FACTORY( libkviewviewer, KViewViewerFactory )
+
+KViewViewer::KViewViewer( QWidget *parentWidget, const char * /*widgetName*/,
+ QObject *parent, const char *name, const QStringList & )
+ : KImageViewer::Viewer( parent, name )
+ , m_pParentWidget( parentWidget )
+ , m_pJob( 0 )
+ , m_pExtension( 0 )
+ , m_pCanvas( 0 )
+ , m_pTempFile( 0 )
+ , m_pBuffer( 0 )
+ , m_pFileWatch( new KDirWatch( this ) )
+{
+ KImageIO::registerFormats();
+
+ QWidget * widget = KParts::ComponentFactory::createInstanceFromQuery<QWidget>(
+ "KImageViewer/Canvas", QString::null, m_pParentWidget );
+ m_pCanvas = static_cast<KImageViewer::Canvas *>( widget->qt_cast( "KImageViewer::Canvas" ) );
+ kdDebug( 4610 ) << "KImageViewer::Canvas at " << m_pCanvas << endl;
+ if( ! ( widget && m_pCanvas ) )
+ {
+ if( ! widget )
+ KMessageBox::error( m_pParentWidget, i18n( "Unable to find a suitable Image Canvas. This probably means that KView was not installed properly." ) );
+ else
+ KMessageBox::error( m_pParentWidget, i18n( "Accessing the KImageViewer interface of the Image Canvas failed. Something in your setup is broken (a component claims to be a KImageViewer::Canvas but it is not)." ) );
+ }
+ else
+ {
+ // create the extension before the plugins are loaded, because plugins might want to use it
+ m_pExtension = new KViewKonqExtension( m_pCanvas, this );
+
+ setPluginLoadingMode( LoadPluginsIfEnabled );
+ setInstance( KViewViewerFactory::instance() );
+
+ // m_url isn't set from ReadOnlyPart so we set it here to the CWD
+ m_url = QDir::currentDirPath() + "/";
+ m_sCaption = i18n( "Title caption when no image loaded", "no image loaded" );
+
+ setWidget( widget );
+
+ // Drag and Drop for the Canvas
+ widget->setAcceptDrops( true );
+ widget->installEventFilter( this );
+
+ setupActions();
+
+ if( isReadWrite() )
+ setXMLFile( "kviewviewer.rc" );
+ else
+ setXMLFile( "kviewviewer_ro.rc" );
+
+ connect( widget, SIGNAL( contextPress( const QPoint & ) ),
+ this, SLOT( slotPopupMenu( const QPoint & ) ) );
+ connect( widget, SIGNAL( zoomChanged( double ) ),
+ this, SLOT( zoomChanged( double ) ) );
+ connect( widget, SIGNAL( showingImageDone() ),
+ this, SLOT( switchBlendEffect() ) );
+ connect( widget, SIGNAL( hasImage( bool ) ),
+ this, SLOT( hasImage( bool ) ) );
+ connect( widget, SIGNAL( imageChanged() ),
+ this, SLOT( setModified() ) );
+
+ connect( m_pFileWatch, SIGNAL( dirty( const QString & ) ),
+ this, SLOT( slotFileDirty( const QString & ) ) );
+
+ KSettings::Dispatcher::self()->registerInstance( instance(), this, SLOT( readSettings() ) );
+
+ // by default disable progress info (so it won't open the dialog in Konqueror)
+ setProgressInfoEnabled( false );
+
+ m_popupDoc = KXMLGUIFactory::readConfigFile( "kviewpopup.rc", true, instance() );
+
+ KConfigGroup cfgGroup( instance()->config(), "Settings" );
+ bool hideBars = cfgGroup.readBoolEntry( "hideScrollbars", false );
+ m_pCanvas->hideScrollbars( hideBars );
+ m_paShowScrollbars->setChecked( ! hideBars );
+ m_vEffects.resize( m_pCanvas->numOfBlendEffects() );
+
+ readSettings();
+ }
+}
+
+KViewViewer::~KViewViewer()
+{
+ kdDebug( 4610 ) << k_funcinfo << endl;
+
+ writeSettings();
+ instance()->config()->sync();
+
+ /*abortLoad(); //just in case
+ if( isModified() && isReadWrite() )
+ {
+ int res = m_url.isEmpty() ?
+ KMessageBox::warningYesNo( widget(),
+ i18n( "This is a new document.\nDo you want to save it ?" ),
+ QString::null, KStdGuiItem::saveAs(), KStdGuiItem::discard() ):
+ KMessageBox::warningYesNo( widget(),
+ i18n( "The document has been modified.\nDo you want to save it ?" ),
+ QString::null, KStdGuiItem::saveAs(), KStdGuiItem::dontSave() );
+
+ if( res == KMessageBox::Yes )
+ {
+ KURL url = KFileDialog::getSaveURL();
+ if( ! url.isEmpty() )
+ saveAs( url );
+ }
+ }
+ ReadOnlyPart::closeURL();*/
+
+ abortLoad();
+ delete m_pTempFile;
+ delete m_pBuffer;
+}
+
+KAboutData * KViewViewer::createAboutData()
+{
+ KAboutData * aboutData = new KAboutData( "kviewviewer", I18N_NOOP( "KView" ),
+ KVIEW_VERSION, I18N_NOOP( "KDE Image Viewer Part" ),
+ KAboutData::License_GPL,
+ I18N_NOOP("(c) 1997-2002, The KView Developers") );
+ aboutData->addAuthor( "Matthias Kretz", I18N_NOOP( "Maintainer" ), "kretz@kde.org" );
+ aboutData->addAuthor( "Sirtaj Singh Kang", I18N_NOOP( "started it all" ), "taj@kde.org" );
+ aboutData->addAuthor( "Simon Hausmann", 0, "hausmann@kde.org" );
+ return aboutData;
+}
+
+void KViewViewer::setReadWrite( bool readwrite )
+{
+ KImageViewer::Viewer::setReadWrite( readwrite );
+ if( readwrite )
+ setXMLFile( "kviewviewer.rc" );
+ else
+ setXMLFile( "kviewviewer_ro.rc" );
+}
+
+bool KViewViewer::saveAs( const KURL & kurl )
+{
+ kdDebug( 4610 ) << k_funcinfo << endl;
+ if( !kurl.isValid() )
+ return KParts::ReadWritePart::saveAs( kurl ); // sets m_bClosing = false
+
+ // if the image wasn't modified and should be saved in the same format we just copy the file - no need
+ // to lose some quality or information by calling QImage::save()
+ if( ! ( isModified() && isReadWrite() ) && m_mimeType == m_newMimeType )
+ {
+ kdDebug( 4610 ) << "copy image from " << m_file << " to " << kurl.prettyURL() << endl;
+
+ KIO::Job * job = KIO::copy( KURL( m_file ), kurl, isProgressInfoEnabled() );
+ emit started( job );
+ connect( job, SIGNAL( result( KIO::Job * ) ),
+ this, SLOT( slotResultSaveAs( KIO::Job * ) ) );
+ return true;
+ }
+ kdDebug( 4610 ) << "call KParts::ReadWritePart::saveAs( " << kurl.prettyURL() << " )" << endl;
+
+ bool ret = KParts::ReadWritePart::saveAs( kurl );
+ if( ret == false )
+ KMessageBox::error( m_pParentWidget, i18n( "The image could not be saved to disk. A possible causes is that you don't have permission to write to that file." ) );
+ return ret;
+}
+
+void KViewViewer::setModified( bool modified )
+{
+ m_paSave->setEnabled( modified );
+ KImageViewer::Viewer::setModified( modified );
+}
+
+bool KViewViewer::openURL( const KURL & url )
+{
+ kdDebug( 4610 ) << k_funcinfo << endl;
+ if ( !url.isValid() )
+ {
+ kdWarning( 4610 ) << "malformed URL " << url.prettyURL() << endl;
+ return false;
+ }
+ if ( !closeURL() )
+ {
+ kdDebug( 4610 ) << "closeURL didn't work out" << endl;
+ return false;
+ }
+ setModified( false );
+ m_url = url;
+ m_mimeType = m_pExtension->urlArgs().serviceType; // if this fails to
+ // find the right mime type it'll be determined in openFile()
+ if ( m_url.isLocalFile() )
+ {
+ emit started( 0 );
+ m_file = m_url.path();
+ kdDebug( 4610 ) << "open local file " << m_file << endl;
+ bool ret = openFile();
+ if( ret )
+ {
+ m_sCaption = m_url.prettyURL();
+ emit setWindowCaption( m_sCaption );
+ emit completed();
+ }
+ return ret;
+ }
+ else
+ {
+ m_sCaption = m_url.prettyURL();
+ emit setWindowCaption( m_sCaption );
+ m_bTemp = true;
+ // Use same extension as remote file. This is important for mimetype-determination (e.g. koffice)
+ QString extension;
+ QString fileName = url.fileName();
+ int extensionPos = fileName.findRev( '.' );
+ if ( extensionPos != -1 )
+ extension = fileName.mid( extensionPos ); // keep the '.'
+ delete m_pTempFile;
+ m_pTempFile = new KTempFile( QString::null, extension );
+ m_file = m_pTempFile->name();
+
+ m_pJob = KIO::get( m_url, m_pExtension->urlArgs().reload, isProgressInfoEnabled() );
+ emit started( m_pJob );
+ connect( m_pJob, SIGNAL( result( KIO::Job * ) ), SLOT( slotJobFinished ( KIO::Job * ) ) );
+ connect( m_pJob, SIGNAL( data( KIO::Job *, const QByteArray & ) ), SLOT( slotData( KIO::Job *, const QByteArray & ) ) );
+ return true;
+ }
+}
+
+bool KViewViewer::closeURL()
+{
+ kdDebug( 4610 ) << k_funcinfo << endl;
+ abortLoad();
+ QString file = m_file;
+ bool ret = KParts::ReadWritePart::closeURL();
+ if( ret )
+ if( ! file.isEmpty() )
+ {
+ kdDebug( 4610 ) << "remove " << file << " from KDirWatch\n";
+ m_pFileWatch->removeFile( file );
+ }
+ return ret;
+}
+
+void KViewViewer::newImage( const QImage & newimg )
+{
+ if( closeURL() )
+ {
+ m_url = "";
+ m_file = QString::null;
+ m_sCaption = i18n( "Title caption when new image selected", "new image" );
+ m_pCanvas->setImage( newimg );
+ if( isReadWrite() )
+ setModified( true );
+ }
+}
+
+void KViewViewer::reload()
+{
+ kdDebug( 4610 ) << k_funcinfo << endl;
+
+ if( isReadWrite() && isModified() )
+ if( ! queryClose() )
+ return;
+
+ //load from file
+ QImage image( m_file );
+ m_pCanvas->setImage( image );
+ setModified( false );
+}
+
+bool KViewViewer::eventFilter( QObject * o, QEvent * e )
+{
+ KImageViewer::Canvas * canvas = static_cast<KImageViewer::Canvas*>( o->qt_cast( "KImageViewer::Canvas" ) );
+ if( canvas )
+ {
+ // intercept drops onto the Canvas
+ switch( e->type() )
+ {
+ case QEvent::DragEnter:
+ {
+ QDragEnterEvent * ev = static_cast<QDragEnterEvent*>( e );
+ kdDebug( 4610 ) << "DragEnter Event in the Canvas: " << endl;
+ for( int i = 0; ev->format( i ); ++i )
+ kdDebug( 4610 ) << " - " << ev->format( i ) << endl;
+ ev->accept( KURLDrag::canDecode( ev ) || QImageDrag::canDecode( ev ) );
+ return true;
+ }
+ case QEvent::Drop:
+ {
+ QDropEvent * ev = static_cast<QDropEvent*>( e );
+ kdDebug( 4610 ) << "Drop Event in the Canvas" << endl;
+ QStringList l;
+ QImage image;
+ if( KURLDrag::decodeToUnicodeUris( ev, l ) )
+ openURL( KURL( l.first() ) );
+ else if( QImageDrag::decode( ev, image ) )
+ newImage( image );
+ return true;
+ }
+ default:
+ break;
+ }
+ }
+ return KImageViewer::Viewer::eventFilter( o, e );
+}
+
+void KViewViewer::abortLoad()
+{
+ if ( m_pJob )
+ {
+ m_pJob->kill();
+ m_pJob = 0;
+ }
+}
+
+bool KViewViewer::openFile()
+{
+ //m_pCanvas->setMaximumImageSize( QSize( widget()->width(), widget()->height() ) );
+ if( m_pBuffer )
+ {
+ kdDebug( 4610 ) << k_funcinfo << " load from buffer\n";
+ //load from buffer
+ m_pBuffer->close();
+ if( m_pTempFile )
+ {
+ m_pTempFile->dataStream()->writeRawBytes( m_pBuffer->buffer().data(), m_pBuffer->buffer().size() );
+ m_pTempFile->close();
+ }
+
+ // determine Mime Type
+ if( m_mimeType.isNull() )
+ {
+ m_mimeType = KImageIO::mimeType( m_url.fileName() );
+ kdDebug( 4610 ) << "MimeType: " << m_mimeType << endl;
+ if( m_mimeType.isNull() )
+ {
+ m_mimeType = KMimeType::findByContent( m_pBuffer->buffer() )->name();
+ kdDebug( 4610 ) << "MimeType: " << m_mimeType << endl;
+ }
+ }
+
+ QImage image( m_pBuffer->buffer() );
+ delete m_pBuffer;
+ m_pBuffer = 0;
+ if( ! image.isNull() )
+ {
+ QSize size = image.size();
+ m_pCanvas->setImage( image, size );
+ }
+ else
+ {
+ emit setStatusBarText( i18n( "Unknown image format: %1" ).arg( m_url.prettyURL() ) );
+ return false;
+ }
+ }
+ else
+ { //load from local file
+ kdDebug( 4610 ) << k_funcinfo << " load from file: " << m_file << endl;
+ if( ! QFile::exists( m_file ) )
+ {
+ emit setStatusBarText( i18n( "No such file: %1" ).arg( m_file ) );
+ return false;
+ }
+ if( QImage::imageFormat( m_file ) == 0 )
+ {
+ emit setStatusBarText( i18n( "Unknown image format: %1" ).arg( m_file ) );
+ return false;
+ }
+ // determine Mime Type
+ if( m_mimeType.isNull() )
+ {
+ m_mimeType = KImageIO::mimeType( m_file );
+ kdDebug( 4610 ) << "MimeType: " << m_mimeType << endl;
+ }
+
+ //load from file
+ QImage image( m_file );
+ QSize size = image.size();
+ m_pCanvas->setImage( image, size );
+ }
+ m_pFileWatch->addFile( m_file );
+ emit imageOpened( m_url );
+ return true;
+}
+
+bool KViewViewer::saveFile()
+{
+ kdDebug( 4610 ) << k_funcinfo << endl;
+ // two possibilities:
+ //
+ // 1. The image should be saved as an exact copy of the loaded one (this
+ // is useful if you downloaded an image from the net and want to save it
+ // locally) - this can happen only in saveAs() so only 2. applies here:
+ //
+ // 2. The image should be saved in a different format or was modified, so
+ // that copying isn't possible anymore.
+
+ const QImage * image = m_pCanvas->image();
+ if( ! image )
+ return false;
+
+ if( ! m_newMimeType.isNull() )
+ {
+ m_mimeType = m_newMimeType;
+ m_newMimeType = QString::null;
+ }
+ QString type = KImageIO::typeForMime( m_mimeType );
+ kdDebug( 4610 ) << "save m_pCanvas->image() to " << m_file << " as " << type << endl;
+ int quality = 100; // TODO: ask user for quality. Keep it at 100 so that our
+ // users don't lose quality when working with KView.
+
+ m_pFileWatch->removeFile( m_file );
+ bool ret = image->save( m_file, type.latin1(), quality );
+ m_pFileWatch->addFile( m_file );
+ return ret;
+}
+
+void KViewViewer::setupActions()
+{
+ m_paZoomIn = new KAction( i18n( "Zoom In" ), "viewmag+", KStdAccel::shortcut( KStdAccel::ZoomIn ), this,
+ SLOT( slotZoomIn() ), actionCollection(), "zoomin" );
+ m_paZoomOut = new KAction( i18n( "Zoom Out" ), "viewmag-", KStdAccel::shortcut( KStdAccel::ZoomOut ), this,
+ SLOT( slotZoomOut() ), actionCollection(), "zoomout" );
+
+ m_paZoom = new KSelectAction( i18n( "Zoom" ), "viewmag", 0, actionCollection(), "view_zoom" );
+ connect( m_paZoom, SIGNAL( activated( const QString & ) ), this, SLOT( setZoom( const QString & ) ) );
+ m_paZoom->setEditable( true );
+ m_paZoom->clear();
+ m_paZoom->setItems( QStringList::split( '|', "20%|25%|33%|50%|75%|100%|125%|150%|200%|250%|300%|350%|400%|450%|500%" ) );
+ m_paZoom->setCurrentItem( 5 );
+
+ m_paFlipMenu = new KActionMenu( i18n( "&Flip" ), actionCollection(), "flip" );
+ m_paFlipV = new KAction( i18n( "&Vertical" ), Key_V, this, SLOT( slotFlipV() ), actionCollection(), "flip_vertical" );
+ m_paFlipH = new KAction( i18n( "&Horizontal" ), Key_H, this, SLOT( slotFlipH() ), actionCollection(), "flip_horizontal" );
+ m_paFlipMenu->insert( m_paFlipV );
+ m_paFlipMenu->insert( m_paFlipH );
+
+ m_paRotateCCW = new KAction( i18n( "Ro&tate Counter-Clockwise" ), "rotate_ccw", 0, this,
+ SLOT( slotRotateCCW() ), actionCollection(), "rotateCCW" );
+ m_paRotateCW = new KAction( i18n( "Rotate Clockwise" ), "rotate_cw", 0, this,
+ SLOT( slotRotateCW() ), actionCollection(), "rotateCW" );
+ m_paSave = KStdAction::save( this, SLOT( slotSave() ), actionCollection() );
+ m_paSave->setEnabled( false );
+ m_paSaveAs = KStdAction::saveAs( this, SLOT( slotSaveAs() ), actionCollection() );
+
+ m_paFitToWin = new KAction( i18n( "Fit Image to Window" ), 0, 0, this,
+ SLOT( slotFitToWin() ), actionCollection(), "fittowin" );
+ m_paZoomIn->setEnabled( false );
+ m_paZoomOut->setEnabled( false );
+ m_paZoom->setEnabled( false );
+ m_paRotateCCW->setEnabled( false );
+ m_paRotateCW->setEnabled( false );
+ m_paSaveAs->setEnabled( false );
+ m_paFitToWin->setEnabled( false );
+ m_paFlipMenu->setEnabled( false );
+ m_paFlipV->setEnabled( false );
+ m_paFlipH->setEnabled( false );
+ connect( widget(), SIGNAL( hasImage( bool ) ), m_paZoomIn, SLOT( setEnabled( bool ) ) );
+ connect( widget(), SIGNAL( hasImage( bool ) ), m_paZoomOut, SLOT( setEnabled( bool ) ) );
+ connect( widget(), SIGNAL( hasImage( bool ) ), m_paZoom, SLOT( setEnabled( bool ) ) );
+ connect( widget(), SIGNAL( hasImage( bool ) ), m_paRotateCCW, SLOT( setEnabled( bool ) ) );
+ connect( widget(), SIGNAL( hasImage( bool ) ), m_paRotateCW, SLOT( setEnabled( bool ) ) );
+ connect( widget(), SIGNAL( hasImage( bool ) ), m_paSaveAs, SLOT( setEnabled( bool ) ) );
+ connect( widget(), SIGNAL( hasImage( bool ) ), m_paFitToWin, SLOT( setEnabled( bool ) ) );
+ connect( widget(), SIGNAL( hasImage( bool ) ), m_paFlipMenu, SLOT( setEnabled( bool ) ) );
+ connect( widget(), SIGNAL( hasImage( bool ) ), m_paFlipV, SLOT( setEnabled( bool ) ) );
+ connect( widget(), SIGNAL( hasImage( bool ) ), m_paFlipH, SLOT( setEnabled( bool ) ) );
+
+ m_paShowScrollbars = new KToggleAction( i18n( "Show Scrollbars" ), 0, this, SLOT( slotToggleScrollbars() ),
+ actionCollection(), "show_scrollbars" );
+ m_paShowScrollbars->setCheckedState(i18n("Hide Scrollbars"));
+}
+
+void KViewViewer::guiActivateEvent( KParts::GUIActivateEvent * event )
+{
+ ReadWritePart::guiActivateEvent( event );
+ bool enabled = m_pCanvas->image() ? true : false;
+ emit m_pExtension->enableAction( "del", enabled );
+ emit m_pExtension->enableAction( "print", enabled );
+ if( ! enabled )
+ {
+ m_sCaption = i18n( "Title caption when no image loaded", "no image loaded" );
+ emit setWindowCaption( m_sCaption );
+ }
+}
+
+void KViewViewer::readSettings()
+{
+ KConfigGroup cfgGroup( instance()->config(), "Settings" );
+ m_pCanvas->setFastScale( ! cfgGroup.readBoolEntry( "Smooth Scaling", ! m_pCanvas->fastScale() ) );
+ m_pCanvas->setKeepAspectRatio( cfgGroup.readBoolEntry( "Keep Aspect Ratio", m_pCanvas->keepAspectRatio() ) );
+ m_pCanvas->setCentered( cfgGroup.readBoolEntry( "Center Image", m_pCanvas->centered() ) );
+
+ m_pCanvas->setBgColor( cfgGroup.readColorEntry( "Background Color", &m_pCanvas->bgColor() ) );
+
+ m_pCanvas->setMinimumImageSize( QSize( cfgGroup.readNumEntry( "Minimum Width", m_pCanvas->minimumImageSize().width() ),
+ cfgGroup.readNumEntry( "Minimum Height", m_pCanvas->minimumImageSize().height() ) ) );
+ m_pCanvas->setMaximumImageSize( QSize( cfgGroup.readNumEntry( "Maximum Width", m_pCanvas->maximumImageSize().width() ),
+ cfgGroup.readNumEntry( "Maximum Height", m_pCanvas->maximumImageSize().height() ) ) );
+
+ KConfigGroup blendConfig( instance()->config(), "Blend Effects" );
+ m_vEffects.clear();
+ for( unsigned int i = 1; i <= m_pCanvas->numOfBlendEffects(); ++i )
+ {
+ if( blendConfig.readBoolEntry( QString::number( i ), false ) )
+ m_vEffects.push_back( i );
+ }
+ // and now tell the canvas what blend effect to use
+ switchBlendEffect();
+ loadPlugins();
+}
+
+void KViewViewer::writeSettings()
+{
+ KConfigGroup cfgGroup( instance()->config(), "Settings" );
+ cfgGroup.writeEntry( "hideScrollbars", ! m_paShowScrollbars->isChecked() );
+}
+
+void KViewViewer::zoomChanged( double zoom )
+{
+ kdDebug( 4610 ) << k_funcinfo << endl;
+ emit setWindowCaption( m_sCaption + QString( " (%1%)" ).arg( zoom * 100, 0, 'f', 0 ) );
+ updateZoomMenu( zoom );
+}
+
+void KViewViewer::slotJobFinished( KIO::Job * job )
+{
+ assert( job == m_pJob );
+ m_pJob = 0;
+ if (job->error())
+ emit canceled( job->errorString() );
+ else
+ {
+ openFile();
+ emit completed();
+ }
+}
+
+void KViewViewer::slotData( KIO::Job *, const QByteArray & data )
+{
+ if( ! m_pBuffer )
+ {
+ m_pBuffer = new QBuffer();
+ m_pBuffer->open( IO_ReadWrite );
+ }
+ m_pBuffer->writeBlock( data.data(), data.size() );
+
+ //show partial image XXX: is this really the way to do it?
+ //No. :) It takes forever like this.
+ //OK. So I really have to look at khtml...
+ //later...
+ //m_pCanvas->setImage( QImage( m_pBuffer->buffer() ) );
+}
+
+void KViewViewer::slotSave()
+{
+ kdDebug( 4610 ) << k_funcinfo << endl;
+ if( ! save() )
+ KMessageBox::error( m_pParentWidget, i18n( "The image could not be saved to disk. A possible causes is that you don't have permission to write to that file." ) );
+}
+
+void KViewViewer::slotSaveAs()
+{
+ kdDebug( 4610 ) << k_funcinfo << endl;
+ KFileDialog dlg( QString::null, QString::null, widget(), "filedialog", true );
+ dlg.setMimeFilter( KImageIO::mimeTypes( KImageIO::Writing ) );
+ dlg.setSelection( m_url.fileName() );
+ dlg.setCaption( i18n( "Save As" ) );
+ dlg.setOperationMode( KFileDialog::Saving );
+ dlg.exec();
+ KURL url = dlg.selectedURL();
+ m_newMimeType = dlg.currentMimeFilter();
+ if( m_newMimeType.isEmpty() )
+ m_newMimeType = KImageIO::mimeType( url.path() );
+ kdDebug( 4610 ) << k_funcinfo << "m_newMimeType = " << m_newMimeType << endl;
+ if( url.isValid() )
+ KRecentDocument::add( url );
+ saveAs( url );
+}
+
+void KViewViewer::slotZoomIn()
+{
+ double zoom = m_pCanvas->zoom() * 1.1;
+ if (zoom < 0.01) zoom=0.01 ;
+ m_pCanvas->setZoom( zoom );
+}
+
+void KViewViewer::slotZoomOut()
+{
+ double zoom = m_pCanvas->zoom() / 1.1;
+ if (zoom < 0.01) zoom=0.01 ;
+ m_pCanvas->setZoom( zoom );
+}
+
+void KViewViewer::setZoom( const QString & newZoom )
+{
+ kdDebug( 4610 ) << k_funcinfo << newZoom << endl;
+ double zoom;
+ QString z = newZoom;
+ z.remove( z.find( '%' ), 1 );
+ if( newZoom == "33%" )
+ zoom = 1.0 / 3.0;
+ else
+ zoom = KGlobal::locale()->readNumber( z ) / 100;
+
+ m_pCanvas->setZoom( zoom );
+}
+
+void KViewViewer::updateZoomMenu( double zoom )
+{
+ QStringList lst;
+ if( zoom > 0.0 )
+ {
+ //lst << i18n( "Maxpect" );
+ QValueList<int> list;
+ QString z;
+ int val;
+ bool ok;
+ QStringList itemsList = m_paZoom->items();
+ for( QStringList::Iterator it = itemsList.begin(); it != itemsList.end(); ++it )
+ {
+ z = ( *it ).replace( QRegExp( "%" ), "" );
+ z = z.simplifyWhiteSpace();
+ val = z.toInt( &ok );
+ if( ok && val > 0 && list.contains( val ) == 0 )
+ list << val;
+ }
+ val = QString::number( zoom * 100, 'f', 0 ).toInt(); // round/lround from math.h doesn't work - dunno
+ if( list.contains( val ) == 0 )
+ list.append( val );
+
+ qHeapSort( list );
+
+ for( QValueList<int>::Iterator it = list.begin(); it != list.end(); ++it )
+ lst << QString::number( *it ) + '%';
+ m_paZoom->setItems( lst );
+ }
+
+ // first look if it's a new value (not in the list yet)
+ QString z = QString( "%1%" ).arg( zoom * 100, 0, 'f', 0 );
+ QStringList items = m_paZoom->items();
+ int idx = items.findIndex( z );
+ if( -1 == idx )
+ {
+ // not found XXX: remove when done
+ kdDebug( 4610 ) << "zoom value not in the list: " << z << endl;
+ kdDebug( 4610 ) << "here's the list:\n- " << items.join( "\n- " ) << endl;
+ }
+ else
+ {
+ // already in the list
+ kdDebug( 4610 ) << "zoom value already in the list: " << z << endl;
+ // make that one selected
+ m_paZoom->setCurrentItem( idx );
+ }
+}
+
+void KViewViewer::slotFlipH()
+{
+ m_pCanvas->flipVertical( isReadWrite() );
+}
+
+void KViewViewer::slotFlipV()
+{
+ m_pCanvas->flipHorizontal( isReadWrite() );
+}
+
+void KViewViewer::slotRotateCCW()
+{
+ m_pCanvas->rotate( -90.0, isReadWrite() );
+}
+
+void KViewViewer::slotRotateCW()
+{
+ m_pCanvas->rotate( 90.0, isReadWrite() );
+}
+
+void KViewViewer::slotFitToWin()
+{
+ m_pCanvas->boundImageTo( widget()->size() );
+}
+
+void KViewViewer::slotDel()
+{
+ //just in case m_url get's modified while closing
+ KURL urltodel = m_url;
+ if( closeURL() )
+ {
+ setModified( false );
+ KIO::file_delete( urltodel );
+ m_pCanvas->clear();
+ }
+}
+
+class PopupGUIClient : public KXMLGUIClient
+{
+ public:
+ PopupGUIClient( KInstance *inst, const QString &doc )
+ {
+ setInstance( inst );
+ setXML( doc );
+ }
+};
+
+void KViewViewer::slotPopupMenu( const QPoint &pos )
+{
+ KXMLGUIClient *popupGUIClient = new PopupGUIClient( instance(), m_popupDoc );
+
+ (void) new KAction( i18n( "Save Image As..." ), 0, this, SLOT( slotSaveAs() ),
+ popupGUIClient->actionCollection(), "saveimageas" );
+
+ // ### HACK treat the image as dir to get the back/fwd/reload buttons (Simon)
+ emit m_pExtension->popupMenu( popupGUIClient, pos, m_url, m_mimeType, S_IFDIR );
+
+ delete popupGUIClient;
+}
+
+void KViewViewer::slotResultSaveAs( KIO::Job *job )
+{
+ if ( job->error() )
+ {
+ emit canceled( job->errorString() );
+ //job->showErrorDialog( widget() );
+ }
+ else
+ {
+ emit completed();
+ KIO::CopyJob * cjob = ::qt_cast<KIO::CopyJob*>( job );
+ if( cjob )
+ {
+ m_url = cjob->destURL();
+ m_sCaption = m_url.prettyURL();
+ }
+ else
+ m_sCaption = "";
+ emit setWindowCaption( m_sCaption );
+ }
+
+ // Now we have to delete the tempfile if it exists and if the current
+ // image position is on the local HD. If it's somewhere else we keep the
+ // tempfile in case the user calls saveAs() again.
+ if( m_url.isLocalFile() )
+ {
+ if( m_bTemp )
+ {
+ unlink( QFile::encodeName( m_file ) );
+ m_bTemp = false;
+ }
+ m_file = m_url.path();
+ }
+}
+
+void KViewViewer::slotFileDirty( const QString & )
+{
+ if( isModified() && isReadWrite() )
+ {
+ KPassivePopup * pop = new KPassivePopup( m_pParentWidget );
+ QVBox * vb = pop->standardView( i18n( "Load changed image? - %1" ).arg( kapp->aboutData()->programName() ),
+ QString::null, kapp->miniIcon() );
+ ( void )new QLabel( i18n( "The image %1 which you have modified has changed on disk.\n"
+ "Do you want to reload the file and lose your changes?\n"
+ "If you don't and subsequently save the image, you will lose the\n"
+ "changes that have already been saved." ).arg( url().fileName() ), vb );
+ QWidget * hb = new QWidget( vb );
+ QHBoxLayout * layout = new QHBoxLayout( hb );
+ layout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum ) );
+ KPushButton * yes = new KPushButton( i18n("Reload"), hb );
+ layout->addWidget( yes );
+ layout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum ) );
+ KPushButton * no = new KPushButton( i18n("Do Not Reload"), hb );
+ layout->addWidget( no );
+ layout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum ) );
+ connect( yes, SIGNAL( clicked() ), this, SLOT( slotReloadUnmodified() ) );
+ connect( yes, SIGNAL( clicked() ), pop, SLOT( hide() ) );
+ connect( no, SIGNAL( clicked() ), pop, SLOT( hide() ) );
+ pop->setView( vb );
+ pop->setTimeout( 0 );
+ pop->setAutoDelete( true );
+ pop->show();
+ kdDebug( 4610 ) << "popup returned\n";
+ }
+ else
+ reload();
+}
+
+void KViewViewer::slotReloadUnmodified()
+{
+ setModified( false );
+ reload();
+ kdDebug( 4610 ) << "reload done\n";
+}
+
+void KViewViewer::slotToggleScrollbars()
+{
+ m_pCanvas->hideScrollbars( ! m_paShowScrollbars->isChecked() );
+}
+
+void KViewViewer::loadPlugins()
+{
+ KImageViewer::Viewer::loadPlugins( this, this, instance() );
+ if( factory() )
+ {
+ QPtrList<KParts::Plugin> plugins = KParts::Plugin::pluginObjects( this );
+ KParts::Plugin * plugin;
+ for( plugin = plugins.first(); plugin; plugin = plugins.next() )
+ factory()->addClient( plugin );
+ }
+}
+
+void KViewViewer::switchBlendEffect()
+{
+ if( m_vEffects.empty() )
+ m_pCanvas->setBlendEffect( 0 );
+ else
+ {
+ unsigned int num = KApplication::random() % m_vEffects.size();
+ m_pCanvas->setBlendEffect( m_vEffects[ num ] );
+ }
+}
+
+void KViewViewer::hasImage( bool b )
+{
+ emit m_pExtension->enableAction( "del", b );
+ emit m_pExtension->enableAction( "print", b );
+ if( ! b )
+ {
+ m_sCaption = i18n( "Title caption when no image loaded", "No Image Loaded" );
+ emit setWindowCaption( m_sCaption );
+ }
+}
+
+// vim:sw=4:ts=4
+
+#include "kviewviewer.moc"
+
diff --git a/kview/kviewviewer/kviewviewer.desktop b/kview/kviewviewer/kviewviewer.desktop
new file mode 100644
index 00000000..2961fb65
--- /dev/null
+++ b/kview/kviewviewer/kviewviewer.desktop
@@ -0,0 +1,118 @@
+[Desktop Entry]
+Type=Service
+Icon=kview
+Comment=KDE Image Viewer Part
+Comment[af]=Kde Beeld Aansig Deel
+Comment[ar]=عارض جزء الصور ل KDE
+Comment[br]=Perzh gweler skeudennoù KDE
+Comment[bs]=KDE Part - Preglednik slika
+Comment[ca]=Peça de KDE visualitzadora d'imatges
+Comment[cs]=Komponenta prohlížeče obrázků KDE
+Comment[cy]=Rhan Gwelydd Delweddau KDE
+Comment[da]=KDE Billedviser-part
+Comment[de]=KDE Bildbetrachter-Komponente (KPart)
+Comment[el]=Part προβολέα εικόνων του KDE
+Comment[eo]=KDE-bildorigardilo parto
+Comment[es]=Parte de visor de imágenes de KDE
+Comment[et]=KDE pildifailide näitaja komponent
+Comment[eu]=KDE irudi ikustailearen zatia
+Comment[fa]=جزء مشاهده‌گر تصویر KDE
+Comment[fi]=KDE:n kuvannäyttökomponentti
+Comment[fr]=Composant d'affichage d'images de KDE
+Comment[gl]=Visor de imaxes integrado do KDE
+Comment[he]=רכיב מציג תמונות ל־KDE
+Comment[hi]=केडीई छवि प्रदर्शक पार्ट
+Comment[hr]=KDE komponenta za pregledavanje slika
+Comment[hu]=KDE képnézegető objektum
+Comment[is]=Myndbirtir KDE
+Comment[it]=Componente KDE per la visione di immagini
+Comment[ja]=KDE 画像ビューアパート
+Comment[kk]=KDE кескінді қарау құралының бөлшегі
+Comment[km]=ផ្នែក​របស់​កម្មវិធី​មើល​រូបភាព KDE
+Comment[lt]=KDE paveikslėlių žiūriklio dalis
+Comment[ms]=Bahagian Pemapar Imej KDE
+Comment[nb]=KDE-bildefremviserdel
+Comment[nds]=Bildkieker-Komponent för KDE
+Comment[ne]=KDE छवि दर्शक भाग
+Comment[nl]=KDE's weergavecomponent (Part) voor afbeeldingen
+Comment[nn]=Biletvisardel for KDE
+Comment[nso]=Seripa sa Molebeledi wa Ponagalo sa KDE
+Comment[pa]=KDE ਚਿੱਤਰ ਦਰਸ਼ਕ ਭਾਗ
+Comment[pl]=Składnik do przeglądarka obrazków KDE
+Comment[pt]=Componente de Visualização de Imagens do KDE
+Comment[pt_BR]=Parte do Visualizador de Imagens do KDE
+Comment[ro]=Componentă KDE de vizualizare imagini
+Comment[ru]=Компонент KDE просмотра изображений
+Comment[se]=KDE:a govvačájehanoassi
+Comment[sk]=Part KDE Prehliadač obrázkov
+Comment[sl]=Del pregledovalnika slik KDE
+Comment[sr]=KDE-ов део за приказивање слика
+Comment[sr@Latn]=KDE-ov deo za prikazivanje slika
+Comment[sv]=KDE:s bildvisningsdel
+Comment[ta]=கேடிஇ பகுதி பிம்பக் காட்சி
+Comment[tg]=Қисмати KDE-и намоиши тасвирот
+Comment[tr]=KDE Resim Göstericisi Kısmı
+Comment[uk]=Складова KDE переглядача зображень
+Comment[ven]=Tshipida tsha muvhoni wa tshifanyiso tsha KDE
+Comment[xh]=Iqhekeza Lombonisi Womfanekiso we KDE
+Comment[zh_CN]=KDE 图像查看器组件
+Comment[zh_HK]=KDE 圖像檢視器組件
+Comment[zh_TW]=KDE 影像檢視器組件
+Comment[zu]=Ingxenye Yombukisi Wesithombe se-KDE
+MimeType=image/gif;image/x-xpm;image/x-xbm;image/jpeg;image/x-bmp;image/png;image/x-ico;image/x-portable-bitmap;image/x-portable-pixmap;image/x-portable-greymap;image/tiff;image/jp2
+Name=KView Image Viewer
+Name[ar]=عارض KView للصور
+Name[br]=Gweler skeudennoù KView
+Name[bs]=KView predglednik slika
+Name[ca]=Visualitzador d'imatges KView
+Name[cs]=Prohlížeč obrázků KView
+Name[cy]=Celfigyn Gwelydd Delweddau KGweld
+Name[da]=KView-billedfremviser
+Name[de]=Bildbetrachter KView
+Name[el]=Προβολέας εικόνων KView
+Name[eo]=KView-Bildrigardilo
+Name[es]=Visor de imágenes de KView
+Name[et]=KView pildifailide näitaja
+Name[eu]=KView irudi ikustailea
+Name[fa]=مشاهده‌گر تصویر KView
+Name[fi]=KView-kuvannäytin
+Name[fr]=Visualisateur d'images KView
+Name[gl]=Visor de imaxes KView
+Name[he]=מציג תמונות KView
+Name[hi]=के-व्यू छवि प्रदर्शक
+Name[hu]=KView képnézegető
+Name[is]=KView myndbirtirinn
+Name[it]=Visore di immagini KView
+Name[ja]=KView 画像ビューア
+Name[kk]=KView кескінді қарау құралы
+Name[km]=កម្មវិធី​មើល​រូបភាព KView
+Name[lt]=KView paveikslėlių žiūryklė
+Name[ms]=Pemapar Imej KView
+Name[nb]=Bildeviseren KView
+Name[nds]=Bildkieker KView
+Name[ne]=केडीई दृश्य छवि दर्शक
+Name[nl]=KView afbeeldingenweergave
+Name[nn]=Biletvisaren KView
+Name[pa]=KView ਚਿੱਤਰ ਦਰਸ਼ਕ
+Name[pl]=Przeglądarka obrazków KView
+Name[pt]=Visualizador de Imagens KView
+Name[pt_BR]=Visualizador de Imagens do KVisualização
+Name[ro]=Vizualizor imagini KView
+Name[ru]=Программа просмотра изображений KView
+Name[se]=KView govvačájeheaddji
+Name[sk]=Prehliadač obrázkov KView
+Name[sl]=Pregledovalnik slik KView
+Name[sr]=KView, приказивач слика
+Name[sr@Latn]=KView, prikazivač slika
+Name[sv]=Kview bildvisning
+Name[ta]=கேகாட்சி பிம்பக் காட்சி
+Name[tg]=Барномаи намоиши тасвироти KView
+Name[tr]=KView Resim Görüntüleyici
+Name[uk]=Переглядач зображень KView
+Name[wa]=KView Håyneu d' imådjes
+Name[zh_CN]=KView 图像查看器
+Name[zh_HK]=KView 圖像檢視器
+Name[zh_TW]=KView 影像檢視器
+ServiceTypes=KImageViewer/Viewer,KParts/ReadWritePart,Browser/View
+InitialPreference=3
+X-KDE-Library=libkviewviewer
diff --git a/kview/kviewviewer/kviewviewer.h b/kview/kviewviewer/kviewviewer.h
new file mode 100644
index 00000000..4c5f13a0
--- /dev/null
+++ b/kview/kviewviewer/kviewviewer.h
@@ -0,0 +1,145 @@
+/* This file is part of the KDE project
+ Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
+ 2001-2002 Matthias Kretz <kretz@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; 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, Boston, MA 02110-1301, USA.
+
+*/
+#ifndef __kviewviewer_h__
+#define __kviewviewer_h__
+
+#include "kimageviewer/viewer.h"
+#include "kviewkonqextension.h"
+
+#include <qvaluevector.h>
+#include "kviewvieweriface.h"
+#include <kdemacros.h>
+
+namespace KImageViewer { class Canvas; }
+namespace KIO { class Job; }
+
+class KTempFile;
+class KAction;
+class KActionMenu;
+class KToggleAction;
+class KSelectAction;
+class KAboutData;
+class QBuffer;
+class QSize;
+class KDirWatch;
+template<class T>
+class QCache;
+
+class KDE_EXPORT KViewViewer : public KImageViewer::Viewer, public KViewViewerIface
+{
+ Q_OBJECT
+ friend class KViewKonqExtension;
+
+ public:
+ KViewViewer( QWidget * parentWidget, const char * widgetName,
+ QObject * parent, const char * name, const QStringList & );
+ virtual ~KViewViewer();
+
+ KImageViewer::Canvas * canvas() const { return m_pCanvas; }
+ static KAboutData * createAboutData();
+ virtual void setReadWrite( bool readwrite = true );
+ KParts::BrowserExtension * browserExtension() const { return m_pExtension; }
+
+ bool saveAs( const KURL & );
+ void setModified( bool );
+
+ public slots:
+ virtual bool openURL( const KURL & );
+ virtual bool closeURL();
+ virtual void newImage( const QImage & );
+ virtual void reload();
+
+ protected:
+ bool eventFilter( QObject *, QEvent * ); // for DnD
+ void abortLoad();
+ virtual bool openFile();
+ virtual bool saveFile();
+
+ virtual void setupActions();
+ void guiActivateEvent( KParts::GUIActivateEvent * );
+
+ void writeSettings();
+
+ protected slots:
+ void readSettings();
+ void zoomChanged( double );
+ void slotJobFinished( KIO::Job * );
+ void slotData( KIO::Job *, const QByteArray & );
+
+ void slotSave();
+ void slotSaveAs();
+ void slotZoomIn();
+ void slotZoomOut();
+ void setZoom( const QString & );
+ void updateZoomMenu( double zoom );
+ void slotFlipH();
+ void slotFlipV();
+ void slotRotateCCW();
+ void slotRotateCW();
+ void slotFitToWin();
+ void slotDel();
+
+ void slotPopupMenu( const QPoint & );
+ void slotResultSaveAs( KIO::Job * );
+
+ void slotFileDirty( const QString & );
+ void slotReloadUnmodified();
+
+ void slotToggleScrollbars();
+
+ void loadPlugins();
+
+ void switchBlendEffect();
+ void hasImage( bool );
+
+ private:
+ QWidget * m_pParentWidget;
+ KIO::Job * m_pJob;
+ KViewKonqExtension * m_pExtension;
+ KImageViewer::Canvas * m_pCanvas;
+ KTempFile * m_pTempFile;
+ QBuffer * m_pBuffer;
+ KDirWatch * m_pFileWatch;
+
+ // Actions:
+ KAction * m_paZoomIn;
+ KAction * m_paZoomOut;
+ KSelectAction * m_paZoom;
+ KActionMenu * m_paFlipMenu;
+ KAction * m_paFlipH;
+ KAction * m_paFlipV;
+ KAction * m_paRotateCCW;
+ KAction * m_paRotateCW;
+ KAction * m_paSave;
+ KAction * m_paSaveAs;
+ KAction * m_paFitToWin;
+ KToggleAction * m_paShowScrollbars;
+
+ QString m_popupDoc;
+ QString m_mimeType;
+ QString m_newMimeType;
+ QString m_sCaption;
+
+ QValueVector<unsigned int> m_vEffects;
+};
+
+// vim:sw=4:ts=4
+
+#endif
diff --git a/kview/kviewviewer/kviewviewer.rc b/kview/kviewviewer/kviewviewer.rc
new file mode 100644
index 00000000..cc36070b
--- /dev/null
+++ b/kview/kviewviewer/kviewviewer.rc
@@ -0,0 +1,36 @@
+<!DOCTYPE kpartgui>
+<kpartgui name="KViewViewer Part" version="6">
+ <MenuBar>
+ <Menu name="file"><text>&amp;File</text>
+ <Action name="file_save" group="save_merge_group"/>
+ <Action name="file_save_as" group="save_merge_group"/>
+ </Menu>
+ <Menu name="edit"><text>&amp;Edit</text>
+ <Action name="flip"/>
+ <Action name="rotateCCW"/>
+ <Action name="rotateCW"/>
+ </Menu>
+ <Menu name="view"><text>&amp;View</text>
+ <Action name="zoomin"/>
+ <Action name="view_zoom"/>
+ <Action name="zoomout"/>
+ <Separator/>
+ <Action name="fittowin"/>
+ </Menu>
+ <Menu name="settings"><text>&amp;Settings</text>
+ <Action name="show_scrollbars" group="show_merge_group" />
+ </Menu>
+ </MenuBar>
+ <ToolBar name="mainToolBar"><text>Main Toolbar</text>
+ <Action name="file_save_as"/>
+ <Action name="zoomin"/>
+ <Action name="view_zoom"/>
+ <Action name="zoomout"/>
+ <Action name="rotateCCW"/>
+ <Action name="rotateCW"/>
+ </ToolBar>
+ <Menu name="popupmenu">
+ <Separator/>
+ <Action name="saveimageas" group="file_group"/>
+ </Menu>
+</kpartgui>
diff --git a/kview/kviewviewer/kviewviewer_ro.rc b/kview/kviewviewer/kviewviewer_ro.rc
new file mode 100644
index 00000000..f266217c
--- /dev/null
+++ b/kview/kviewviewer/kviewviewer_ro.rc
@@ -0,0 +1,34 @@
+<!DOCTYPE kpartgui>
+<kpartgui name="KViewViewer Part" version="7">
+ <MenuBar>
+ <Menu name="file"><text>&amp;File</text>
+ <Action name="file_save_as" group="save_merge_group"/>
+ </Menu>
+ <Menu name="view"><text>&amp;View</text>
+ <Action name="zoomin"/>
+ <Action name="view_zoom"/>
+ <Action name="zoomout"/>
+ <Separator/>
+ <Action name="fittowin"/>
+ <Separator/>
+ <Action name="flip"/>
+ <Action name="rotateCCW"/>
+ <Action name="rotateCW"/>
+ </Menu>
+ <Menu name="settings"><text>&amp;Settings</text>
+ <Action name="show_scrollbars" group="show_merge_group" />
+ </Menu>
+ </MenuBar>
+ <ToolBar name="mainToolBar"><text>Main Toolbar</text>
+ <Action name="file_save_as"/>
+ <Action name="zoomin"/>
+ <Action name="view_zoom"/>
+ <Action name="zoomout"/>
+ <Action name="rotateCCW"/>
+ <Action name="rotateCW"/>
+ </ToolBar>
+ <Menu name="popupmenu">
+ <Separator/>
+ <Action name="saveimageas" group="file_group"/>
+ </Menu>
+</kpartgui>
diff --git a/kview/kviewviewer/kviewvieweriface.h b/kview/kviewviewer/kviewvieweriface.h
new file mode 100644
index 00000000..19a56232
--- /dev/null
+++ b/kview/kviewviewer/kviewvieweriface.h
@@ -0,0 +1,30 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston,
+ MA 02110-1301, USA.
+
+*/
+// $Id$
+
+#ifndef KVIEWVIEWERIFACE_H
+#define KVIEWVIEWERIFACE_H
+
+class KViewViewerIface
+{
+};
+
+#endif // KVIEWVIEWERIFACE_H
+
+// vim: sw=4 ts=4
diff --git a/kview/kviewviewer/printimagesettings.ui b/kview/kviewviewer/printimagesettings.ui
new file mode 100644
index 00000000..4944ef3c
--- /dev/null
+++ b/kview/kviewviewer/printimagesettings.ui
@@ -0,0 +1,190 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>PrintImageSettings</class>
+<author>Matthias Kretz &lt;kretz@kde.org&gt;</author>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>PrintImageSettings</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>167</width>
+ <height>223</height>
+ </rect>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="title">
+ <string>Image Size</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton1</cstring>
+ </property>
+ <property name="text">
+ <string>Fit to page size</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton2</cstring>
+ </property>
+ <property name="text">
+ <string>9x13</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton3</cstring>
+ </property>
+ <property name="text">
+ <string>10x15</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton4</cstring>
+ </property>
+ <property name="text">
+ <string>Manual</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KIntSpinBox">
+ <property name="name">
+ <cstring>kIntSpinBox1</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ <widget class="KIntSpinBox">
+ <property name="name">
+ <cstring>kIntSpinBox2</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>checkBox1</cstring>
+ </property>
+ <property name="text">
+ <string>Center on page</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+</widget>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>qwidget.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+</includehints>
+</UI>
diff --git a/kview/kviewviewer/test/Makefile.am b/kview/kviewviewer/test/Makefile.am
new file mode 100644
index 00000000..605435cc
--- /dev/null
+++ b/kview/kviewviewer/test/Makefile.am
@@ -0,0 +1,9 @@
+INCLUDES = -I$(top_srcdir)/kview $(all_includes)
+
+METASOURCES = AUTO
+
+check_PROGRAMS = test
+
+test_SOURCES = main.cpp test.cpp
+test_LDFLAGS = $(KDE_RPATH) $(all_libraries)
+test_LDADD = $(LIB_KPARTS)
diff --git a/kview/kviewviewer/test/main.cpp b/kview/kviewviewer/test/main.cpp
new file mode 100644
index 00000000..95910126
--- /dev/null
+++ b/kview/kviewviewer/test/main.cpp
@@ -0,0 +1,51 @@
+#include "test.h"
+#include <kapplication.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+
+static const char description[] =
+ I18N_NOOP("KView Viewer Part Test");
+
+static const char version[] = "v0.1";
+
+static KCmdLineOptions options[] =
+{
+ { "+[URL]", I18N_NOOP( "Image to open" ), 0 },
+ KCmdLineLastOption
+};
+
+int main(int argc, char **argv)
+{
+ KAboutData about("kviewviewertest", I18N_NOOP("KView Viewer Test"), version, description, KAboutData::License_GPL, "(C) 2001 Matthias Kretz", 0, 0, "kretz@kde.org");
+ about.addAuthor( "Matthias Kretz", 0, "kretz@kde.org" );
+ KCmdLineArgs::init(argc, argv, &about);
+ KCmdLineArgs::addCmdLineOptions( options );
+ KApplication app;
+
+ if (app.isRestored())
+ RESTORE(Test)
+ else
+ {
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+ if ( args->count() == 0 )
+ {
+ Test *widget = new Test;
+ widget->show();
+ }
+ else
+ {
+ int i = 0;
+ for (; i < args->count(); i++ )
+ {
+ Test *widget = new Test;
+ widget->show();
+ widget->load( args->url( i ) );
+ }
+ }
+ args->clear();
+ }
+
+ return app.exec();
+}
diff --git a/kview/kviewviewer/test/test.cpp b/kview/kviewviewer/test/test.cpp
new file mode 100644
index 00000000..d4659e6c
--- /dev/null
+++ b/kview/kviewviewer/test/test.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2001 Matthias Kretz <kretz@kde.org>
+ */
+
+#include "test.h"
+#include <kimageviewer/viewer.h>
+
+#include <kurl.h>
+#include <klibloader.h>
+#include <kmessagebox.h>
+#include <kparts/componentfactory.h>
+#include <kapplication.h>
+
+#include <qimage.h>
+
+Test::Test()
+ : KParts::MainWindow( 0, "KView Viewer Test" ),
+ m_part( 0 )
+{
+ m_part = KParts::ComponentFactory::createPartInstanceFromQuery<KParts::ReadWritePart>(
+ "image/jpeg", "Name == 'Image Viewer Part'", this, 0, this );
+ if( m_part )
+ {
+ setCentralWidget( m_part->widget() );
+ createGUI( m_part );
+ }
+ else
+ {
+ KMessageBox::error(this, "Could not find our Part!");
+ kapp->quit();
+ }
+}
+
+Test::~Test()
+{
+}
+
+void Test::load(const KURL& url)
+{
+ m_part->openURL( url );
+}
+
+#include "test.moc"
diff --git a/kview/kviewviewer/test/test.h b/kview/kviewviewer/test/test.h
new file mode 100644
index 00000000..82777090
--- /dev/null
+++ b/kview/kviewviewer/test/test.h
@@ -0,0 +1,25 @@
+#ifndef KIMAGEVIEWERTEST_H
+#define KIMAGEVIEWERTEST_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <kapplication.h>
+#include <kparts/mainwindow.h>
+
+namespace KParts { class ReadWritePart; }
+
+class Test : public KParts::MainWindow
+{
+ Q_OBJECT
+public:
+ Test();
+ virtual ~Test();
+ void load(const KURL& url);
+
+private:
+ KParts::ReadWritePart * m_part;
+};
+
+#endif // KIMAGEVIEWERTEST_H
diff --git a/kview/main.cpp b/kview/main.cpp
new file mode 100644
index 00000000..e84bc65d
--- /dev/null
+++ b/kview/main.cpp
@@ -0,0 +1,70 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2003 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#include "kview.h"
+#include "version.h"
+#include <kapplication.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+
+static const char description[] = I18N_NOOP( "KDE Image Viewer" );
+
+static KCmdLineOptions options[] =
+{
+ { "+[URL]", I18N_NOOP( "Image to open" ), 0 },
+ KCmdLineLastOption
+};
+
+extern "C" KDE_EXPORT int kdemain( int argc, char ** argv )
+{
+ KAboutData about( "kview", I18N_NOOP( "KView" ),
+ KVIEW_VERSION, description,
+ KAboutData::License_GPL,
+ I18N_NOOP( "(c) 1997-2002, The KView Developers" ) );
+ about.addAuthor( "Matthias Kretz", I18N_NOOP( "Maintainer" ), "kretz@kde.org" );
+ about.addAuthor( "Sirtaj Singh Kang", I18N_NOOP( "started it all" ), "taj@kde.org" );
+ about.addAuthor( "Simon Hausmann", 0, "hausmann@kde.org" );
+ KCmdLineArgs::init( argc, argv, &about );
+ KCmdLineArgs::addCmdLineOptions( options );
+ KApplication app;
+
+ if( app.isRestored() )
+ RESTORE( KView )
+ else
+ {
+ KCmdLineArgs * args = KCmdLineArgs::parsedArgs();
+
+ KView * kview = new KView;
+ kview->show();
+ // only load image in first url - there's no way I can think of
+ // to tell the presenter plugin to add those urls to it's list
+ if( args->count() > 0 )
+ {
+ if( args->url( 0 ) == QString( "-" ) )
+ kview->loadFromStdin();
+ else
+ kview->load( args->url( 0 ) );
+ }
+ args->clear();
+ }
+
+ return app.exec();
+}
+
+// vim:sw=4:ts=4
diff --git a/kview/modules/Makefile.am b/kview/modules/Makefile.am
new file mode 100644
index 00000000..cfd6a400
--- /dev/null
+++ b/kview/modules/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = scanner presenter browser effects
diff --git a/kview/modules/NAMING b/kview/modules/NAMING
new file mode 100644
index 00000000..d70532ad
--- /dev/null
+++ b/kview/modules/NAMING
@@ -0,0 +1,4 @@
+KView plugins
+=============
+Name: kview_<modulename>.la
+LDFLAGS: -module $(KDE_PLUGIN)
diff --git a/kview/modules/README b/kview/modules/README
new file mode 100644
index 00000000..74c229c0
--- /dev/null
+++ b/kview/modules/README
@@ -0,0 +1,52 @@
+How to write a plugin for KView
+===============================
+
+There are two different kinds of plugins for KView that you may write: KPart
+plugins for KView or the KView KPart (KViewViewer).
+
+
+Writing the Plugin
+==================
+
+You have to derive your plugin from KParts::Plugin and install the rc file under
+the directory "data" (KDEDIR/share/apps/ usually)+"instancename/kpartplugins/"
+(where instancename can be either kview or kviewviewer). If you install it under
+kviewviewer the plugin will be loaded for the KPart (meaning it get's loaded in
+e.g. Konqueror). If you install it under kview it only get's loaded when
+starting the KView application.
+
+The parent that is passed on to your plugin will be a KImageViewer::Viewer
+interface (which is also a KParts::ReadWritePart) if you make it a KViewViewer
+plugin, else you'll be passed a pointer to KView (take a look at the template
+plugin to see how to get to the KImageViewer::Viewer interface).
+
+
+Plugin Desktop file
+===================
+
+Now you need to write a .desktop file for your plugin, containing the name,
+a comment, author, email and plugin name.
+
+Here's a start:
+------------------------------------------------------------------------------
+[Desktop Entry]
+Name=Coolplugin
+Comment=This is a very cool plugin doing foo and bar
+Type=Plugin
+
+[X-KDE Plugin Info]
+Author=Matthias Kretz
+Email=kretz@kde.org
+PluginName=kviewcool
+Version=1.0
+------------------------------------------------------------------------------
+
+The "PluginName" entry needs to be the same as the name attribut in your .rc
+file (<kpartplugin name="kviewcool" library="kview_coolplugin">).
+
+
+Examples
+========
+
+There are a few modules already in the original KView sources. Just take a look
+at kdegraphics/kview/modules/*.
diff --git a/kview/modules/browser/Makefile.am b/kview/modules/browser/Makefile.am
new file mode 100644
index 00000000..001eefd0
--- /dev/null
+++ b/kview/modules/browser/Makefile.am
@@ -0,0 +1,15 @@
+INCLUDES = -I$(top_srcdir)/kview $(all_includes)
+
+kde_module_LTLIBRARIES = kview_browserplugin.la
+
+kview_browserplugin_la_SOURCES = kmyfileitemlist.cpp kviewbrowser.cpp
+kview_browserplugin_la_LIBADD = $(LIB_KFILE) $(LIB_KPARTS) -lkdeprint
+kview_browserplugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+
+plugdir = $(kde_datadir)/kviewviewer/kpartplugins
+plug_DATA = kviewbrowser.desktop kviewbrowser.rc
+
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/kviewbrowserplugin.pot
diff --git a/kview/modules/browser/kmyfileitemlist.cpp b/kview/modules/browser/kmyfileitemlist.cpp
new file mode 100644
index 00000000..534e0876
--- /dev/null
+++ b/kview/modules/browser/kmyfileitemlist.cpp
@@ -0,0 +1,41 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+// $Id$
+
+#include "kmyfileitemlist.h"
+#include <kfileitem.h>
+
+KMyFileItemList::KMyFileItemList() {}
+KMyFileItemList::KMyFileItemList( const QPtrList<KFileItem> & l ) : QPtrList<KFileItem>( l ) {}
+
+KMyFileItemList & KMyFileItemList::operator=( const QPtrList<KFileItem> & l )
+{
+ return (KMyFileItemList &)QPtrList<KFileItem>::operator=( l );
+}
+
+int KMyFileItemList::compareItems( QPtrCollection::Item item1, QPtrCollection::Item item2 )
+{
+ KFileItem * fileitem1 = static_cast<KFileItem *>( item1 );
+ KFileItem * fileitem2 = static_cast<KFileItem *>( item2 );
+ if( fileitem1->name() == fileitem2->name() )
+ return 0;
+ else if( fileitem1->name() > fileitem2->name() )
+ return 1;
+ else
+ return -1;
+}
diff --git a/kview/modules/browser/kmyfileitemlist.h b/kview/modules/browser/kmyfileitemlist.h
new file mode 100644
index 00000000..052fce53
--- /dev/null
+++ b/kview/modules/browser/kmyfileitemlist.h
@@ -0,0 +1,39 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+// $Id$
+
+#ifndef __kmyfileitemlist_h__
+#define __kmyfileitemlist_h__
+
+#include <qptrlist.h>
+class KFileItem;
+
+class KMyFileItemList : public QPtrList<KFileItem>
+{
+ public:
+ KMyFileItemList();
+ KMyFileItemList( const QPtrList<KFileItem> & );
+ KMyFileItemList & operator=( const QPtrList<KFileItem> & );
+
+ protected:
+ virtual int compareItems( QPtrCollection::Item item1, QPtrCollection::Item item2 );
+};
+
+// vim:sw=4:ts=4
+
+#endif
diff --git a/kview/modules/browser/kviewbrowser.cpp b/kview/modules/browser/kviewbrowser.cpp
new file mode 100644
index 00000000..6da318b7
--- /dev/null
+++ b/kview/modules/browser/kviewbrowser.cpp
@@ -0,0 +1,179 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+// $Id$
+
+#include "kviewbrowser.h"
+#include "kmyfileitemlist.h"
+
+#include <qcursor.h>
+
+#include <kdirlister.h>
+#include <kaction.h>
+#include <klocale.h>
+#include <kgenericfactory.h>
+#include <kdebug.h>
+#include <kimageviewer/viewer.h>
+#include <kimageviewer/canvas.h>
+#include <kparts/browserextension.h>
+#include <kapplication.h>
+#include <kimageio.h>
+
+typedef KGenericFactory<KViewBrowser> KViewBrowserFactory;
+K_EXPORT_COMPONENT_FACTORY( kview_browserplugin, KViewBrowserFactory( "kviewbrowserplugin" ) )
+
+KViewBrowser::KViewBrowser( QObject* parent, const char* name, const QStringList & )
+ : Plugin( parent, name )
+ , m_pDirLister( 0 )
+ , m_pFileItemList( 0 )
+ , m_bShowCurrent( false )
+{
+ m_pViewer = static_cast<KImageViewer::Viewer *>( parent );
+ if( m_pViewer )
+ {
+ m_paBack = KStdAction::back ( this, SLOT( slotBack() ), actionCollection(), "previous_image" );
+ m_paBack->setShortcut( SHIFT+Key_Left );
+ m_paForward = KStdAction::forward( this, SLOT( slotForward() ), actionCollection(), "next_image" );
+ m_paForward->setShortcut( SHIFT+Key_Right );
+ m_pExtension = m_pViewer->browserExtension();
+ }
+ else
+ kdWarning( 4630 ) << "no KImageViewer interface found - the browser plugin won't work" << endl;
+}
+
+KViewBrowser::~KViewBrowser()
+{
+ delete m_pDirLister;
+ delete m_pFileItemList;
+}
+
+void KViewBrowser::openURL(const KURL &u)
+{
+ if (m_pViewer)
+ {
+ // Opening new URL resets zoom, so remember it.
+ double oldZoom = m_pViewer->canvas()->zoom();
+ m_pViewer->openURL(u);
+ m_pViewer->canvas()->setZoom(oldZoom);
+ }
+ if( m_pExtension )
+ {
+ emit m_pExtension->setLocationBarURL( u.prettyURL() );
+ }
+}
+
+void KViewBrowser::slotBack()
+{
+ setupDirLister();
+ if( ! m_pFileItemList )
+ return;
+
+ KFileItem * item = m_pFileItemList->prev();
+ if( ! item )
+ item = m_pFileItemList->last();
+ if( item )
+ {
+ kdDebug( 4630 ) << item->url().prettyURL() << endl;
+ openURL( item->url() );
+ }
+ else
+ kdDebug( 4630 ) << "no file found" << endl;
+ m_bShowCurrent = false;
+}
+
+void KViewBrowser::slotForward()
+{
+ setupDirLister();
+ if( ! m_pFileItemList )
+ return;
+
+ KFileItem * item = m_bShowCurrent ? m_pFileItemList->current() : m_pFileItemList->next();
+ if( ! item )
+ item = m_pFileItemList->first();
+ if( item )
+ {
+ kdDebug( 4630 ) << item->url().prettyURL() << endl;
+ openURL( item->url() );
+ }
+ else
+ kdDebug( 4630 ) << "no file found" << endl;
+ m_bShowCurrent = false;
+}
+
+void KViewBrowser::slotNewItems( const KFileItemList & items )
+{
+ kdDebug( 4630 ) << k_funcinfo << endl;
+ delete m_pFileItemList;
+ m_pFileItemList = new KMyFileItemList( items );
+ m_pFileItemList->sort();
+
+ // set the current pointer on the currently open image
+ KFileItem * item = m_pFileItemList->first();
+ for( ; item; item = m_pFileItemList->next() )
+ if( item->url() == m_pViewer->url() )
+ break;
+}
+
+void KViewBrowser::slotDeleteItem( KFileItem * item )
+{
+ bool setToFirst = false;
+ if( m_pFileItemList->current() == item )
+ {
+ // The current image is being removed
+ // we have to take care, that the next slotForward call returns the new current item
+ m_bShowCurrent = true;
+
+ if( m_pFileItemList->getLast() == item )
+ // The the current image is the last image - wrap around to the first
+ setToFirst = true;
+ }
+
+ m_pFileItemList->remove( item );
+
+ if( setToFirst )
+ ( void )m_pFileItemList->first();
+}
+
+void KViewBrowser::setupDirLister()
+{
+ if( ! m_pDirLister )
+ {
+ kdDebug( 4630 ) << "create new KDirLister" << endl;
+ m_pDirLister = new KDirLister();
+ m_pDirLister->setMimeFilter( KImageIO::mimeTypes( KImageIO::Reading ) );
+ m_pDirLister->setShowingDotFiles( true );
+ connect( m_pDirLister, SIGNAL( newItems( const KFileItemList & ) ), SLOT( slotNewItems( const KFileItemList & ) ) );
+ connect( m_pDirLister, SIGNAL( deleteItem( KFileItem * ) ), SLOT( slotDeleteItem( KFileItem * ) ) );
+ }
+ if( m_pDirLister->url() != KURL( m_pViewer->url().directory( true, false ) ) )
+ {
+ QApplication::setOverrideCursor( WaitCursor );
+ QString url = m_pViewer->url().prettyURL();
+ int pos = url.findRev( "/" );
+ url = url.left( (unsigned int)pos );
+ kdDebug( 4630 ) << "open KDirLister for " << url << endl;
+ m_pDirLister->openURL( KURL( url ));
+ while( ! m_pDirLister->isFinished() )
+ kapp->processEvents();
+ //while( ! m_pFileItemList )
+ //kapp->processEvents();
+ QApplication::restoreOverrideCursor();
+ }
+}
+
+// vim:sw=4:ts=4:cindent
+#include "kviewbrowser.moc"
diff --git a/kview/modules/browser/kviewbrowser.desktop b/kview/modules/browser/kviewbrowser.desktop
new file mode 100644
index 00000000..a5b66bcc
--- /dev/null
+++ b/kview/modules/browser/kviewbrowser.desktop
@@ -0,0 +1,130 @@
+[Desktop Entry]
+Icon=browser
+Type=Service
+ServiceTypes=KPluginInfo
+
+X-KDE-PluginInfo-Author=Matthias Kretz
+X-KDE-PluginInfo-Email=kretz@kde.org
+X-KDE-PluginInfo-Name=kviewbrowser
+X-KDE-PluginInfo-Category=General
+X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
+
+Name=Browser
+Name[af]=Blaaier
+Name[ar]=المتصفح
+Name[bg]=Браузър
+Name[br]=Furcher
+Name[bs]=Preglednik
+Name[ca]=Fullejador
+Name[cs]=Prohlížeč
+Name[cy]=Porydd
+Name[el]=Περιηγητής
+Name[eo]=Trair-Rigardilo
+Name[es]=Navegador
+Name[et]=Sirvija
+Name[eu]=Nabegatzailea
+Name[fa]=مرورگر
+Name[fi]=Selain
+Name[fr]=Navigateur
+Name[ga]=Brabhsálaí
+Name[gl]=Explorador
+Name[he]=דפדפן
+Name[hi]=ब्राउज़र
+Name[hr]=Preglednik
+Name[hu]=Böngésző
+Name[is]=Flakkari
+Name[ja]=ブラウザ
+Name[kk]=Шолғыш
+Name[km]=កម្មវិធី​រុករក
+Name[lt]=Naršyklė
+Name[ms]=Pelayar
+Name[nb]=Leser
+Name[nds]=Kieker
+Name[ne]=ब्राउजर
+Name[nl]=Bladeren
+Name[nn]=Snøgglesar
+Name[nso]=Seinyakisi
+Name[pa]=ਝਲਕਾਰਾ
+Name[pl]=Przeglądarka
+Name[pt]=Navegador
+Name[pt_BR]=Navegador
+Name[ro]=Navigator
+Name[ru]=Просмотр
+Name[se]=Bláđđejeaddji
+Name[sk]=Prehliadač
+Name[sl]=Brskalnik
+Name[sr]=Прегледач
+Name[sr@Latn]=Pregledač
+Name[sv]=Bläddrare
+Name[ta]=உலாவி
+Name[tg]=Воқеъанигор
+Name[tr]=Tarayıcı
+Name[uk]=Навігатор
+Name[uz]=Brauzer
+Name[uz@cyrillic]=Браузер
+Name[ven]=Burausa
+Name[wa]=Foyteuse
+Name[xh]=Umkhangeli wencwadi
+Name[zh_CN]=浏览器
+Name[zh_HK]=瀏覽器
+Name[zh_TW]=瀏覽器
+Name[zu]=Umcingi
+Comment=Enables you to browse through all of the images in the current directory.
+Comment[af]=Aktiveer jy na blaai deur alle van die beelde in die huidige gids.
+Comment[ar]=يمكنك من تصفَح كل الصور في الدليل الحالي.
+Comment[bg]=Преглед на изображенията в текущата директория
+Comment[bs]=Omogućuje vam da pregledate sve slike u trenutnom direktoriju.
+Comment[ca]=Us permet navegar entre totes les imatges del directori actual.
+Comment[cs]=Umožňuje procházet všechny obrázky v aktuálním adresáři.
+Comment[cy]=Alluogi i chi bori drwy pob delwedd yn y cyfeiriadur cyfredol.
+Comment[da]=Lader dig gennemse alle billederne i denne mappe.
+Comment[de]=Ermöglicht das Durchsehen der Bilder im aktuellen Ordner.
+Comment[el]=Σας επιτρέπει να περιηγηθείτε σε όλες τις εικόνες στον τρέχον κατάλογο.
+Comment[eo]=Permesas al vi povas trarigardi ĉiujn bildojn en la nuna dosierujo.
+Comment[es]=Le permite navegar por todas las imágenes del directorio actual.
+Comment[et]=Võimaldab sirvida aktiivse kataloogi kõiki pilte.
+Comment[eu]=Uneko direktorioko irudien artean nabigatzen uzten dizu.
+Comment[fa]=برای مرور تمام تصاویر موجود در فهرست راهنمای جاری شما را توانا می‌کند.
+Comment[fi]=Mahdollistaa nykyisessä kansiossa olevien kuvien selailun
+Comment[fr]=Permet de naviguer parmi les images dans le dossier courant.
+Comment[gl]=Permítelle navegar a través de todas as imaxes no directorio actual.
+Comment[he]=מאפשר לך לעיין בכל התמונות שבספריה הנוכחית
+Comment[hi]=मौज़ूदा डिरेक्ट्री के सभी छवियों को ब्राउज़ करने में आपको सक्षम बनाता है.
+Comment[hu]=Lehetővé teszi az aktuális könyvtárban található képek áttekintését, böngészését.
+Comment[is]=Gerir þér kleyft að flakka í öllum myndunum í þessari möppu.
+Comment[it]=Permette di navigare tra le immagini nella directory corrente.
+Comment[ja]=現在のディレクトリのすべての画像をブラウズできるようになります。
+Comment[kk]=Назардағы қапшықтағы барлық кескіндерді шолу құралы.
+Comment[km]=អាច​ឲ្យ​អ្នក​រកមើល​រូបភាព​ទាំងអស់ នៅ​ក្នុង​ថត​បច្ចុប្បន្ន ។
+Comment[lt]=Leidžia jums naršyti visuose paveikslėliuose esamame aplanke.
+Comment[ms]=Membolehkan anda melayar semua imej dalam direktori semasa.
+Comment[nb]=Lar deg bla gjennom alle bildene i den gjeldende katalogen.
+Comment[nds]=Dörkieken vun all Biller binnen den aktuellen Orner.
+Comment[ne]=हालको डाइरेक्टरिमा छविको सबै तिर ब्राउज गर्न तपाईँलाई सक्षम पार्दछ ।
+Comment[nl]=Hiermee kunt u door alle afbeeldingen in de huidige map bladeren.
+Comment[nn]=Let deg bla gjennom alle bileta i ein katalog.
+Comment[nso]=Ego dumelela go inyakisa kago diponagalo kamoka kago tshupetso ya bjale.
+Comment[pl]=Pozwala na przeglądanie wszystkich obrazków w bieżącym katalogu.
+Comment[pt]=Permite-lhe navegar por todas as imagens na directoria actual.
+Comment[pt_BR]=Habilita você a navegar por todas as imagens no diretório atual.
+Comment[ro]=Vă permite să navigaţi prin toate imaginile din directorul curent.
+Comment[ru]=Просмотр всех изображений в текущей папке.
+Comment[se]=Diktá du bláđđet buot govaid čađa dán ozus.
+Comment[sk]=Umožňuje prechádzať mezi obrázkami v aktuálnom priečinku.
+Comment[sl]=Omogoča vam brskanje po vseh slikah v trenutni mapi.
+Comment[sr]=Омогућава вам да прегледате све слике у текућем директоријуму
+Comment[sr@Latn]=Omogućava vam da pregledate sve slike u tekućem direktorijumu
+Comment[sv]=Låter dig bläddra igenom alla bilder i den aktuella katalogen.
+Comment[ta]=நடப்பு அடைவில் உள்ள பிம்பங்களை எல்லாம் பார்க்க முடியும்.
+Comment[tg]=Намоиши тамоми тасвирот дар каталоги ҷорӣ.
+Comment[tr]=Bulunduğunuz dizindeki tüm resimler arasında gezinmenizi sağlar.
+Comment[uk]=Дозволяє навігацію всіх зображень в поточному каталозі.
+Comment[ven]=Ini konisa u tshimbidza kha zwifanyiso zwothe kha tsumbavhulwo ya zwino.
+Comment[wa]=Vos permete di foyter dins totes les imådjes do ridant do moumint.
+Comment[xh]=Ikuvumela ukuba ukwazi ukukhangela yonke imifanekiso kulawulo lwangoku.
+Comment[zh_CN]=使您能够浏览当前目录中的所有图像。
+Comment[zh_HK]=讓您瀏覽當前目錄的所有圖像。
+Comment[zh_TW]=讓您瀏覽目前目錄的所有影像。
+Comment[zu]=Ikuvumela ukuba ucinge ngokwedlulela izithombe ohlwini lwamafayela lwamanje.
diff --git a/kview/modules/browser/kviewbrowser.h b/kview/modules/browser/kviewbrowser.h
new file mode 100644
index 00000000..3ed918b6
--- /dev/null
+++ b/kview/modules/browser/kviewbrowser.h
@@ -0,0 +1,62 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+// $Id$
+
+#ifndef __kviewbrowser_h
+#define __kviewbrowser_h
+
+#include <kparts/plugin.h>
+#include <kfileitem.h>
+
+namespace KImageViewer { class Viewer; }
+
+namespace KParts { class BrowserExtension; }
+class KAction;
+class KDirLister;
+class KMyFileItemList;
+
+class KViewBrowser : public KParts::Plugin
+{
+ Q_OBJECT
+public:
+ KViewBrowser( QObject* parent, const char* name, const QStringList & );
+ virtual ~KViewBrowser();
+
+private slots:
+ void slotBack();
+ void slotForward();
+
+ void slotNewItems( const KFileItemList & );
+ void slotDeleteItem( KFileItem * item );
+
+private:
+ void setupDirLister();
+ void openURL(const KURL &);
+
+ KImageViewer::Viewer * m_pViewer;
+ KDirLister * m_pDirLister;
+ KMyFileItemList * m_pFileItemList;
+ KParts::BrowserExtension * m_pExtension;
+ bool m_bShowCurrent;
+
+ KAction * m_paBack;
+ KAction * m_paForward;
+};
+
+// vim:sw=4:ts=4:cindent
+#endif
diff --git a/kview/modules/browser/kviewbrowser.rc b/kview/modules/browser/kviewbrowser.rc
new file mode 100644
index 00000000..9a57cabb
--- /dev/null
+++ b/kview/modules/browser/kviewbrowser.rc
@@ -0,0 +1,18 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="kviewbrowser" library="kview_browserplugin">
+ <MenuBar>
+ <Menu name="tools"><Text>&amp;Tools</Text>
+ <Action name="previous_image"/>
+ <Action name="next_image"/>
+ </Menu>
+ </MenuBar>
+ <ToolBar name="extraToolBar">
+ <text>Extra Toolbar</text>
+ <Action name="previous_image"/>
+ <Action name="next_image"/>
+ </ToolBar>
+ <Menu name="popupmenu">
+ <Action name="previous_image"/>
+ <Action name="next_image"/>
+ </Menu>
+</kpartplugin>
diff --git a/kview/modules/effects/Makefile.am b/kview/modules/effects/Makefile.am
new file mode 100644
index 00000000..64205856
--- /dev/null
+++ b/kview/modules/effects/Makefile.am
@@ -0,0 +1,15 @@
+INCLUDES = -I$(top_srcdir)/kview $(all_includes)
+
+kde_module_LTLIBRARIES = kview_effectsplugin.la
+
+kview_effectsplugin_la_SOURCES = kvieweffects.cpp
+kview_effectsplugin_la_LIBADD = $(LIB_KFILE) $(LIB_KPARTS) -lkdeprint
+kview_effectsplugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+
+plugdir = $(kde_datadir)/kview/kpartplugins
+plug_DATA = kvieweffects.desktop kvieweffects.rc
+
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/kvieweffectsplugin.pot
diff --git a/kview/modules/effects/kvieweffects.cpp b/kview/modules/effects/kvieweffects.cpp
new file mode 100644
index 00000000..9295c876
--- /dev/null
+++ b/kview/modules/effects/kvieweffects.cpp
@@ -0,0 +1,244 @@
+/* This file is in the public domain */
+
+// $Id$
+
+#include "kvieweffects.h"
+
+#include <qobjectlist.h>
+
+#include <kaction.h>
+#include <klocale.h>
+#include <kgenericfactory.h>
+#include <kdebug.h>
+#include <kimageviewer/viewer.h>
+#include <kimageviewer/canvas.h>
+#include <kdialogbase.h>
+#include <knuminput.h>
+#include <kiconeffect.h>
+#include <qvbox.h>
+#include <kcolorbutton.h>
+#include <kimageeffect.h>
+#include <qlabel.h>
+#include <assert.h>
+
+typedef KGenericFactory<KViewEffects> KViewEffectsFactory;
+K_EXPORT_COMPONENT_FACTORY( kview_effectsplugin, KViewEffectsFactory( "kvieweffectsplugin" ) )
+
+KViewEffects::KViewEffects( QObject* parent, const char* name, const QStringList & )
+ : Plugin( parent, name )
+ , m_gamma( 0.5 ), m_lastgamma( -1.0 )
+ , m_opacity( 50 ), m_lastopacity( -1 )
+ , m_intensity( 50 ), m_lastintensity( -1 )
+ , m_color( white )
+ , m_image( 0 )
+{
+ QObjectList * viewerList = parent->queryList( 0, "KImageViewer Part", false, false );
+ m_pViewer = static_cast<KImageViewer::Viewer *>( viewerList->getFirst() );
+ delete viewerList;
+ if( m_pViewer )
+ {
+ KAction * gammaaction = new KAction( i18n( "&Gamma Correction..." ), 0, 0,
+ this, SLOT( gamma() ),
+ actionCollection(), "plugin_effects_gamma" );
+ KAction * blendaction = new KAction( i18n( "&Blend Color..." ), 0, 0,
+ this, SLOT( blend() ),
+ actionCollection(), "plugin_effects_blend" );
+ KAction * intensityaction = new KAction( i18n( "Change &Intensity (Brightness)..." ), 0, 0,
+ this, SLOT( intensity() ),
+ actionCollection(), "plugin_effects_intensity" );
+ gammaaction->setEnabled( m_pViewer->canvas()->image() != 0 );
+ blendaction->setEnabled( m_pViewer->canvas()->image() != 0 );
+ intensityaction->setEnabled( m_pViewer->canvas()->image() != 0 );
+ connect( m_pViewer->widget(), SIGNAL( hasImage( bool ) ), gammaaction, SLOT( setEnabled( bool ) ) );
+ connect( m_pViewer->widget(), SIGNAL( hasImage( bool ) ), blendaction, SLOT( setEnabled( bool ) ) );
+ connect( m_pViewer->widget(), SIGNAL( hasImage( bool ) ), intensityaction, SLOT( setEnabled( bool ) ) );
+ }
+ else
+ kdWarning( 4630 ) << "no KImageViewer interface found - the effects plugin won't work" << endl;
+}
+
+KViewEffects::~KViewEffects()
+{
+ // no need to delete m_image here since it will always be NULL at this
+ // point.
+ assert( m_image == 0 );
+}
+
+void KViewEffects::intensity()
+{
+ KDialogBase dlg( m_pViewer->widget(), "Intensity Dialog", true /*modal*/, i18n( "Change Intensity" ), KDialogBase::Ok | KDialogBase::Try | KDialogBase::Cancel );
+ connect( &dlg, SIGNAL( tryClicked() ), this, SLOT( applyIntensity() ) );
+
+ QVBox * vbox = new QVBox( &dlg );
+ vbox->setSpacing( KDialog::spacingHint() );
+ dlg.setMainWidget( vbox );
+ KIntNumInput * percent = new KIntNumInput( vbox, "Intensity Input" );
+ percent->setRange( 0, 100, 1, true );
+ percent->setValue( m_intensity );
+ percent->setLabel( i18n( "&Intensity:" ) );
+ percent->setSuffix( QString::fromAscii( "%" ) );
+ connect( percent, SIGNAL( valueChanged( int ) ), this, SLOT( setIntensity( int ) ) );
+
+ int result = dlg.exec();
+ if( result == QDialog::Accepted )
+ {
+ applyIntensity();
+ m_pViewer->setModified( true );
+ }
+ else
+ if( m_image )
+ m_pViewer->canvas()->setImage( *m_image );
+ m_lastintensity = -1;
+ delete m_image;
+ m_image = 0;
+}
+
+void KViewEffects::setIntensity( int intensity )
+{
+ m_intensity = intensity;
+}
+
+void KViewEffects::applyIntensity()
+{
+ kdDebug( 4630 ) << k_funcinfo << endl;
+ if( m_intensity == m_lastintensity )
+ return; // nothing to do
+
+ QImage * work = workImage();
+ if( work )
+ {
+ KImageEffect::intensity( *work, m_intensity * 0.01 );
+ m_pViewer->canvas()->setImage( *work );
+ delete work;
+ m_lastintensity = m_intensity;
+ }
+}
+
+void KViewEffects::blend()
+{
+ KDialogBase dlg( m_pViewer->widget(), "Blend Color Dialog", true /*modal*/, i18n( "Blend Color" ), KDialogBase::Ok | KDialogBase::Try | KDialogBase::Cancel );
+ connect( &dlg, SIGNAL( tryClicked() ), this, SLOT( applyBlend() ) );
+
+ QVBox * vbox = new QVBox( &dlg );
+ vbox->setSpacing( KDialog::spacingHint() );
+ dlg.setMainWidget( vbox );
+ KIntNumInput * opacity = new KIntNumInput( vbox, "Opacity Input" );
+ opacity->setRange( 0, 100, 1, true );
+ opacity->setValue( m_opacity );
+ opacity->setLabel( i18n( "O&pacity:" ) );
+ opacity->setSuffix( QString::fromAscii( "%" ) );
+ connect( opacity, SIGNAL( valueChanged( int ) ), this, SLOT( setOpacity( int ) ) );
+ QLabel * label = new QLabel( i18n( "Blend c&olor:" ), vbox );
+ KColorButton * color = new KColorButton( m_color, vbox, "Color Input Button" );
+ label->setBuddy( color );
+ connect( color, SIGNAL( changed( const QColor & ) ), this, SLOT( setColor( const QColor & ) ) );
+
+ int result = dlg.exec();
+ if( result == QDialog::Accepted )
+ {
+ applyBlend();
+ m_pViewer->setModified( true );
+ }
+ else
+ if( m_image )
+ m_pViewer->canvas()->setImage( *m_image );
+ m_lastopacity = -1;
+ delete m_image;
+ m_image = 0;
+}
+
+void KViewEffects::setOpacity( int opacity )
+{
+ m_opacity = opacity;
+}
+
+void KViewEffects::setColor( const QColor & color )
+{
+ m_color = color;
+}
+
+void KViewEffects::applyBlend()
+{
+ if( m_opacity == m_lastopacity )
+ return; // nothing to do
+
+ QImage * work = workImage();
+ if( work )
+ {
+ KImageEffect::blend( m_color, *work, m_opacity * 0.01 );
+ m_pViewer->canvas()->setImage( *work );
+ delete work;
+ m_lastopacity = m_opacity;
+ }
+}
+
+void KViewEffects::gamma()
+{
+ KDialogBase dlg( m_pViewer->widget(), "Gamma Correction Dialog", true /*modal*/, i18n( "Gamma Correction" ), KDialogBase::Ok | KDialogBase::Try | KDialogBase::Cancel );
+ connect( &dlg, SIGNAL( tryClicked() ), this, SLOT( applyGammaCorrection() ) );
+
+ // create dialog
+ KDoubleNumInput * gammavalue = new KDoubleNumInput( 0.0, 1.0, 0.5, 0.01, 4, &dlg, "Gamma value input" );
+ gammavalue->setRange( 0.0, 1.0, 0.01, true );
+ connect( gammavalue, SIGNAL( valueChanged( double ) ), this, SLOT( setGammaValue( double ) ) );
+ gammavalue->setLabel( i18n( "Gamma value:" ) );
+ dlg.setMainWidget( gammavalue );
+
+ int result = dlg.exec();
+ if( result == QDialog::Accepted )
+ {
+ // apply gamma correction
+ applyGammaCorrection();
+ m_pViewer->setModified( true );
+ }
+ else
+ {
+ if( m_image )
+ m_pViewer->canvas()->setImage( *m_image );
+ }
+ m_lastgamma = -1;
+ delete m_image;
+ m_image = 0;
+}
+
+void KViewEffects::setGammaValue( double gamma )
+{
+ m_gamma = gamma;
+ kdDebug( 4630 ) << "m_gamma = " << m_gamma << endl;
+ // TODO: show effect on the fly if requested
+}
+
+void KViewEffects::applyGammaCorrection()
+{
+ if( m_gamma == m_lastgamma )
+ return; // nothing to do
+
+ QImage * corrected = workImage();
+ if( corrected )
+ {
+ KIconEffect::toGamma( *corrected, m_gamma );
+ m_pViewer->canvas()->setImage( *corrected );
+ delete corrected;
+ m_lastgamma = m_gamma;
+ }
+}
+
+inline QImage * KViewEffects::workImage()
+{
+ if( ! m_image )
+ {
+ const QImage * canvasimage = m_pViewer->canvas()->image();
+ if( canvasimage )
+ m_image = new QImage( *canvasimage );
+ }
+ if( m_image )
+ {
+ QImage * changed = new QImage( *m_image );
+ changed->detach();
+ return changed;
+ }
+ return 0;
+}
+
+// vim:sw=4:ts=4:cindent
+#include "kvieweffects.moc"
diff --git a/kview/modules/effects/kvieweffects.desktop b/kview/modules/effects/kvieweffects.desktop
new file mode 100644
index 00000000..1f13781d
--- /dev/null
+++ b/kview/modules/effects/kvieweffects.desktop
@@ -0,0 +1,119 @@
+[Desktop Entry]
+Icon=effects
+Type=Service
+ServiceTypes=KPluginInfo
+
+X-KDE-PluginInfo-Author=Matthias Kretz
+X-KDE-PluginInfo-Email=kretz@kde.org
+X-KDE-PluginInfo-Name=kvieweffects
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=false
+
+Name=Effects
+Name[ar]=مؤثرات
+Name[bg]=Ефекти
+Name[bs]=Efekti
+Name[ca]=Efectes
+Name[cs]=Efekty
+Name[cy]=Effeithiau
+Name[da]=Effekter
+Name[de]=Effekte
+Name[el]=Εφέ
+Name[eo]=Efektoj
+Name[es]=Efectos
+Name[et]=Efektid
+Name[eu]=Efectuak
+Name[fa]=اثرها
+Name[fi]=Tehosteet
+Name[fr]=Effets
+Name[ga]=Maisíochtaí
+Name[gl]=Efectos
+Name[he]=אפקטים
+Name[hi]=प्रभाव
+Name[hu]=Effektusok
+Name[is]=Brellur
+Name[it]=Effetti
+Name[ja]=効果
+Name[kk]=Эффекттері
+Name[km]=បែបផែន
+Name[lt]=Efektai
+Name[ms]=Kesan
+Name[nb]=Effekter
+Name[nds]=Effekten
+Name[ne]=असर
+Name[nl]=Effecten
+Name[nn]=Effektar
+Name[pa]=ਪ੍ਰਭਾਵ
+Name[pl]=Efekty
+Name[pt]=Efeitos
+Name[pt_BR]=Efeitos
+Name[ro]=Efecte
+Name[ru]=Эффекты
+Name[sk]=Efekty
+Name[sl]=Učinki
+Name[sr]=Ефекти
+Name[sr@Latn]=Efekti
+Name[sv]=Effekter
+Name[ta]=விளைவுகள்
+Name[tg]=Воситаҳо
+Name[tr]=Efektler
+Name[uk]=Ефекти
+Name[uz]=Effektlar
+Name[uz@cyrillic]=Эффектлар
+Name[wa]=Efets
+Name[zh_CN]=特效
+Name[zh_HK]=效果
+Name[zh_TW]=特效
+Comment=Provides some image effects
+Comment[ar]=يقدم بعض مؤثرات الصور
+Comment[bg]=Визуални ефекти при зареждане на изображенията
+Comment[bs]=Pruža neke efekte za slike
+Comment[ca]=Proporciona alguns efectes d'imatges
+Comment[cs]=Poskytuje několik efektů pro obrázky
+Comment[cy]=Darparu rhai effeithiau delwedd
+Comment[da]=Sørger for nogle billedeffekter
+Comment[de]=Stellt einige Bildverarbeitungseffekte zur Verfügung
+Comment[el]=Παρέχει μερικά εφέ εικόνας
+Comment[eo]=Provizas kelkajn bildefektojn
+Comment[es]=Proporciona alguno efectos para imágenes
+Comment[et]=Mõned pildiefektid
+Comment[eu]=Irudi efektu batzuk eskuratzen ditu
+Comment[fa]=برخی اثرهای تصویر را فراهم می‌کند
+Comment[fi]=Tarjoaa joitain kuvatehosteita
+Comment[fr]=Fournit des effets sur les images
+Comment[gl]=Proporciona algúns efectos para as imaxes
+Comment[he]=מספק מספר אפקטים עבור תמונות
+Comment[hi]=छवि में प्रभाव उत्पन्न करता है
+Comment[hu]=Képeffektusok használata
+Comment[is]=Býður uppá ýmsar myndbrellur
+Comment[it]=Fornisce alcuni effetti per le immagini
+Comment[ja]=画像効果を提供します
+Comment[kk]=Кескіндердің кейбір эффектерін іске асыру
+Comment[km]=ផ្ដល់​នូវ​បែបផែន​រូបភាព​មួយ​ចំនួន
+Comment[lt]=Prideda kai kuriuos paveikslėlių efektus
+Comment[ms]=Menyediakan beberapa kesan imej
+Comment[nb]=Utfører noen effekter på bilder
+Comment[nds]=Stellt en poor Bildeffekten praat
+Comment[ne]=केही छवि असर प्रदान गर्दछ
+Comment[nl]=Biedt enkele effecten om afbeeldingen te bewerken
+Comment[nn]=Utfører nokre effektar på bilete
+Comment[pl]=Dodaje kilka efektów do obrazków
+Comment[pt]=Fornece alguns efeitos de imagem
+Comment[pt_BR]=Fornece alguns efeitos de imagem
+Comment[ro]=Oferă unele efecte pentru imagini
+Comment[ru]=Некоторые эффекты обработки изображений
+Comment[sk]=Poskytuje niektoré efekty pre obrázky
+Comment[sl]=Prinaša nekaj učinkov za slike
+Comment[sr]=Пружа неке сликовне ефекте
+Comment[sr@Latn]=Pruža neke slikovne efekte
+Comment[sv]=Tillhandahåller vissa bildeffekter
+Comment[ta]=சில பிம்ப விளைவுகளை தருகிறது
+Comment[tg]=Якчанд воситаҳои коркарди тасвирот
+Comment[tr]=Resim efektleri oluşturur
+Comment[uk]=Надає деякі ефекти зображень
+Comment[uz]=Rasm effektlari
+Comment[uz@cyrillic]=Расм эффектлари
+Comment[zh_CN]=提供某些图像特效
+Comment[zh_HK]=提供一些圖像效果
+Comment[zh_TW]=提供影像特效
diff --git a/kview/modules/effects/kvieweffects.h b/kview/modules/effects/kvieweffects.h
new file mode 100644
index 00000000..0bf92a8e
--- /dev/null
+++ b/kview/modules/effects/kvieweffects.h
@@ -0,0 +1,46 @@
+/* This file is in the public domain */
+
+// $Id$
+
+#ifndef KVIEWEFFECTS_H
+#define KVIEWEFFECTS_H
+
+#include <kparts/plugin.h>
+#include <qcolor.h>
+
+namespace KImageViewer { class Viewer; }
+
+class KViewEffects : public KParts::Plugin
+{
+ Q_OBJECT
+public:
+ KViewEffects( QObject* parent, const char* name, const QStringList & );
+ virtual ~KViewEffects();
+
+private slots:
+ void intensity();
+ void setIntensity( int );
+ void applyIntensity();
+
+ void blend();
+ void setOpacity( int );
+ void setColor( const QColor & );
+ void applyBlend();
+
+ void gamma();
+ void setGammaValue( double );
+ void applyGammaCorrection();
+
+private:
+ QImage * workImage();
+
+ KImageViewer::Viewer * m_pViewer;
+ double m_gamma, m_lastgamma;
+ int m_opacity, m_lastopacity;
+ int m_intensity, m_lastintensity;
+ QColor m_color;
+ QImage * m_image;
+};
+
+// vim:sw=4:ts=4:cindent
+#endif // KVIEWEFFECTS_H
diff --git a/kview/modules/effects/kvieweffects.rc b/kview/modules/effects/kvieweffects.rc
new file mode 100644
index 00000000..d0c4eda6
--- /dev/null
+++ b/kview/modules/effects/kvieweffects.rc
@@ -0,0 +1,10 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="kvieweffects" library="kview_effectsplugin" version="2">
+ <MenuBar>
+ <Menu name="effects"><Text>Effe&amp;cts</Text>
+ <Action name="plugin_effects_gamma"/>
+ <Action name="plugin_effects_blend"/>
+ <Action name="plugin_effects_intensity"/>
+ </Menu>
+ </MenuBar>
+</kpartplugin>
diff --git a/kview/modules/presenter/DESIGN b/kview/modules/presenter/DESIGN
new file mode 100644
index 00000000..11d77121
--- /dev/null
+++ b/kview/modules/presenter/DESIGN
@@ -0,0 +1,42 @@
+Presenter Plugin:
+- Features:
+ - a playlist with image infos:
+ - possibly get info from KFileMetaInfo
+ - image infos are readable for the user
+ - image infos for the program
+ - keeps track of images that were opened
+ - new action to load multiple files into the 'playlist'
+ - shuffle functions:
+ - shuffle the playlist
+ - load a random picture from the list (don't show the same image
+ again, though)
+ - order the items in the list via DnD
+ - order items alphabetically
+ - slideshow:
+ - configurable interval between images (in msecs)
+ - blending effects (put those effects in the imagecanvas)
+ - optionally keep image size <= canvas size
+ - preload next image (optionally)
+
+- Implementation:
+ - Playlist:
+ - KListView
+ - Items:
+ - derived from KListViewItem
+ - load Info in the background
+ - keep local copy of downloaded files
+ - delete local copy on destruction
+ - API:
+ QImage * image();
+ KURL url();
+ QString file(); //returns local filename or QString::null
+ - when loading an item from the playlist first ask for a
+ QImage, if that's not available ask for a local file, if
+ that's also not available take the url.
+ - API:
+ QImage * image();
+ QString file();
+ KURL url();
+ void setRandom(bool);
+ void randomizeList();
+ void orderAlphabetically();
diff --git a/kview/modules/presenter/Makefile.am b/kview/modules/presenter/Makefile.am
new file mode 100644
index 00000000..905bd1fc
--- /dev/null
+++ b/kview/modules/presenter/Makefile.am
@@ -0,0 +1,17 @@
+SUBDIRS = .
+
+INCLUDES = -I$(top_srcdir)/kview $(all_includes)
+
+kde_module_LTLIBRARIES = kview_presenterplugin.la
+
+kview_presenterplugin_la_SOURCES = imagelistitem.cpp imagelistdialog.ui kviewpresenter.cpp
+kview_presenterplugin_la_LIBADD = $(LIB_KIO) $(LIB_KPARTS)
+kview_presenterplugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+
+plugdir = $(kde_datadir)/kview/kpartplugins
+plug_DATA = kviewpresenter.desktop kviewpresenter.rc
+
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/kviewpresenterplugin.pot
diff --git a/kview/modules/presenter/config/Makefile.am b/kview/modules/presenter/config/Makefile.am
new file mode 100644
index 00000000..8c212e7f
--- /dev/null
+++ b/kview/modules/presenter/config/Makefile.am
@@ -0,0 +1,17 @@
+INCLUDES = $(all_includes)
+
+kde_module_LTLIBRARIES = kcm_kviewpresenterconfig.la
+
+noinst_HEADERS = kviewpresenterconfig.h
+
+kcm_kviewpresenterconfig_la_SOURCES = kviewpresenterconfig.cpp
+kcm_kviewpresenterconfig_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+kcm_kviewpresenterconfig_la_LIBADD = $(LIB_KUTILS)
+
+kcm_kviewpresenterconfig_DATA = kviewpresenterconfig.desktop
+kcm_kviewpresenterconfigdir = $(kde_servicesdir)/kconfiguredialog
+
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/kcm_kviewpresenterconfig.pot
diff --git a/kview/modules/presenter/config/kviewpresenterconfig.cpp b/kview/modules/presenter/config/kviewpresenterconfig.cpp
new file mode 100644
index 00000000..92dd8627
--- /dev/null
+++ b/kview/modules/presenter/config/kviewpresenterconfig.cpp
@@ -0,0 +1,72 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2003 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#include "kviewpresenterconfig.h"
+
+#include <qlayout.h>
+#include <qcheckbox.h>
+#include <qframe.h>
+
+#include <klocale.h>
+#include <kdialog.h>
+#include <kglobal.h>
+#include <kconfig.h>
+#include <kgenericfactory.h>
+
+typedef KGenericFactory<KViewPresenterConfig, QWidget> KViewPresenterConfigFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_kviewpresenterconfig, KViewPresenterConfigFactory( "kcm_kviewpresenterconfig" ) )
+
+KViewPresenterConfig::KViewPresenterConfig( QWidget * parent, const char *, const QStringList & args )
+ : KCModule( KViewPresenterConfigFactory::instance(), parent, args )
+{
+ QBoxLayout * layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() );
+ layout->setAutoAdd( true );
+
+ m_pCheckBox = new QCheckBox( "This is only for testing...", this );
+ connect( m_pCheckBox, SIGNAL( clicked() ), this, SLOT( checkChanged() ) );
+}
+
+KViewPresenterConfig::~KViewPresenterConfig()
+{
+}
+
+void KViewPresenterConfig::checkChanged()
+{
+ if( m_pCheckBox->isChecked() )
+ emit changed( true );
+ else
+ emit changed( false );
+}
+
+void KViewPresenterConfig::load()
+{
+ emit changed( false );
+}
+
+void KViewPresenterConfig::save()
+{
+ emit changed( false );
+}
+
+void KViewPresenterConfig::defaults()
+{
+}
+
+// vim:sw=4:ts=4
+
+#include "kviewpresenterconfig.moc"
diff --git a/kview/modules/presenter/config/kviewpresenterconfig.desktop b/kview/modules/presenter/config/kviewpresenterconfig.desktop
new file mode 100644
index 00000000..77bb3481
--- /dev/null
+++ b/kview/modules/presenter/config/kviewpresenterconfig.desktop
@@ -0,0 +1,120 @@
+[Desktop Entry]
+Icon=kpresenter
+Type=Service
+ServiceTypes=KCModule
+
+X-KDE-ModuleType=Library
+X-KDE-Library=kviewpresenterconfig
+X-KDE-FactoryName=KViewPresenterConfigFactory
+X-KDE-ParentComponents=kviewpresenter
+
+Name=Name
+Name[ar]=اسم
+Name[bg]=Име
+Name[br]=Anv
+Name[bs]=Ime
+Name[ca]=Nom
+Name[cy]=Enw
+Name[da]=Navn
+Name[el]=Όνομα
+Name[eo]=Nomo
+Name[es]=Nombre
+Name[et]=Nimi
+Name[eu]=Izena
+Name[fa]=نام
+Name[fi]=Nimi
+Name[fr]=Nom
+Name[ga]=Ainm
+Name[gl]=Nome
+Name[he]=שם
+Name[hi]=नाम
+Name[hu]=Név
+Name[is]=Heiti
+Name[it]=Nome
+Name[ja]=名前
+Name[kk]=Атауы
+Name[km]=ឈ្មោះ
+Name[lt]=Pavadinimas
+Name[ms]=Nama
+Name[nb]=Navn
+Name[nds]=Naam
+Name[ne]=नाम
+Name[nl]=Naam
+Name[nn]=Namn
+Name[pa]=ਨਾਂ
+Name[pl]=Nazwa
+Name[pt]=Nome
+Name[pt_BR]=Nome
+Name[ro]=Nume
+Name[ru]=Имя
+Name[se]=Namma
+Name[sk]=Meno
+Name[sl]=Ime
+Name[sr]=Име
+Name[sr@Latn]=Ime
+Name[sv]=Namn
+Name[ta]=பெயர்
+Name[tg]=Ном
+Name[uk]=Назва
+Name[uz]=Nomi
+Name[uz@cyrillic]=Номи
+Name[wa]=No
+Name[zh_CN]=名称
+Name[zh_HK]=名稱
+Name[zh_TW]=名稱
+Comment=Comment
+Comment[ar]=تعليق
+Comment[bg]=Коментар
+Comment[br]=Askelenn
+Comment[bs]=Komentar
+Comment[ca]=Comentari
+Comment[cy]=Sylwad
+Comment[da]=Kommentar
+Comment[de]=Kommentar
+Comment[el]=Σχόλιο
+Comment[eo]=Komento
+Comment[es]=Comentario
+Comment[et]=Kommentaar
+Comment[eu]=Iruzkina
+Comment[fa]=توضیح
+Comment[fi]=Kommentti
+Comment[fr]=Commentaire
+Comment[ga]=Nóta
+Comment[gl]=Comentario
+Comment[he]=הערה
+Comment[hi]=टिप्पणी
+Comment[hu]=Megjegyzés
+Comment[is]=Athugasemd
+Comment[it]=Commento
+Comment[ja]=コメント
+Comment[kk]=Түсініктемесі
+Comment[km]=សេចក្ដី​អធិប្បាយ
+Comment[lt]=Komentaras
+Comment[ms]=Komen
+Comment[nb]=Kommentar
+Comment[nds]=Kommentar
+Comment[ne]=टिप्पणी
+Comment[nl]=Omschrijving
+Comment[nn]=Kommentar
+Comment[pa]=ਟਿੱਪਣੀ
+Comment[pl]=Komentarz
+Comment[pt]=Comentário
+Comment[pt_BR]=Comentário
+Comment[ro]=Comentariu
+Comment[ru]=Комментарий
+Comment[se]=Kommeanta
+Comment[sk]=Komentár
+Comment[sl]=Komentar
+Comment[sr]=Коментар
+Comment[sr@Latn]=Komentar
+Comment[sv]=Kommentar
+Comment[ta]=குறிப்பு
+Comment[tg]=Эзоҳ
+Comment[tr]=Açıklama
+Comment[uk]=Коментар
+Comment[uz]=Izoh
+Comment[uz@cyrillic]=Изоҳ
+Comment[wa]=Rawete
+Comment[zh_CN]=注释
+Comment[zh_HK]=註解
+Comment[zh_TW]=註解
diff --git a/kview/modules/presenter/config/kviewpresenterconfig.h b/kview/modules/presenter/config/kviewpresenterconfig.h
new file mode 100644
index 00000000..c839690a
--- /dev/null
+++ b/kview/modules/presenter/config/kviewpresenterconfig.h
@@ -0,0 +1,46 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2003 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef KVIEWPRESENTERCONFIG_H
+#define KVIEWPRESENTERCONFIG_H
+
+#include <kcmodule.h>
+
+class QCheckBox;
+
+class KViewPresenterConfig : public KCModule
+{
+ Q_OBJECT
+ public:
+ KViewPresenterConfig( QWidget * parent, const char * name = 0, const QStringList & args = QStringList() );
+ ~KViewPresenterConfig();
+
+ virtual void load();
+ virtual void save();
+ virtual void defaults();
+
+ private slots:
+ void checkChanged();
+
+ private:
+ QCheckBox * m_pCheckBox;
+};
+
+// vim:sw=4:ts=4
+
+#endif // KVIEWPRESENTERCONFIG_H
diff --git a/kview/modules/presenter/imagelistdialog.ui b/kview/modules/presenter/imagelistdialog.ui
new file mode 100644
index 00000000..66d9e9b5
--- /dev/null
+++ b/kview/modules/presenter/imagelistdialog.ui
@@ -0,0 +1,289 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>ImageListDialog</class>
+<author>Matthias Kretz &lt;kretz@kde.org&gt;</author>
+<widget class="KDialog">
+ <property name="name">
+ <cstring>ImageListDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>724</width>
+ <height>409</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Image List</string>
+ </property>
+ <property name="acceptDrops">
+ <bool>true</bool>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>URL</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Size</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Dimensions</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>m_pListView</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>400</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="acceptDrops">
+ <bool>true</bool>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="showSortIndicator">
+ <bool>true</bool>
+ </property>
+ <property name="fullWidth">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_pPrevious</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Previous</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_pNext</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Next</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_pShuffle</cstring>
+ </property>
+ <property name="text">
+ <string>Shu&amp;ffle</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_pSlideshow</cstring>
+ </property>
+ <property name="text">
+ <string>Start &amp;Slideshow</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="KIntNumInput">
+ <property name="name">
+ <cstring>m_pInterval</cstring>
+ </property>
+ <property name="label">
+ <string>Slideshow interval:</string>
+ </property>
+ <property name="value">
+ <number>5000</number>
+ </property>
+ <property name="suffix">
+ <string> ms</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This is the interval the program will wait before showing the next image in the slideshow.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>MinimumExpanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>80</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_pCloseAll</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Close All</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_pSave</cstring>
+ </property>
+ <property name="text">
+ <string>Sa&amp;ve List...</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_pLoad</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Load List...</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>m_pListView</sender>
+ <signal>aboutToMove()</signal>
+ <receiver>ImageListDialog</receiver>
+ <slot>noSort()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="global" impldecl="in declaration">kdialog.h</include>
+ <include location="global" impldecl="in implementation">kdebug.h</include>
+ <include location="global" impldecl="in implementation">kimageviewer/viewer.h</include>
+ <include location="global" impldecl="in implementation">kio/netaccess.h</include>
+ <include location="global" impldecl="in implementation">kurl.h</include>
+ <include location="global" impldecl="in implementation">kfiledialog.h</include>
+ <include location="global" impldecl="in implementation">qstring.h</include>
+ <include location="global" impldecl="in implementation">kmessagebox.h</include>
+ <include location="local" impldecl="in implementation">imagelistitem.h</include>
+ <include location="local" impldecl="in implementation">imagelistdialog.ui.h</include>
+</includes>
+<forwards>
+ <forward>class KURL</forward>
+</forwards>
+<slots>
+ <slot access="private" specifier="non virtual">init()</slot>
+ <slot specifier="non virtual">noSort()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>kdialog.h</includehint>
+ <includehint>klistview.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/kview/modules/presenter/imagelistdialog.ui.h b/kview/modules/presenter/imagelistdialog.ui.h
new file mode 100644
index 00000000..ce97754e
--- /dev/null
+++ b/kview/modules/presenter/imagelistdialog.ui.h
@@ -0,0 +1,23 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename slots use Qt Designer which will
+** update this file, preserving your code. Create an init() slot in place of
+** a constructor, and a destroy() slot in place of a destructor.
+*****************************************************************************/
+
+void ImageListDialog::init()
+{
+ kdDebug( 4630 ) << k_funcinfo << endl;
+ m_pInterval->setRange( 0, 60000, 1000 );
+ noSort();
+}
+
+
+void ImageListDialog::noSort()
+{
+ kdDebug( 4630 ) << k_funcinfo << endl;
+ m_pListView->setSorting( 1000 );
+}
+
+
diff --git a/kview/modules/presenter/imagelistitem.cpp b/kview/modules/presenter/imagelistitem.cpp
new file mode 100644
index 00000000..4236dfe7
--- /dev/null
+++ b/kview/modules/presenter/imagelistitem.cpp
@@ -0,0 +1,82 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+// $Id$
+
+#include "imagelistitem.h"
+
+#include <qimage.h>
+
+#include <klistview.h>
+
+ImageListItem::ImageListItem( KListView * parent, const KURL & url )
+ : KListViewItem( parent, parent->lastItem(), url.prettyURL() )
+ , m_pImage( 0 )
+ , m_filename( QString::null )
+ , m_url( url )
+{
+ setDragEnabled( true );
+ if( m_url.isLocalFile() )
+ {
+ m_filename = m_url.path();
+ }
+ else
+ {
+ // download file
+ /*
+ QString extension;
+ QString fileName = m_url.fileName();
+ int extensionPos = fileName.findRev( '.' );
+ if ( extensionPos != -1 )
+ extension = fileName.mid( extensionPos ); // keep the '.'
+ delete m_pTempFile;
+ m_pTempFile = new KTempFile( QString::null, extension );
+ m_filename = m_pTempFile->name();
+
+ m_pJob = KIO::get( m_url, m_pExtension->urlArgs().reload, false );
+ */
+ }
+}
+
+ImageListItem::~ImageListItem()
+{
+ if( ! m_url.isLocalFile() )
+ {
+ // remove downloaded tempfile
+ //KIO::NetAccess::removeTempFile( m_filename );
+ }
+}
+
+const QImage * ImageListItem::image() const
+{
+ return m_pImage;
+}
+
+const QString & ImageListItem::file() const
+{
+ if( m_url.isLocalFile() )
+ return QString::null;
+ return m_filename;
+}
+
+const KURL & ImageListItem::url() const
+{
+ return m_url;
+}
+
+// vim:sw=4:ts=4
diff --git a/kview/modules/presenter/imagelistitem.h b/kview/modules/presenter/imagelistitem.h
new file mode 100644
index 00000000..63761af8
--- /dev/null
+++ b/kview/modules/presenter/imagelistitem.h
@@ -0,0 +1,49 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+// $Id$
+
+#ifndef IMAGELISTITEM_H
+#define IMAGELISTITEM_H
+
+#include <klistview.h>
+#include <kurl.h>
+#include <qstring.h>
+
+class QImage;
+
+class ImageListItem : public KListViewItem
+{
+ public:
+ ImageListItem( KListView * parent, const KURL & url );
+ ~ImageListItem();
+
+ const QImage * image() const;
+ const QString & file() const;
+ const KURL & url() const;
+
+ virtual int rtti() const { return 48294; }
+
+ private:
+ QImage * m_pImage;
+ QString m_filename;
+ KURL m_url;
+};
+
+// vim:sw=4:ts=4
+#endif // IMAGELISTITEM_H
diff --git a/kview/modules/presenter/kviewpresenter.cpp b/kview/modules/presenter/kviewpresenter.cpp
new file mode 100644
index 00000000..bbc5e8eb
--- /dev/null
+++ b/kview/modules/presenter/kviewpresenter.cpp
@@ -0,0 +1,492 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+/* $Id$ */
+
+#include "kviewpresenter.h"
+#include "imagelistdialog.h"
+#include "imagelistitem.h"
+
+#include <qvbox.h>
+#include <qobjectlist.h>
+#include <qsignalslotimp.h>
+#include <qtimer.h>
+#include <qevent.h>
+#include <qdragobject.h>
+#include <qstringlist.h>
+
+#include <kpushbutton.h>
+#include <kapplication.h>
+#include <kaction.h>
+#include <klocale.h>
+#include <kgenericfactory.h>
+#include <kdebug.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+#include <knuminput.h>
+#include <kfiledialog.h>
+#include <kimageio.h>
+#include <kimageviewer/viewer.h>
+#include <kimageviewer/canvas.h>
+#include <kio/netaccess.h>
+#include <kmessagebox.h>
+#include <ktempfile.h>
+#include <kurldrag.h>
+
+typedef KGenericFactory<KViewPresenter> KViewPresenterFactory;
+K_EXPORT_COMPONENT_FACTORY( kview_presenterplugin, KViewPresenterFactory( "kviewpresenterplugin" ) )
+
+KViewPresenter::KViewPresenter( QObject* parent, const char* name, const QStringList & )
+ : Plugin( parent, name )
+ , m_pImageList( new ImageListDialog() )
+ , m_paFileOpen( 0 )
+ , m_bDontAdd( false )
+ , m_pCurrentItem( 0 )
+ , m_pSlideshowTimer( new QTimer( this ) )
+{
+ kdDebug( 4630 ) << k_funcinfo << endl;
+ m_imagelist.setAutoDelete( true );
+
+ QObjectList * viewerList = parent->queryList( 0, "KImageViewer Part", false, false );
+ m_pViewer = static_cast<KImageViewer::Viewer *>( viewerList->getFirst() );
+ delete viewerList;
+ if( m_pViewer )
+ {
+ ( void ) new KAction( i18n( "&Image List..." ), 0, 0,
+ this, SLOT( slotImageList() ),
+ actionCollection(), "plugin_presenter_imageList" );
+ m_paSlideshow = new KToggleAction( i18n( "Start &Slideshow" ), Key_S, actionCollection(), "plugin_presenter_slideshow" );
+ ( void ) new KAction( i18n( "&Previous Image in List" ), "previous", ALT+Key_Left,
+ this, SLOT( prev() ),
+ actionCollection(), "plugin_presenter_prev" );
+ ( void ) new KAction( i18n( "&Next Image in List" ), "next", ALT+Key_Right,
+ this, SLOT( next() ),
+ actionCollection(), "plugin_presenter_next" );
+
+ connect( m_paSlideshow, SIGNAL( toggled( bool ) ), m_pImageList->m_pSlideshow, SLOT( setOn( bool ) ) );
+ connect( m_pImageList->m_pSlideshow, SIGNAL( toggled( bool ) ), m_paSlideshow, SLOT( setChecked( bool ) ) );
+
+ // search for file_open action
+ KXMLGUIClient * parentClient = static_cast<KXMLGUIClient*>( parent->qt_cast( "KXMLGUIClient" ) );
+ if( parentClient )
+ {
+ m_paFileOpen = parentClient->actionCollection()->action( "file_open" );
+ m_paFileClose = parentClient->actionCollection()->action( "file_close" );
+ }
+ if( m_paFileClose )
+ connect( m_paFileClose, SIGNAL( activated() ), this, SLOT( slotClose() ) );
+ if( m_paFileOpen )
+ {
+ disconnect( m_paFileOpen, SIGNAL( activated() ), parent, SLOT( slotOpenFile() ) );
+ connect( m_paFileOpen, SIGNAL( activated() ), this, SLOT( slotOpenFiles() ) );
+ }
+ else
+ {
+ (void) new KAction( i18n( "Open &Multiple Files..." ), "queue", CTRL+SHIFT+Key_O,
+ this, SLOT( slotOpenFiles() ),
+ actionCollection(), "plugin_presenter_openFiles" );
+ }
+ connect( m_pViewer, SIGNAL( imageOpened( const KURL & ) ),
+ SLOT( slotImageOpened( const KURL & ) ) );
+ }
+ else
+ kdWarning( 4630 ) << "no KImageViewer interface found - the presenter plugin won't work" << endl;
+
+ //( void )new KViewPresenterConfModule( this );
+
+ connect( m_pImageList->m_pListView, SIGNAL( executed( QListViewItem* ) ),
+ this, SLOT( changeItem( QListViewItem* ) ) );
+ connect( m_pImageList->m_pPrevious, SIGNAL( clicked() ),
+ this, SLOT( prev() ) );
+ connect( m_pImageList->m_pNext, SIGNAL( clicked() ),
+ this, SLOT( next() ) );
+ connect( m_pImageList->m_pListView, SIGNAL( spacePressed( QListViewItem* ) ),
+ this, SLOT( changeItem( QListViewItem* ) ) );
+ connect( m_pImageList->m_pListView, SIGNAL( returnPressed( QListViewItem* ) ),
+ this, SLOT( changeItem( QListViewItem* ) ) );
+ connect( m_pImageList->m_pSlideshow, SIGNAL( toggled( bool ) ),
+ this, SLOT( slideshow( bool ) ) );
+ connect( m_pImageList->m_pInterval, SIGNAL( valueChanged( int ) ),
+ this, SLOT( setSlideshowInterval( int ) ) );
+ connect( m_pImageList->m_pShuffle, SIGNAL( clicked() ),
+ this, SLOT( shuffle() ) );
+ connect( m_pImageList->m_pLoad, SIGNAL( clicked() ),
+ this, SLOT( loadList() ) );
+ connect( m_pImageList->m_pSave, SIGNAL( clicked() ),
+ this, SLOT( saveList() ) );
+ connect( m_pImageList->m_pCloseAll, SIGNAL( clicked() ),
+ this, SLOT( closeAll() ) );
+
+ // allow drop on the dialog
+ m_pImageList->installEventFilter( this );
+ m_pImageList->m_pListView->installEventFilter( this );
+ m_pImageList->m_pListView->viewport()->installEventFilter( this );
+
+ // grab drops on the main view
+ m_pViewer->widget()->installEventFilter( this );
+
+ connect( m_pSlideshowTimer, SIGNAL( timeout() ),
+ this, SLOT( next() ) );
+}
+
+KViewPresenter::~KViewPresenter()
+{
+ kdDebug( 4630 ) << k_funcinfo << endl;
+ if( m_paFileOpen )
+ {
+ disconnect( m_paFileOpen, SIGNAL( activated() ), this, SLOT( slotOpenFiles() ) );
+ // If the parent() doesn't exist we either leave the "File Open" action
+ // in an unusable state or KView was just shutting down and therefor we
+ // can ignore this. I've only seen the second one happening and to get
+ // rid of the QObject::connect warning we do the parent() check.
+ if( parent() )
+ connect( m_paFileOpen, SIGNAL( activated() ), parent(), SLOT( slotOpenFile() ) );
+ }
+}
+
+bool KViewPresenter::eventFilter( QObject *obj, QEvent *ev )
+{
+ if( obj == m_pImageList || obj == m_pImageList->m_pListView || obj == m_pImageList->m_pListView->viewport() || obj == m_pViewer->widget() )
+ {
+ switch( ev->type() )
+ {
+ case QEvent::DragEnter:
+ case QEvent::DragMove:
+ {
+ // drag enter event in the image list
+ //kdDebug( 4630 ) << "DragEnterEvent in the image list: " << obj->className() << endl;
+ QDragEnterEvent * e = static_cast<QDragEnterEvent*>( ev );
+ //for( int i = 0; e->format( i ); ++i )
+ //kdDebug( 4630 ) << " - " << e->format( i ) << endl;
+ if( KURLDrag::canDecode( e ) )// || QImageDrag::canDecode( e ) )
+ {
+ e->accept();
+ return true;
+ }
+ }
+ case QEvent::Drop:
+ {
+ // drop event in the image list
+ kdDebug( 4630 ) << "DropEvent in the image list: " << obj->className() << endl;
+ QDropEvent * e = static_cast<QDropEvent*>( ev );
+ QStringList l;
+ //QImage image;
+ if( KURLDrag::decodeToUnicodeUris( e, l ) )
+ {
+ for( QStringList::const_iterator it = l.begin(); it != l.end(); ++it )
+ {
+ ImageInfo * info = new ImageInfo( KURL( *it ) );
+ if( ! m_imagelist.contains( info ) )
+ {
+ m_imagelist.inSort( info );
+ ( void )new ImageListItem( m_pImageList->m_pListView, KURL( *it ) );
+ }
+ else
+ delete info;
+ }
+ return true;
+ }
+ //else if( QImageDrag::decode( e, image ) )
+ //newImage( image );
+ }
+ default: // do nothing
+ break;
+ }
+ }
+ return KParts::Plugin::eventFilter( obj, ev );
+}
+
+void KViewPresenter::slotImageOpened( const KURL & url )
+{
+ kdDebug( 4630 ) << k_funcinfo << endl;
+ if( ! m_bDontAdd )
+ {
+ kdDebug( 4630 ) << k_funcinfo << "imagelist:" << endl;
+ ImageInfo * info = new ImageInfo( url );
+ if( ! m_imagelist.contains( info ) )
+ {
+ m_imagelist.inSort( info );
+ QListViewItem * item = new ImageListItem( m_pImageList->m_pListView, url );
+ makeCurrent( item );
+ }
+ else
+ delete info;
+ }
+}
+
+void KViewPresenter::slotImageList()
+{
+ kdDebug( 4630 ) << k_funcinfo << endl;
+ m_pImageList->show();
+}
+
+void KViewPresenter::slotOpenFiles()
+{
+ kdDebug( 4630 ) << k_funcinfo << endl;
+ KURL::List urls = KFileDialog::getOpenURLs( ":load_image", KImageIO::pattern( KImageIO::Reading ), m_pViewer->widget() );
+
+ if( urls.isEmpty() )
+ return;
+
+ KURL::List::Iterator it = urls.begin();
+ m_pViewer->openURL( *it );
+ for( ++it; it != urls.end(); ++it )
+ {
+ ImageInfo * info = new ImageInfo( *it );
+ if( ! m_imagelist.contains( info ) )
+ {
+ m_imagelist.inSort( info );
+ ( void )new ImageListItem( m_pImageList->m_pListView, *it );
+ }
+ else
+ delete info;
+ }
+}
+
+void KViewPresenter::slotClose()
+{
+ QListViewItem * next = m_pCurrentItem->itemBelow() ? m_pCurrentItem->itemBelow() : m_pImageList->m_pListView->firstChild();
+ if( next == m_pCurrentItem )
+ next = 0;
+
+ ImageInfo info( m_pCurrentItem->url() );
+ m_imagelist.remove( &info );
+ delete m_pCurrentItem;
+ m_pCurrentItem = 0;
+
+ if( next )
+ changeItem( next );
+}
+
+void KViewPresenter::changeItem( QListViewItem * qitem )
+{
+ kdDebug( 4630 ) << k_funcinfo << endl;
+ if( qitem->rtti() == 48294 )
+ {
+ ImageListItem * item = static_cast<ImageListItem*>( qitem );
+ if( ! item->url().isEmpty() )
+ {
+ if( item->url().isLocalFile() && ! QFile::exists( item->url().path() ) )
+ {
+ kdDebug( 4630 ) << "file doesn't exist. removed." << endl;
+ ImageInfo info( item->url() );
+ m_imagelist.remove( &info );
+ if( m_pCurrentItem == item )
+ {
+ QListViewItem * next = m_pCurrentItem->itemBelow() ? m_pCurrentItem->itemBelow() : m_pImageList->m_pListView->firstChild();
+ if( next->rtti() != 48294 )
+ kdWarning( 4630 ) << "unknown ListView item" << endl;
+ else
+ m_pCurrentItem = static_cast<ImageListItem*>( next );
+
+ if( m_pCurrentItem == item )
+ m_pCurrentItem = 0; // don't create a dangling pointer
+ delete item;
+ if( m_pCurrentItem )
+ changeItem( m_pCurrentItem );
+ }
+ else
+ {
+ delete item;
+ next();
+ }
+ return;
+ }
+ kdDebug( 4630 ) << "got url" << endl;
+ makeCurrent( qitem );
+
+ bool dontadd = m_bDontAdd;
+ m_bDontAdd = true;
+ m_pViewer->openURL( item->url() );
+ m_bDontAdd = dontadd;
+ }
+ else
+ kdWarning( 4630 ) << "got nothing" << endl;
+ }
+ else
+ kdWarning( 4630 ) << "unknown ListView item" << endl;
+}
+
+void KViewPresenter::prev()
+{
+ kdDebug( 4630 ) << k_funcinfo << endl;
+ if( m_pCurrentItem )
+ {
+ QListViewItem * prev = m_pCurrentItem->itemAbove() ? m_pCurrentItem->itemAbove() : m_pImageList->m_pListView->lastItem();
+ if( prev )
+ changeItem( prev );
+ }
+}
+
+void KViewPresenter::next()
+{
+ kdDebug( 4630 ) << k_funcinfo << endl;
+ if( m_pCurrentItem )
+ {
+ QListViewItem * next = m_pCurrentItem->itemBelow() ? m_pCurrentItem->itemBelow() : m_pImageList->m_pListView->firstChild();
+ if( next )
+ changeItem( next );
+ }
+}
+
+void KViewPresenter::makeCurrent( QListViewItem * item )
+{
+ if( m_pCurrentItem )
+ m_pCurrentItem->setPixmap( 0, QPixmap() );
+ if( item->rtti() != 48294 )
+ kdWarning( 4630 ) << "unknown ListView item" << endl;
+ else
+ {
+ m_pCurrentItem = static_cast<ImageListItem*>( item );
+ m_pCurrentItem->setPixmap( 0, KGlobal::iconLoader()->loadIcon( "1rightarrow", KIcon::Small ) );
+ m_pImageList->m_pListView->ensureItemVisible( m_pCurrentItem );
+ }
+}
+
+void KViewPresenter::slideshow( bool running )
+{
+ if( running )
+ {
+ m_pSlideshowTimer->start( m_pImageList->m_pInterval->value() );
+ actionCollection()->action( "plugin_presenter_slideshow" )->setText( i18n( "Stop &Slideshow" ) );
+ m_pImageList->m_pSlideshow->setText( i18n( "Stop &Slideshow" ) );
+ }
+ else
+ {
+ m_pSlideshowTimer->stop();
+ actionCollection()->action( "plugin_presenter_slideshow" )->setText( i18n( "Start &Slideshow" ) );
+ m_pImageList->m_pSlideshow->setText( i18n( "Start &Slideshow" ) );
+ }
+}
+
+void KViewPresenter::setSlideshowInterval( int msec )
+{
+ if( m_pSlideshowTimer->isActive() )
+ m_pSlideshowTimer->changeInterval( msec );
+}
+
+void KViewPresenter::shuffle()
+{
+ m_pImageList->noSort();
+ KListView * listview = m_pImageList->m_pListView;
+ QPtrList<QListViewItem> items;
+ for( QListViewItem * item = listview->firstChild(); item; item = listview->firstChild() )
+ {
+ items.append( item );
+ listview->takeItem( item );
+ }
+ while( ! items.isEmpty() )
+ listview->insertItem( items.take( KApplication::random() % items.count() ) );
+}
+
+void KViewPresenter::closeAll()
+{
+ m_imagelist.clear();
+ m_pImageList->m_pListView->clear();
+ m_pCurrentItem = 0;
+ if( m_pViewer->closeURL() )
+ m_pViewer->canvas()->clear();
+}
+
+void KViewPresenter::loadList()
+{
+ KURL url = KFileDialog::getOpenURL( ":load_list", QString::null, m_pImageList );
+ if( url.isEmpty() )
+ return;
+
+ QString tempfile;
+ if( ! KIO::NetAccess::download( url, tempfile, m_pViewer->widget() ) )
+ {
+ KMessageBox::error( m_pImageList, i18n( "Could not load\n%1" ).arg( url.prettyURL() ) );
+ return;
+ }
+ QFile file( tempfile );
+ if( file.open( IO_ReadOnly ) )
+ {
+ QTextStream t( &file );
+ if( t.readLine() == "[KView Image List]" )
+ {
+ //clear old image list
+ closeAll();
+
+ QStringList list;
+ if( ! t.eof() )
+ m_pViewer->openURL( KURL( t.readLine() ) );
+ while( ! t.eof() )
+ {
+ KURL url ( t.readLine() );
+ ImageInfo * info = new ImageInfo( url );
+ if( ! m_imagelist.contains( info ) )
+ {
+ m_imagelist.inSort( info );
+ ( void )new ImageListItem( m_pImageList->m_pListView, url );
+ }
+ else
+ delete info;
+ }
+ }
+ else
+ {
+ KMessageBox::error( m_pImageList, i18n( "Wrong format\n%1" ).arg( url.prettyURL() ) );
+ }
+ file.close();
+ }
+ KIO::NetAccess::removeTempFile( tempfile );
+}
+
+void KViewPresenter::saveList()
+{
+ KURL url = KFileDialog::getSaveURL( ":save_list", QString::null, m_pImageList );
+
+ if( url.isEmpty() )
+ return;
+
+ QString tempfile;
+ if( url.isLocalFile() )
+ tempfile = url.path();
+ else
+ {
+ KTempFile ktempf;
+ tempfile = ktempf.name();
+ }
+
+ QFile file( tempfile );
+ if( file.open( IO_WriteOnly ) )
+ {
+ QTextStream t( &file );
+ // write header
+ t << "[KView Image List]" << endl;
+ QListViewItem * item = m_pImageList->m_pListView->firstChild();
+ while( item )
+ {
+ if( item->rtti() == 48294 )
+ t << static_cast<ImageListItem*>( item )->url().url() << endl;
+ item = item->itemBelow();
+ }
+ file.close();
+
+ if( ! url.isLocalFile() )
+ {
+ KIO::NetAccess::upload( tempfile, url, m_pViewer->widget() );
+ KIO::NetAccess::removeTempFile( tempfile );
+ }
+ }
+}
+
+// vim:sw=4:ts=4
+#include "kviewpresenter.moc"
diff --git a/kview/modules/presenter/kviewpresenter.desktop b/kview/modules/presenter/kviewpresenter.desktop
new file mode 100644
index 00000000..7059caba
--- /dev/null
+++ b/kview/modules/presenter/kviewpresenter.desktop
@@ -0,0 +1,118 @@
+[Desktop Entry]
+Icon=presenter
+Type=Service
+ServiceTypes=KPluginInfo
+
+X-KDE-PluginInfo-Author=Matthias Kretz
+X-KDE-PluginInfo-Email=kretz@kde.org
+X-KDE-PluginInfo-Name=kviewpresenter
+X-KDE-PluginInfo-Version=1.1
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
+
+Name=Presenter
+Name[ar]=المقدّم
+Name[bg]=Презентация
+Name[br]=Emginniger
+Name[bs]=Prezentator
+Name[ca]=Presentador
+Name[cs]=Prezentace
+Name[cy]=Cyflwynydd
+Name[de]=Präsentationsprogramm
+Name[el]=Παρουσιαστής
+Name[eo]=Prezentilo
+Name[et]=Esitleja
+Name[eu]=Aurkezlea
+Name[fa]=ارائه‌کننده
+Name[fi]=Esitysohjelma
+Name[fr]=Présentateur
+Name[ga]=Láithreoir
+Name[gl]=Escaparate
+Name[he]=מצגות
+Name[hi]=प्रस्तुतकर्ता
+Name[hr]=Prezentator
+Name[hu]=Bemutató
+Name[it]=Presentazione
+Name[ja]=プレゼンタ
+Name[kk]=Презентатор
+Name[km]=កម្មវិធី​បង្ហាញ
+Name[lt]=Pristatytojas
+Name[ms]=Penyampai
+Name[nds]=Präsentatschoonprogramm
+Name[ne]=प्रस्तोता
+Name[nl]=Presentatieprogramma
+Name[nso]=Mohlagisi
+Name[pa]=ਪੇਸ਼ਕਾਰ
+Name[pl]=Prezenter
+Name[pt]=Apresentador
+Name[pt_BR]=Apresentador
+Name[ro]=Prezentare
+Name[ru]=Презентатор
+Name[sk]=Vytvorenie prezentácie
+Name[sl]=Predstavitelj
+Name[sr]=Презентер
+Name[sr@Latn]=Prezenter
+Name[sv]=Presentationer
+Name[ta]=வழங்குபவர்
+Name[tg]=Презентатор
+Name[tr]=Sunum Aracı
+Name[ven]=Mulanguli
+Name[xh]=Umbonisi
+Name[zh_CN]=演示板
+Name[zh_HK]=簡報器
+Name[zh_TW]=簡報
+Name[zu]=Umnikeli
+Comment=Creates an imagelist and enables you to create a slideshow
+Comment[ar]=ينشئ قائمة صور ويمكنك من استعراض الصور تلقائيا
+Comment[bg]=Създаване на списък с изображения и слайдшоу от тях
+Comment[bs]=Pravi listu slika i omogućuje vam da napravite slide show
+Comment[ca]=Crea una llista d'imatges i us permet crear un passi de diapositives
+Comment[cs]=Vytvoří seznam obrázků a umožní vám z nich vytvořit slideshow.
+Comment[cy]=Creu rhestr delweddau ac alluogi i chi greu sioe haenluniau
+Comment[da]=Laver en billedliste og giver dig muligheden for at lave et diasshow
+Comment[de]=Erzeugt eine Bilderliste und ermöglicht das Erstellen von Diashows
+Comment[el]=Δημιουργεί μια λίστα εικόνων και σας επιτρέπει να δημιουργήσετε μια προβολή σλάιντ
+Comment[es]=Crea una lista de imágenes ofreciendole la posibilidad de crear una animación de diapositivas
+Comment[et]=Loob piltide nimekirja ja laseb selle põhjal luua slaidiseansi
+Comment[eu]=Irudi-zerrenda bat sortzen du eta diapositiba-aurkezpena egiten du
+Comment[fa]=یک فهرست تصویر ایجاد می‌کند و شما را قادر به ایجاد یک نمایش اسلاید می‌کند
+Comment[fi]=Luo kuvalistan ja mahdollistaa esityksen luomisen
+Comment[fr]=Crée une liste d'images et vous permet de créer un diaporama
+Comment[gl]=Crea unha lista de imaxes e permite crear unha moviola
+Comment[he]=יוצר רשימת תמונות ומאפשר לך ליצור מצגת שקופיות
+Comment[hi]=एक छवि-सूची बनाता है तथा आपको एक स्लाइड-शो तैयार करने में सक्षम बनाता है
+Comment[hu]=Képsorozat összeállítását és bemutatását teszi lehetővé
+Comment[is]=Býr til myndlista og gerir þér kleyft að búa til myndsýningu
+Comment[it]=Crea una lista di immagini e permette di creare una presentazione
+Comment[ja]=画像リストを作成し、スライドショーを作成します
+Comment[kk]=Слайд-шоу көрсетуге кескіндер тізімін дайындау
+Comment[km]=បង្កើត​បញ្ជី​រូបភាព ហើយ​អាច​ឲ្យ​អ្នក​បង្កើត​ជា​ការ​បញ្ចាំង​ស្លាយ
+Comment[lt]=Sukuria paveikslėlių sąrašą ir leidžia jums sukurti skaidrių peržiūrą
+Comment[ms]=Cipta senarai imej dan membolehkan anda mencipta tayangan slaid
+Comment[nb]=Oppretter en bildeliste og lar deg lage en lysbildeserie
+Comment[nds]=Stellt en Bildlist op un lett Di en Diaschau opstellen
+Comment[ne]=छवि सूची सिर्जना गर्दछ र तपाईँलाई स्लाइड प्रर्दशन सिर्जना गर्न सक्षम पार्दछ
+Comment[nl]=Maakt een afbeeldingenlijst waarmee u een diashow kunt maken
+Comment[nn]=Lagar ei biletliste du kan bruka til framvising
+Comment[nso]=Hlagisa palo ya ponagalo gape ego dumelela go hlagisa slidesshow
+Comment[pl]=Tworzy listę obrazków i umożliwia tworzenie z niej pokazu slajdów
+Comment[pt]=Cria uma lista de imagens e permite-lhe criar uma apresentação
+Comment[pt_BR]=Cria uma lista de imagens e habilita você a criar uma exibição de slides
+Comment[ro]=Creează o listă de imagini şi vă permite să reallizaţi o succesiune de imagini
+Comment[ru]=Создание галерей изображений и просмотр их в качестве слайдов
+Comment[se]=Ráhkada govvalisttu ja diktá du ráhkadit govvačájeheami
+Comment[sk]=Vytvorí zoznam obrázok a umožní z nich vytvoriť prezentáciu
+Comment[sl]=Ustvari seznam slik in vam omogoča ustvariti predstavitev
+Comment[sr]=Прави листу слика и омогућава вам да направите слајд-шоу
+Comment[sr@Latn]=Pravi listu slika i omogućava vam da napravite slajd-šou
+Comment[sv]=Skapar en bildlista och ger dig möjlighet att göra ett bildspel
+Comment[ta]=திரைக் காட்சிக்கான பிம்ப பட்டியலை உருவாக்கலாம்
+Comment[tg]=Эҷоди нигористони тасвирот ва намоиши онҳо ҳамчун слайд
+Comment[tr]=Bir resim listesi oluşturur ve slayt gösterisi yapmanıza olanak tanır
+Comment[uk]=Створює список зображень та дозволяє створювати презентацію слайдів
+Comment[ven]=Iita mutevhe wa tshifanyiso ya dovha yani tendela uita tsumbedzo ya tshilaidi
+Comment[xh]=Yenza uluhlu lwemifanekiso ekuvumela ukwazi ukwenza umboniso wotyibiliko
+Comment[zh_CN]=创建图像列表,并能为您创建幻灯片
+Comment[zh_HK]=建立圖像清單並讓您能建立幻燈片式放映
+Comment[zh_TW]=建立影像清單並讓您能建立幻燈片式放映
+Comment[zu]=Idala uhlu lwesithombe futhi ikuvumela wena ukuba udale umbukiso wesithombe esishibilikayo
diff --git a/kview/modules/presenter/kviewpresenter.h b/kview/modules/presenter/kviewpresenter.h
new file mode 100644
index 00000000..29fc106b
--- /dev/null
+++ b/kview/modules/presenter/kviewpresenter.h
@@ -0,0 +1,103 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+/* $Id$ */
+
+#ifndef __kviewpresenter_h
+#define __kviewpresenter_h
+
+#include <kparts/plugin.h>
+#include <kurl.h>
+
+#include <qsortedlist.h>
+
+namespace KImageViewer { class Viewer; }
+
+class ImageListDialog;
+class ImageListItem;
+class QListViewItem;
+class QTimer;
+class KToggleAction;
+class KAction;
+
+class KViewPresenter : public KParts::Plugin
+{
+ Q_OBJECT
+public:
+ KViewPresenter( QObject* parent, const char* name, const QStringList & );
+ virtual ~KViewPresenter();
+
+protected:
+ struct ImageInfo
+ {
+ KURL url;
+ ImageInfo( const KURL & url )
+ : url( url )
+ {
+ }
+ bool operator==( const ImageInfo & i1 )
+ {
+ return url.prettyURL() == i1.url.prettyURL();
+ }
+ bool operator!=( const ImageInfo & i1 )
+ {
+ return url.prettyURL() == i1.url.prettyURL();
+ }
+ bool operator>( const ImageInfo & i1 )
+ {
+ return url.prettyURL() > i1.url.prettyURL();
+ }
+ bool operator<( const ImageInfo & i1 )
+ {
+ return url.prettyURL() < i1.url.prettyURL();
+ }
+ };
+ bool eventFilter( QObject *, QEvent * );
+
+private slots:
+ void slotImageOpened( const KURL & );
+ void slotImageList();
+ void slotOpenFiles();
+ void slotClose();
+ void changeItem( QListViewItem * );
+ void prev();
+ void next();
+ void slideshow( bool );
+ void setSlideshowInterval( int );
+ void shuffle();
+ void closeAll();
+ void loadList();
+ void saveList();
+
+private:
+ void makeCurrent( QListViewItem * );
+
+ KImageViewer::Viewer * m_pViewer;
+ ImageListDialog * m_pImageList;
+ KToggleAction * m_paSlideshow;
+ KAction * m_paFileOpen;
+ KAction * m_paFileClose;
+
+ QSortedList<ImageInfo> m_imagelist;
+ bool m_bDontAdd;
+ ImageListItem * m_pCurrentItem;
+ QTimer * m_pSlideshowTimer;
+};
+
+// vim:sw=4:ts=4:cindent
+#endif
diff --git a/kview/modules/presenter/kviewpresenter.rc b/kview/modules/presenter/kviewpresenter.rc
new file mode 100644
index 00000000..92879d02
--- /dev/null
+++ b/kview/modules/presenter/kviewpresenter.rc
@@ -0,0 +1,20 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="kviewpresenter" library="kview_presenterplugin" version="3">
+ <MenuBar>
+ <Menu name="file"><text>&amp;File</text>
+ <Action name="plugin_presenter_openFiles" group="open_merge_group"/>
+ </Menu>
+ <Menu name="view"><text>&amp;View</text>
+ </Menu>
+
+ <Menu name="go_document"><Text>&amp;Go</Text>
+ <Action name="plugin_presenter_imageList"/>
+ <Action name="plugin_presenter_slideshow"/>
+ <Action name="plugin_presenter_prev"/>
+ <Action name="plugin_presenter_next"/>
+ </Menu>
+ </MenuBar>
+ <Menu name="popupmenu">
+ <Action name="plugin_presenter_slideshow"/>
+ </Menu>
+</kpartplugin>
diff --git a/kview/modules/presenter/kviewpresenterconfmodule.cpp b/kview/modules/presenter/kviewpresenterconfmodule.cpp
new file mode 100644
index 00000000..a39ea378
--- /dev/null
+++ b/kview/modules/presenter/kviewpresenterconfmodule.cpp
@@ -0,0 +1,60 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+// $Id$
+
+#include "kviewpresenterconfmodule.h"
+
+#include <qlayout.h>
+#include <qcheckbox.h>
+#include <qframe.h>
+
+#include <klocale.h>
+#include <kdialog.h>
+#include <kglobal.h>
+#include <kconfig.h>
+
+KViewPresenterConfModule::KViewPresenterConfModule( QObject * parent )
+ : KPreferencesModule( "kviewpresenter", parent, "KView Presenter Config Module" )
+{
+}
+
+KViewPresenterConfModule::~KViewPresenterConfModule()
+{
+}
+
+void KViewPresenterConfModule::applyChanges()
+{
+ emit configChanged();
+}
+
+void KViewPresenterConfModule::reset()
+{
+}
+
+void KViewPresenterConfModule::createPage( QFrame * page )
+{
+ QBoxLayout * layout = new QVBoxLayout( page, KDialog::marginHint(), KDialog::spacingHint() );
+ layout->setAutoAdd( true );
+
+ m_pCheckBox = new QCheckBox( "This is only for testing...", page );
+}
+
+// vim:sw=4:ts=4
+
+#include "kviewpresenterconfmodule.moc"
diff --git a/kview/modules/presenter/kviewpresenterconfmodule.h b/kview/modules/presenter/kviewpresenterconfmodule.h
new file mode 100644
index 00000000..dd7e5cf2
--- /dev/null
+++ b/kview/modules/presenter/kviewpresenterconfmodule.h
@@ -0,0 +1,49 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+// $Id$
+
+#ifndef KVIEWPRESENTERCONFMODULE_H
+#define KVIEWPRESENTERCONFMODULE_H
+
+#include "kpreferencesmodule.h"
+
+class QCheckBox;
+
+class KViewPresenterConfModule : public KPreferencesModule
+{
+ Q_OBJECT
+ public:
+ KViewPresenterConfModule( QObject * parent );
+ ~KViewPresenterConfModule();
+
+ signals:
+ void configChanged();
+
+ protected:
+ virtual void applyChanges();
+ virtual void reset();
+ virtual void createPage( QFrame * page );
+
+ private:
+ QCheckBox * m_pCheckBox;
+};
+
+// vim:sw=4:ts=4
+
+#endif // KVIEWPRESENTERCONFMODULE_H
diff --git a/kview/modules/scale/Makefile.am b/kview/modules/scale/Makefile.am
new file mode 100644
index 00000000..39442781
--- /dev/null
+++ b/kview/modules/scale/Makefile.am
@@ -0,0 +1,15 @@
+INCLUDES = -I$(top_srcdir)/kview $(all_includes)
+
+kde_module_LTLIBRARIES = kview_scale.la
+
+kview_scale_la_SOURCES = kfloatspinbox.cpp scaledlg.cpp kview_scale.cpp
+kview_scale_la_LIBADD = $(LIB_KFILE) $(LIB_KPARTS) -lkdeprint
+kview_scale_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+
+plugdir = $(kde_datadir)/kviewviewer/kpartplugins
+plug_DATA = kview_scale.rc kview_scale.desktop
+
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/kview_scale.pot
diff --git a/kview/modules/scale/kfloatspinbox.cpp b/kview/modules/scale/kfloatspinbox.cpp
new file mode 100644
index 00000000..e5ce8465
--- /dev/null
+++ b/kview/modules/scale/kfloatspinbox.cpp
@@ -0,0 +1,116 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+// $Id$
+
+#include "kfloatspinbox.h"
+
+#if defined(QT_ACCESSIBILITY_SUPPORT)
+#include <qaccessible.h>
+#endif
+
+#include <knumvalidator.h>
+#include <klocale.h>
+#include <kglobal.h>
+#include <kdebug.h>
+
+int pow( int a, int b )
+{
+ int ret = 1;
+ for( int i = 0; i < b; ++i )
+ ret *= a;
+ return ret;
+}
+
+KFloatSpinBox::KFloatSpinBox( float minValue, float maxValue, float step, unsigned int precision, QWidget * parent, const char * name )
+ : QSpinBox( parent, name )
+ , m_doselection( true )
+{
+ setRange( minValue, maxValue, step, precision );
+ connect( this, SIGNAL( valueChanged( int ) ), this, SLOT( slotValueChanged( int ) ) );
+}
+
+KFloatSpinBox::~KFloatSpinBox()
+{
+}
+
+void KFloatSpinBox::setRange( float minValue, float maxValue, float step, unsigned int precision )
+{
+ m_factor = pow( 10, precision );
+ m_min = (int)( minValue * m_factor );
+ m_max = (int)( maxValue * m_factor );
+ m_step = (int)( step * m_factor );
+ QSpinBox::setRange( m_min, m_max );
+ setSteps( m_step, m_step * 10 );
+ if( precision == 0 )
+ setValidator( new KIntValidator( m_min, m_max, this, 10, "KFloatValidator::KIntValidator" ) );
+ else
+ setValidator( new KFloatValidator( minValue, maxValue, true, this, "KFloatSpinBox::KFloatValidator" ) );
+}
+
+float KFloatSpinBox::value() const
+{
+ float ret = (float)QSpinBox::value() / m_factor;
+ kdDebug( 4630 ) << ret << endl;
+ return ret;
+}
+
+void KFloatSpinBox::setValue( float value )
+{
+ QSpinBox::setValue( (int)( value * m_factor ) );
+}
+
+void KFloatSpinBox::setValueBlocking( float value )
+{
+ m_doselection = false;
+ blockSignals( true );
+ KFloatSpinBox::setValue( value );
+ blockSignals( false );
+ m_doselection = true;
+}
+
+QString KFloatSpinBox::mapValueToText( int value )
+{
+ return KGlobal::locale()->formatNumber( (float)value / (float)m_factor, 4 );
+}
+
+int KFloatSpinBox::mapTextToValue( bool * ok )
+{
+ return (int)( m_factor * KGlobal::locale()->readNumber( text(), ok ) );
+}
+
+void KFloatSpinBox::valueChange()
+{
+ if( m_doselection )
+ QSpinBox::valueChange();
+ else
+ {
+ updateDisplay();
+ emit valueChanged( value() );
+#if defined(QT_ACCESSIBILITY_SUPPORT)
+ QAccessible::updateAccessibility( this, 0, QAccessible::ValueChanged );
+#endif
+ }
+}
+
+void KFloatSpinBox::slotValueChanged( int )
+{
+ emit valueChanged( value() );
+}
+
+#include "kfloatspinbox.moc"
diff --git a/kview/modules/scale/kfloatspinbox.h b/kview/modules/scale/kfloatspinbox.h
new file mode 100644
index 00000000..9407a0f1
--- /dev/null
+++ b/kview/modules/scale/kfloatspinbox.h
@@ -0,0 +1,64 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+// $Id$
+
+#ifndef __kfloatspinbox_h_
+#define __kfloatspinbox_h_
+
+#include <qspinbox.h>
+
+class KFloatSpinBox : public QSpinBox
+{
+ Q_OBJECT
+ public:
+ KFloatSpinBox( float minValue, float maxValue, float step, unsigned int precision, QWidget * parent = 0, const char * name = 0 );
+ virtual ~KFloatSpinBox();
+
+ void setRange( float minValue, float maxValue, float step, unsigned int precision );
+ void setRangeBlocking( float minValue, float maxValue, float step, unsigned int precision );
+
+ float value() const;
+
+ public slots:
+ virtual void setValue( float value );
+ /**
+ * differs from the above in that it will block all signals
+ */
+ virtual void setValueBlocking( float value );
+
+ protected:
+ virtual QString mapValueToText( int value );
+ virtual int mapTextToValue( bool * ok );
+ virtual void valueChange();
+
+ signals:
+ void valueChanged( float value );
+
+ private slots:
+ void slotValueChanged( int value );
+
+ private:
+ int m_factor;
+ int m_min;
+ int m_max;
+ int m_step;
+ bool m_doselection;
+};
+
+#endif
diff --git a/kview/modules/scale/kview_scale.cpp b/kview/modules/scale/kview_scale.cpp
new file mode 100644
index 00000000..aa8dec82
--- /dev/null
+++ b/kview/modules/scale/kview_scale.cpp
@@ -0,0 +1,180 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+/* $Id$ */
+
+#include "kview_scale.h"
+#include "scaledlg.h"
+
+#include <qimage.h>
+#include <qvbox.h>
+
+#include <kaction.h>
+#include <klocale.h>
+#include <kgenericfactory.h>
+#include <kdebug.h>
+#include <kimageviewer/viewer.h>
+#include <kimageviewer/canvas.h>
+#include <kdialogbase.h>
+
+typedef KGenericFactory<KViewScale> KViewScaleFactory;
+K_EXPORT_COMPONENT_FACTORY( kview_scale, KViewScaleFactory( "kview_scale" ) )
+
+KViewScale::KViewScale( QObject* parent, const char* name, const QStringList & )
+ : Plugin( parent, name )
+ , m_pViewer( 0 )
+ , m_pCanvas( 0 )
+{
+ m_pViewer = static_cast<KImageViewer::Viewer *>( parent );
+ if( m_pViewer )
+ {
+ kdDebug( 4630 ) << "m_pViewer->canvas() = " << m_pViewer->canvas() << endl;
+ m_pCanvas = m_pViewer->canvas();
+
+ (void) new KAction( i18n( "&Scale Image..." ), 0, 0,
+ this, SLOT( slotScaleDlg() ),
+ actionCollection(), "plugin_scale" );
+ }
+ else
+ kdWarning( 4630 ) << "no KImageViewer interface found - the scale plugin won't work" << endl;
+}
+
+KViewScale::~KViewScale()
+{
+}
+
+void KViewScale::slotScaleDlg()
+{
+ kdDebug( 4630 ) << k_funcinfo << endl;
+ KDialogBase dlg( m_pViewer->widget(), "KView scale dialog", true, i18n( "Scale Image" ), KDialogBase::Ok|KDialogBase::Cancel );
+ ScaleDlg widget( m_pCanvas->imageSize(), dlg.makeVBoxMainWidget() );
+#if 0
+ QVBox * layout = dlg.makeVBoxMainWidget();
+
+ QGroupBox * pixelgroup = new QGroupBox( i18n( "Pixel Dimensions" ), layout );
+ QGridLayout * pixelgroupgrid = new QGridLayout( pixelgroup, 1, 1, 0, KDialog::spacingHint() );
+ pixelgroupgrid->setSpacing( KDialog::spacingHint() );
+ pixelgroupgrid->setMargin( KDialog::marginHint() );
+ QLabel * label;
+ QSize imagesize = m_pCanvas->imageSize();
+
+ // show original width
+ label = new QLabel( i18n( "Original width:" ), pixelgroup );
+ label->setAlignment( QLabel::AlignRight );
+ pixelgroupgrid->addWidget( label, 0, 0 );
+ pixelgroupgrid->addWidget( new QLabel( QString::number( imagesize.width() ), pixelgroup ), 0, 1 );
+ label = new QLabel( i18n( "Height:" ), pixelgroup );
+ label->setAlignment( QLabel::AlignRight );
+ pixelgroupgrid->addWidget( label, 1, 0 );
+ pixelgroupgrid->addWidget( new QLabel( QString::number( imagesize.height() ), pixelgroup ), 1, 1 );
+
+ pixelgroupgrid->addRowSpacing( 2, KDialog::spacingHint() );
+
+ label = new QLabel( i18n( "New width:" ), pixelgroup );
+ label->setAlignment( QLabel::AlignRight );
+ pixelgroupgrid->addWidget( label, 3, 0 );
+ label = new QLabel( i18n( "Height:" ), pixelgroup );
+ label->setAlignment( QLabel::AlignRight );
+ pixelgroupgrid->addWidget( label, 4, 0 );
+ QSpinBox * newwidth = new QSpinBox( 1, 100000, 1, pixelgroup );
+ pixelgroupgrid->addWidget( newwidth, 3, 1 );
+ QSpinBox * newheight = new QSpinBox( 1, 100000, 1, pixelgroup );
+ pixelgroupgrid->addWidget( newheight, 4, 1 );
+ KComboBox * newsizeunit = new KComboBox( pixelgroup );
+ newsizeunit->insertItem( i18n( "px" ) );
+ newsizeunit->insertItem( i18n( "%" ) );
+ pixelgroupgrid->addMultiCellWidget( newsizeunit, 3, 4, 2, 2, Qt::AlignVCenter );
+
+ pixelgroupgrid->addRowSpacing( 5, KDialog::spacingHint() );
+
+ label = new QLabel( i18n( "Ratio X:" ), pixelgroup );
+ label->setAlignment( QLabel::AlignRight );
+ pixelgroupgrid->addWidget( label, 6, 0 );
+ label = new QLabel( i18n( "Y:" ), pixelgroup );
+ label->setAlignment( QLabel::AlignRight );
+ pixelgroupgrid->addWidget( label, 7, 0 );
+ QSpinBox * ratiox = new QSpinBox( pixelgroup );
+ ratiox->setValidator( new QDoubleValidator( 0.0001, 10000, 4, ratiox ) );
+ pixelgroupgrid->addWidget( ratiox, 6, 1 );
+ QSpinBox * ratioy = new QSpinBox( pixelgroup );
+ ratioy->setValidator( new QDoubleValidator( 0.0001, 10000, 4, ratioy ) );
+ pixelgroupgrid->addWidget( ratioy, 7, 1 );
+ pixelgroupgrid->addMultiCellWidget( new QCheckBox( i18n( "Link" ), pixelgroup ), 6, 7, 2, 2, Qt::AlignVCenter );
+
+ QGroupBox * printgroup = new QGroupBox( i18n( "Print Size && Display Units" ), layout );
+ QGridLayout * printgroupgrid = new QGridLayout( printgroup, 1, 1, 0, KDialog::spacingHint() );
+ printgroupgrid->setSpacing( KDialog::spacingHint() );
+ printgroupgrid->setMargin( KDialog::marginHint() );
+
+ label = new QLabel( i18n( "New width:" ), printgroup );
+ label->setAlignment( QLabel::AlignRight );
+ printgroupgrid->addWidget( label, 0, 0 );
+ label = new QLabel( i18n( "Height:" ), printgroup );
+ label->setAlignment( QLabel::AlignRight );
+ printgroupgrid->addWidget( label, 1, 0 );
+ QSpinBox * newwidth2 = new QSpinBox( printgroup );
+ printgroupgrid->addWidget( newwidth2, 0, 1 );
+ QSpinBox * newheight2 = new QSpinBox( printgroup );
+ printgroupgrid->addWidget( newheight2, 1, 1 );
+ KComboBox * newsizeunit2 = new KComboBox( printgroup );
+ newsizeunit2->insertItem( i18n( "in" ) );
+ newsizeunit2->insertItem( i18n( "mm" ) );
+ printgroupgrid->addMultiCellWidget( newsizeunit2, 0, 1, 2, 2, Qt::AlignVCenter );
+
+ printgroupgrid->addRowSpacing( 2, KDialog::spacingHint() );
+
+ label = new QLabel( i18n( "Resolution X:" ), printgroup );
+ label->setAlignment( QLabel::AlignRight );
+ printgroupgrid->addWidget( label, 3, 0 );
+ label = new QLabel( i18n( "Y:" ), printgroup );
+ label->setAlignment( QLabel::AlignRight );
+ printgroupgrid->addWidget( label, 4, 0 );
+ QSpinBox * resx = new QSpinBox( printgroup );
+ printgroupgrid->addWidget( resx, 3, 1 );
+ QSpinBox * resy = new QSpinBox( printgroup );
+ printgroupgrid->addWidget( resy, 4, 1 );
+ printgroupgrid->addMultiCellWidget( new QCheckBox( i18n( "Link" ), printgroup ), 3, 4, 2, 2, Qt::AlignVCenter );
+ //KComboBox * newsizeunit2 = new KComboBox( printgroup );
+ //newsizeunit2->insertItem( i18n( "in" ) );
+ //newsizeunit2->insertItem( i18n( "mm" ) );
+ //printgroupgrid->addMultiCellWidget( newsizeunit2, 0, 1, 2, 2, Qt::AlignVCenter );
+#endif
+
+ dlg.exec();
+}
+
+void KViewScale::slotScale()
+{
+ // retrieve current image
+ kdDebug( 4630 ) << "m_pCanvas = " << m_pCanvas << endl;
+ const QImage * image = m_pCanvas->image();
+ kdDebug( 4630 ) << "image pointer retrieved" << endl;
+ if( image )
+ {
+ // scale
+ QImage newimage = image->smoothScale( 50, 50 );
+ // put back (modified)
+ m_pCanvas->setImage( newimage );
+ m_pViewer->setModified( true );
+ }
+ else
+ kdDebug( 4630 ) << "no image to scale" << endl;
+}
+
+// vim:sw=4:ts=4:cindent
+#include "kview_scale.moc"
diff --git a/kview/modules/scale/kview_scale.desktop b/kview/modules/scale/kview_scale.desktop
new file mode 100644
index 00000000..6dd11c40
--- /dev/null
+++ b/kview/modules/scale/kview_scale.desktop
@@ -0,0 +1,127 @@
+[Desktop Entry]
+Name=Scale
+Name[af]=Skaal
+Name[ar]=تكبير أو تصغير
+Name[bg]=Мащабиране
+Name[br]=Skeulaet
+Name[bs]=Skaliraj
+Name[ca]=Escala
+Name[cs]=Změna měřítka
+Name[cy]=Graddfa
+Name[da]=Skala
+Name[de]=Skalierer
+Name[el]=Κλιμάκωση
+Name[eo]=Grandecŝanĝo
+Name[et]=Skaleerija
+Name[eu]=Eskalatu
+Name[fa]=مقیاس
+Name[fi]=Skaalaa
+Name[fr]=Échelle
+Name[ga]=Scála
+Name[gl]=Redimensionar
+Name[he]=קנה מידה
+Name[hi]=स्केल
+Name[hr]=Skala
+Name[hu]=Nagyítás
+Name[is]=Skala
+Name[it]=Riscala
+Name[ja]=スケール
+Name[kk]=Масштабтау
+Name[km]=ធ្វើ​មាត្រដ្ឋាន
+Name[lt]=Mąstelis
+Name[ms]=Skala
+Name[nb]=Skaler
+Name[nds]=Grött-Topasser
+Name[ne]=स्केल
+Name[nl]=Schaalprogramma
+Name[nn]=Skaler
+Name[nso]=Sekala
+Name[pa]=ਸਕੇਲ
+Name[pl]=Skala
+Name[pt]=Redimensionamento
+Name[pt_BR]=Escala
+Name[ro]=Scalare
+Name[ru]=Масштабирование
+Name[se]=Skále
+Name[sk]=Škálovač
+Name[sl]=Raztegni
+Name[sr]=Скалирање
+Name[sr@Latn]=Skaliranje
+Name[sv]=Skala
+Name[ta]=அளவுக்கோல்
+Name[tg]=Масштабонӣ
+Name[tr]=Oranla
+Name[uk]=Масштаб
+Name[ven]=Tshikeili
+Name[wa]=Al schåle
+Name[xh]=Isikali
+Name[zh_CN]=缩放
+Name[zh_HK]=縮放
+Name[zh_TW]=縮放
+Name[zu]=Isikali
+Comment=Filter to scale the image
+Comment[af]=Filter na skaal die beeld
+Comment[ar]=فلتر لتكبير أو تصغير الصورة
+Comment[bg]=Филтър за мащабиране на изображения
+Comment[bs]=Filter za skaliranje slike
+Comment[ca]=Filtre per escalar la imatge
+Comment[cs]=Filtr ke změně měřítka obrázku
+Comment[cy]=Hidl i raddio'r ddelwedd
+Comment[da]=Filter til at skalere billedet
+Comment[de]=Ein Filter zum Skalieren von Bildern
+Comment[el]=Φίλτρο για την κλιμάκωση της εικόνας
+Comment[eo]=por ŝanĝi la grandecon de la bildo
+Comment[es]=Filtro para cambiar la escala de una imagen
+Comment[et]=Filter piltide skaleerimiseks
+Comment[eu]=Eskalatu irudia
+Comment[fa]=پالایه برای مقیاس کردن تصویر
+Comment[fi]=Suodatin kuvan skaalaamiseen
+Comment[fr]=Filtre pour zoomer une image
+Comment[gl]=Filtro para redimensionar a imaxe
+Comment[he]=מסנן לשינוי קנה המידה של התמונה
+Comment[hi]=छवि का आकार बदलने का फ़िल्टर
+Comment[hr]=Filter za promjenu veličine slike
+Comment[hu]=Képméretező szűrő
+Comment[is]=Sía sem skalar myndina
+Comment[it]=Filtro per ridimensionare l'immagine
+Comment[ja]=画像をスケールするフィルタ
+Comment[kk]=Кескідерді масштабтау сүзгісі
+Comment[km]=តម្រងធ្វើ​មាត្រដ្ឋាន​រូបភាព
+Comment[lt]=Filtras paveikslėliui didinti ar mažinti
+Comment[ms]=Tapis untuk menskalakan imej
+Comment[nb]=Filter for skalering av bildet
+Comment[nds]=En Filter för't Topassen vun de Bildgrött
+Comment[ne]=छवि मापन गर्न फिल्टर
+Comment[nl]=Filter om de afbeelding te schalen
+Comment[nn]=Filter for skalering av biletet
+Comment[nso]=Sesekodi sago kala ponagalo
+Comment[pl]=Filtr do skalowania obrazków
+Comment[pt]=Um filtro para escalar a imagem
+Comment[pt_BR]=Filtro para escalar a imagem
+Comment[ro]=Filtru de scalat imaginea
+Comment[ru]=Фильтр для масштабирования изображений
+Comment[se]=Silli mii skálere govaid
+Comment[sk]=Filter pre zväčšenie obrázku
+Comment[sl]=Filter za raztegovanje slike
+Comment[sr]=Филтер за промену величине слике
+Comment[sr@Latn]=Filter za promenu veličine slike
+Comment[sv]=Filter för att skala bilden
+Comment[ta]=பிம்பத்தை மாற்றும் வடிகட்டி
+Comment[tg]=Филтр барои масштабонии тасвирот
+Comment[tr]=Resmi oranlamak için filtre
+Comment[uk]=Фільтр для масштабування зображення
+Comment[ven]=Faela yau kala tshifanyiso
+Comment[wa]=Passete po mete l' imådje al schåle
+Comment[xh]=Icebo lokucoca ulwelo lokukala umfanekiso
+Comment[zh_CN]=缩放图像的滤镜
+Comment[zh_HK]=用來縮放影像的過濾器
+Comment[zh_TW]=用來縮放影像的濾鏡
+Comment[zu]=Hluza isithombe esikaleni
+Type=Plugin
+
+[X-KDE Plugin Info]
+Author=Matthias Kretz
+Email=kretz@kde.org
+PluginName=kview_scale
+Category=Filter
+Version=0.1
diff --git a/kview/modules/scale/kview_scale.h b/kview/modules/scale/kview_scale.h
new file mode 100644
index 00000000..2022f0ac
--- /dev/null
+++ b/kview/modules/scale/kview_scale.h
@@ -0,0 +1,48 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+/* $Id$ */
+
+#ifndef __kview_scale_h
+#define __kview_scale_h
+
+#include <kparts/plugin.h>
+
+namespace KImageViewer {
+ class Viewer;
+ class Canvas;
+}
+
+class KViewScale : public KParts::Plugin
+{
+ Q_OBJECT
+public:
+ KViewScale( QObject* parent, const char* name, const QStringList & );
+ virtual ~KViewScale();
+
+private slots:
+ void slotScaleDlg();
+ void slotScale();
+
+private:
+ KImageViewer::Viewer * m_pViewer;
+ KImageViewer::Canvas * m_pCanvas;
+};
+
+// vim:sw=4:ts=4:cindent
+#endif
diff --git a/kview/modules/scale/kview_scale.rc b/kview/modules/scale/kview_scale.rc
new file mode 100644
index 00000000..2f952be5
--- /dev/null
+++ b/kview/modules/scale/kview_scale.rc
@@ -0,0 +1,14 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="kview_scale" library="kview_scale">
+ <MenuBar>
+ <Menu name="image"><Text>&amp;Image</Text>
+ <Action name="plugin_scale"/>
+ </Menu>
+ </MenuBar>
+ <!--
+ <ToolBar name="extraToolBar">
+ <text>&amp;Extra Toolbar</text>
+ <Action name="plugin_scale"/>
+ </ToolBar>
+ -->
+</kpartplugin>
diff --git a/kview/modules/scale/scaledlg.cpp b/kview/modules/scale/scaledlg.cpp
new file mode 100644
index 00000000..997be86d
--- /dev/null
+++ b/kview/modules/scale/scaledlg.cpp
@@ -0,0 +1,311 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+// $Id$
+
+#include "scaledlg.h"
+
+#include <qvbox.h>
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qspinbox.h>
+#include <qcheckbox.h>
+#include <qgroupbox.h>
+#include <qsize.h>
+
+#include <kdebug.h>
+#include <kcombobox.h>
+#include <klocale.h>
+#include <kdialog.h>
+#include "kfloatspinbox.h"
+#include <kglobal.h>
+
+#define ONEINCHINMM 2.54
+
+ScaleDlg::ScaleDlg( const QSize & origsize, QVBox * parent, const char * name )
+ : QObject( parent, name )
+ , m_origsize( origsize )
+ , m_newsizeunit( 0 )
+ , m_newsizeunit2( 0 )
+ , m_resolutionunit( 0 )
+ , m_newwidth( origsize.width() )
+ , m_newheight( origsize.height() )
+ , m_resx( 72 )
+ , m_resy( 72 )
+{
+ QGroupBox * pixelgroup = new QGroupBox( i18n( "Pixel Dimensions" ), parent );
+ QGroupBox * printgroup = new QGroupBox( i18n( "Print Size && Display Units" ), parent );
+
+ QGridLayout * pixelgroupgrid = new QGridLayout( pixelgroup, 1, 1,
+ KDialog::marginHint(), KDialog::spacingHint() );
+ QGridLayout * printgroupgrid = new QGridLayout( printgroup, 1, 1,
+ KDialog::marginHint(), KDialog::spacingHint() );
+
+ QLabel * label;
+
+ pixelgroupgrid->addRowSpacing( 0, KDialog::spacingHint() );
+
+ label = new QLabel( i18n( "Original width:" ), pixelgroup );
+ label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+ pixelgroupgrid->addWidget( label, 1, 0 );
+ label = new QLabel( i18n( "Height:" ), pixelgroup );
+ label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+ pixelgroupgrid->addWidget( label, 2, 0 );
+
+ pixelgroupgrid->addRowSpacing( 3, KDialog::spacingHint() );
+
+ label = new QLabel( i18n( "New width:" ), pixelgroup );
+ label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+ pixelgroupgrid->addWidget( label, 4, 0 );
+ label = new QLabel( i18n( "Height:" ), pixelgroup );
+ label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+ pixelgroupgrid->addWidget( label, 5, 0 );
+
+ pixelgroupgrid->addRowSpacing( 6, KDialog::spacingHint() );
+
+ label = new QLabel( i18n( "Ratio X:" ), pixelgroup );
+ label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+ pixelgroupgrid->addWidget( label, 7, 0 );
+ label = new QLabel( i18n( "Y:" ), pixelgroup );
+ label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+ pixelgroupgrid->addWidget( label, 8, 0 );
+
+ printgroupgrid->addRowSpacing( 0, KDialog::spacingHint() );
+
+ label = new QLabel( i18n( "New width:" ), printgroup );
+ label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+ printgroupgrid->addWidget( label, 1, 0 );
+ label = new QLabel( i18n( "Height:" ), printgroup );
+ label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+ printgroupgrid->addWidget( label, 2, 0 );
+
+ printgroupgrid->addRowSpacing( 3, KDialog::spacingHint() );
+
+ label = new QLabel( i18n( "Resolution X:" ), printgroup );
+ label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+ printgroupgrid->addWidget( label, 4, 0 );
+ label = new QLabel( i18n( "Y:" ), printgroup );
+ label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+ printgroupgrid->addWidget( label, 5, 0 );
+
+ m_pOldWidth = new QLabel( QString::number( origsize.width() ), pixelgroup );
+ m_pOldWidth->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+ pixelgroupgrid->addWidget( m_pOldWidth, 1, 1 );
+ m_pOldHeight = new QLabel( QString::number( origsize.height() ), pixelgroup );
+ m_pOldHeight->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+ pixelgroupgrid->addWidget( m_pOldHeight, 2, 1 );
+
+ m_pNewWidth = new KFloatSpinBox( 1.0, 100000.0, 10.0, 0, pixelgroup );
+ pixelgroupgrid->addWidget( m_pNewWidth, 4, 1 );
+ m_pNewHeight = new KFloatSpinBox( 1.0, 100000.0, 10.0, 0, pixelgroup );
+ pixelgroupgrid->addWidget( m_pNewHeight, 5, 1 );
+
+ m_pNewSizeUnit = new KComboBox( pixelgroup );
+ m_pNewSizeUnit->insertItem( i18n( "px" ) );
+ m_pNewSizeUnit->insertItem( i18n( "%" ) );
+ pixelgroupgrid->addMultiCellWidget( m_pNewSizeUnit, 4, 5, 2, 2, Qt::AlignVCenter );
+
+ m_pRatioX = new KFloatSpinBox( 0.0001, 10000.0, 0.1, 4, pixelgroup );
+ pixelgroupgrid->addWidget( m_pRatioX, 7, 1 );
+ m_pRatioY = new KFloatSpinBox( 0.0001, 10000.0, 0.1, 4, pixelgroup );
+ pixelgroupgrid->addWidget( m_pRatioY, 8, 1 );
+
+ m_pLinkRatio = new QCheckBox( i18n( "Link" ), pixelgroup );
+ pixelgroupgrid->addMultiCellWidget( m_pLinkRatio, 7, 8, 2, 2, Qt::AlignVCenter );
+
+ m_pNewWidth2 = new KFloatSpinBox( 0.0001, 10000.0, 0.1, 4, printgroup );
+ printgroupgrid->addWidget( m_pNewWidth2, 1, 1 );
+ m_pNewHeight2 = new KFloatSpinBox( 0.0001, 10000.0, 0.1, 4, printgroup );
+ printgroupgrid->addWidget( m_pNewHeight2, 2, 1 );
+
+ m_pNewSizeUnit2 = new KComboBox( printgroup );
+ m_pNewSizeUnit2->insertItem( i18n( "in" ) );
+ m_pNewSizeUnit2->insertItem( i18n( "mm" ) );
+ printgroupgrid->addMultiCellWidget( m_pNewSizeUnit2, 1, 2, 2, 2, Qt::AlignVCenter );
+
+ m_pResolutionX = new KFloatSpinBox( 0.0001, 6000.0, 1.0, 4, printgroup );
+ printgroupgrid->addWidget( m_pResolutionX, 4, 1 );
+ m_pResolutionY = new KFloatSpinBox( 0.0001, 6000.0, 1.0, 4, printgroup );
+ printgroupgrid->addWidget( m_pResolutionY, 5, 1 );
+
+ m_pLinkResolution = new QCheckBox( i18n( "Link" ), printgroup );
+ printgroupgrid->addMultiCellWidget( m_pLinkResolution, 4, 5, 2, 2, Qt::AlignVCenter );
+ m_pResolutionUnit = new KComboBox( printgroup );
+ m_pResolutionUnit->insertItem( i18n( "pixels/in" ) );
+ m_pResolutionUnit->insertItem( i18n( "pixels/mm" ) );
+ printgroupgrid->addMultiCellWidget( m_pResolutionUnit, 6, 6, 1, 2, Qt::AlignLeft );
+
+ m_pNewWidth->setValue( m_origsize.width() );
+ m_pNewHeight->setValue( m_origsize.height() );
+
+ m_newsizeunit = 0;
+ m_newsizeunit2 = 0;
+ m_resolutionunit = 0;
+
+ connect( m_pNewWidth, SIGNAL( valueChanged( float ) ), SLOT( slotNewWidth( float ) ) );
+ connect( m_pNewHeight, SIGNAL( valueChanged( float ) ), SLOT( slotNewHeight( float ) ) );
+ connect( m_pNewWidth2, SIGNAL( valueChanged( float ) ), SLOT( slotNewWidth2( float ) ) );
+ connect( m_pNewHeight2, SIGNAL( valueChanged( float ) ), SLOT( slotNewHeight2( float ) ) );
+ connect( m_pResolutionX, SIGNAL( valueChanged( float ) ), SLOT( slotResolutionX( float ) ) );
+ connect( m_pResolutionY, SIGNAL( valueChanged( float ) ), SLOT( slotResolutionY( float ) ) );
+
+ connect( m_pNewSizeUnit, SIGNAL( activated( int ) ), SLOT( slotChangeNewSizeUnit( int ) ) );
+ connect( m_pNewSizeUnit2, SIGNAL( activated( int ) ), SLOT( slotChangeNewSizeUnit2( int ) ) );
+ connect( m_pResolutionUnit, SIGNAL( activated( int ) ), SLOT( slotChangeResolutionUnit( int ) ) );
+}
+
+ScaleDlg::~ScaleDlg()
+{
+}
+
+void ScaleDlg::slotNewWidth( float newval )
+{
+ float newwidth;
+ switch( m_newsizeunit )
+ {
+ case 0: // Pixel
+ newwidth = newval;
+ break;
+ case 1: // Percent
+ newwidth = newval / 100.0 * m_origsize.width();
+ break;
+ default:
+ kdError( 4630 ) << "unknown unit\n";
+ break;
+ }
+
+ m_newwidth = newwidth;
+ m_pNewWidth2->setValueBlocking( m_newwidth / m_resx / ( m_newsizeunit2 ? ONEINCHINMM : 1 ) );
+ m_pRatioX->setValueBlocking( m_newwidth / m_origsize.width() );
+ if( m_pLinkRatio->isChecked() )
+ {
+ m_newheight = m_newwidth / m_origsize.width() * m_origsize.height();
+ m_pNewHeight->setValueBlocking( m_newheight * ( m_newsizeunit ? 100.0 / m_origsize.height() : 1 ) );
+ m_pRatioY->setValueBlocking( m_newheight / m_origsize.height() );
+ m_pNewHeight2->setValueBlocking( m_newheight / m_resy / ( m_newsizeunit2 ? ONEINCHINMM : 1 ) );
+ }
+}
+
+void ScaleDlg::slotNewHeight( float newval )
+{
+}
+
+void ScaleDlg::slotNewWidth2( float newval )
+{
+}
+
+void ScaleDlg::slotNewHeight2( float newval )
+{
+}
+
+void ScaleDlg::slotResolutionX( float newval )
+{
+}
+
+void ScaleDlg::slotResolutionY( float newval )
+{
+}
+
+void ScaleDlg::slotChangeNewSizeUnit( int index )
+{
+ if( m_newsizeunit == index )
+ return;
+
+ m_newsizeunit = index;
+
+ switch( m_newsizeunit )
+ {
+ case 0:
+ // Pixel
+ m_pNewWidth->setRange( 1.0, 100000.0, 10.0, 0 );
+ m_pNewHeight->setRange( 1.0, 100000.0, 10.0, 0 );
+ m_pNewWidth->setValueBlocking( m_newwidth );
+ m_pNewHeight->setValueBlocking( m_newheight );
+ break;
+ case 1:
+ // Percent
+ m_pNewWidth->setRange( 0.0001, 100000.0, 0.1, 4 );
+ m_pNewHeight->setRange( 0.0001, 100000.0, 0.1, 4 );
+ m_pNewWidth->setValueBlocking( m_newwidth * 100.0 / m_origsize.width() );
+ m_pNewHeight->setValueBlocking( m_newheight * 100.0 / m_origsize.height() );
+ break;
+ default:
+ kdError( 4630 ) << "change to unknown unit\n";
+ break;
+ }
+}
+
+void ScaleDlg::slotChangeNewSizeUnit2( int index )
+{
+ if( m_newsizeunit2 == index )
+ return;
+
+ m_newsizeunit2 = index;
+
+ switch( m_newsizeunit2 )
+ {
+ case 0:
+ // Inch
+ m_pNewWidth2->setRange( 0.0001, 10000.0, 0.1, 4 );
+ m_pNewHeight2->setRange( 0.0001, 10000.0, 0.1, 4 );
+ m_pNewWidth2->setValueBlocking( m_newwidth / m_resx );
+ m_pNewHeight2->setValueBlocking( m_newheight / m_resy );
+ break;
+ case 1:
+ // Millimeter
+ m_pNewWidth2->setRange( 0.0002, 25400.0, 0.1, 4 );
+ m_pNewHeight2->setRange( 0.0002, 25400.0, 0.1, 4 );
+ m_pNewWidth2->setValueBlocking( m_newwidth / m_resx / ONEINCHINMM );
+ m_pNewHeight2->setValueBlocking( m_newheight / m_resy / ONEINCHINMM );
+ break;
+ default:
+ kdError( 4630 ) << "change to unknown unit\n";
+ break;
+ }
+}
+
+void ScaleDlg::slotChangeResolutionUnit( int index )
+{
+ if( m_resolutionunit == index )
+ return;
+
+ m_resolutionunit = index;
+
+ switch( m_resolutionunit )
+ {
+ case 0:
+ // Pixels per Inch
+ m_pResolutionX->setRange( 0.0002, 25400.0, 0.1, 4 );
+ m_pResolutionY->setRange( 0.0002, 25400.0, 0.1, 4 );
+ m_pResolutionX->setValueBlocking( m_resx );
+ m_pResolutionY->setValueBlocking( m_resy );
+ break;
+ case 1:
+ // Pixels per Millimeter
+ m_pResolutionX->setRange( 0.0001, 10000.0, 0.1, 4 );
+ m_pResolutionY->setRange( 0.0001, 10000.0, 0.1, 4 );
+ m_pResolutionX->setValueBlocking( m_resx / ONEINCHINMM );
+ m_pResolutionY->setValueBlocking( m_resy / ONEINCHINMM );
+ break;
+ default:
+ kdError( 4630 ) << "change to unknown unit\n";
+ break;
+ }
+}
+
+#include "scaledlg.moc"
diff --git a/kview/modules/scale/scaledlg.h b/kview/modules/scale/scaledlg.h
new file mode 100644
index 00000000..ac5a6c44
--- /dev/null
+++ b/kview/modules/scale/scaledlg.h
@@ -0,0 +1,78 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+// $Id$
+
+#ifndef __scaledlg_h_
+#define __scaledlg_h_
+
+#include <qobject.h>
+
+class QLabel;
+class KFloatSpinBox;
+class KComboBox;
+class QCheckBox;
+class QVBox;
+class QSize;
+
+class ScaleDlg : public QObject
+{
+ Q_OBJECT
+ public:
+ ScaleDlg( const QSize & originalsize, QVBox * parent, const char * name = 0 );
+ ~ScaleDlg();
+
+ private slots:
+ void slotNewWidth( float );
+ void slotNewHeight( float );
+ void slotNewWidth2( float );
+ void slotNewHeight2( float );
+ void slotResolutionX( float );
+ void slotResolutionY( float );
+ void slotChangeNewSizeUnit( int );
+ void slotChangeNewSizeUnit2( int );
+ void slotChangeResolutionUnit( int );
+
+ private:
+ QSize m_origsize;
+ int m_newsizeunit;
+ int m_newsizeunit2;
+ int m_resolutionunit;
+
+ float m_newwidth, m_newheight; // in Pixel
+ float m_resx, m_resy; // in dpi
+
+ QLabel * m_pOldWidth;
+ QLabel * m_pOldHeight;
+ KFloatSpinBox * m_pNewWidth;
+ KFloatSpinBox * m_pNewHeight;
+ KComboBox * m_pNewSizeUnit;
+ KFloatSpinBox * m_pRatioX;
+ KFloatSpinBox * m_pRatioY;
+ QCheckBox * m_pLinkRatio;
+
+ KFloatSpinBox * m_pNewWidth2;
+ KFloatSpinBox * m_pNewHeight2;
+ KComboBox * m_pNewSizeUnit2;
+ KFloatSpinBox * m_pResolutionX;
+ KFloatSpinBox * m_pResolutionY;
+ QCheckBox * m_pLinkResolution;
+ KComboBox * m_pResolutionUnit;
+};
+
+#endif
diff --git a/kview/modules/scanner/Makefile.am b/kview/modules/scanner/Makefile.am
new file mode 100644
index 00000000..83a22b32
--- /dev/null
+++ b/kview/modules/scanner/Makefile.am
@@ -0,0 +1,15 @@
+INCLUDES = -I$(top_srcdir)/kview $(all_includes)
+
+kde_module_LTLIBRARIES = kview_scannerplugin.la
+
+kview_scannerplugin_la_SOURCES = kviewscanner.cpp
+kview_scannerplugin_la_LIBADD = $(LIB_KFILE) $(LIB_KPARTS) -lkdeprint
+kview_scannerplugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+
+plugdir = $(kde_datadir)/kview/kpartplugins
+plug_DATA = kviewscanner.desktop kviewscanner.rc
+
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/kviewscannerplugin.pot
diff --git a/kview/modules/scanner/kviewscanner.cpp b/kview/modules/scanner/kviewscanner.cpp
new file mode 100644
index 00000000..d1f96e5f
--- /dev/null
+++ b/kview/modules/scanner/kviewscanner.cpp
@@ -0,0 +1,96 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+// $Id$
+
+#include "kviewscanner.h"
+
+#include <qimage.h>
+#include <qobjectlist.h>
+
+#include <kaction.h>
+#include <kinstance.h>
+#include <klocale.h>
+#include <kgenericfactory.h>
+#include <kscan.h>
+#include <kmessagebox.h>
+#include <kdebug.h>
+#include <kimageviewer/viewer.h>
+
+typedef KGenericFactory<KViewScanner> KViewScannerFactory;
+K_EXPORT_COMPONENT_FACTORY( kview_scannerplugin, KViewScannerFactory( "kviewscannerplugin" ) )
+
+KViewScanner::KViewScanner( QObject* parent, const char* name,
+ const QStringList & )
+ : Plugin( parent, name ),
+ m_pScandlg( 0 ),
+ m_pViewer( 0 )
+{
+ QObjectList * viewerList = parent->queryList( 0, "KImageViewer Part", false, false );
+ m_pViewer = static_cast<KImageViewer::Viewer *>( viewerList->getFirst() );
+ delete viewerList;
+ if( m_pViewer )
+ {
+ (void) new KAction( i18n( "&Scan Image..." ), "scanner", 0,
+ this, SLOT( slotScan() ),
+ actionCollection(), "plugin_scan" );
+ }
+ else
+ kdWarning( 4630 ) << "no KImageViewer interface found - the scanner plugin won't work" << endl;
+}
+
+KViewScanner::~KViewScanner()
+{
+}
+
+void KViewScanner::slotScan()
+{
+ if( ! m_pScandlg )
+ {
+ m_pScandlg = KScanDialog::getScanDialog();
+ if( m_pScandlg )
+ {
+ m_pScandlg->setMinimumSize( 300, 300 );
+
+ connect( m_pScandlg, SIGNAL( finalImage( const QImage &, int ) ),
+ this, SLOT( slotImgScanned( const QImage & ) ) );
+ }
+ else
+ {
+ KMessageBox::sorry( 0L,
+ i18n( "You do not appear to have SANE support, or your scanner "
+ "is not attached properly. Please check these items before "
+ "scanning again." ),
+ i18n( "No Scan-Service Available" ) );
+ kdDebug( 4630 ) << "*** No Scan-service available, aborting!" << endl;
+ return;
+ }
+ }
+
+ if( m_pScandlg->setup() )
+ m_pScandlg->show();
+}
+
+void KViewScanner::slotImgScanned( const QImage & img )
+{
+ kdDebug( 4630 ) << "received an image from the scanner" << endl;
+ m_pViewer->newImage( img );
+}
+
+// vim:sw=4:ts=4:cindent
+#include "kviewscanner.moc"
diff --git a/kview/modules/scanner/kviewscanner.desktop b/kview/modules/scanner/kviewscanner.desktop
new file mode 100644
index 00000000..99abe5ff
--- /dev/null
+++ b/kview/modules/scanner/kviewscanner.desktop
@@ -0,0 +1,127 @@
+[Desktop Entry]
+Icon=scanner
+Type=Service
+ServiceTypes=KPluginInfo
+
+X-KDE-PluginInfo-Author=Matthias Kretz
+X-KDE-PluginInfo-Email=kretz@kde.org
+X-KDE-PluginInfo-Name=kviewscanner
+X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=false
+
+Name=Scanner
+Name[af]=Skandeerder
+Name[ar]=الماسح الضوئي
+Name[bg]=Скенер
+Name[br]=Eiltreser
+Name[bs]=Skener
+Name[ca]=Escàner
+Name[cy]=Sganiwr
+Name[da]=Skanner
+Name[el]=Σαρωτής
+Name[eo]=Skanilo
+Name[et]=Skänner
+Name[eu]=Eskanerra
+Name[fa]=پویشگر
+Name[fi]=Skanneri
+Name[fo]=Ljóslesari
+Name[ga]=Scanóir
+Name[gl]=Escáner
+Name[he]=סורק
+Name[hi]=स्कैनर
+Name[hr]=Skener
+Name[hu]=Lapolvasó
+Name[is]=Skanni
+Name[ja]=スキャナ
+Name[kk]=Сканер
+Name[km]=ម៉ាស៊ីន​ស្កេន
+Name[lt]=Skaneris
+Name[ms]=Pengimbas
+Name[nb]=Skanner
+Name[nds]=Bildinleser
+Name[ne]=स्क्यानर
+Name[nl]=Scanprogramma
+Name[nn]=Skannar
+Name[nso]=Selebeledi
+Name[pa]=ਸਕੈਨਰ
+Name[pl]=Skaner
+Name[pt]=Digitalizador
+Name[pt_BR]=Digitalizador
+Name[ro]=Scaner
+Name[ru]=Сканер
+Name[se]=Skánner
+Name[sk]=Skener
+Name[sl]=Skener
+Name[sr]=Скенер
+Name[sr@Latn]=Skener
+Name[sv]=Bildläsare
+Name[ta]=வருடி
+Name[tg]=Сканер
+Name[tr]=Tarayıcı
+Name[uk]=Сканер
+Name[uz]=Skanner
+Name[uz@cyrillic]=Сканнер
+Name[ven]=Tshinanguludzi
+Name[wa]=Sicanrece
+Name[xh]=Umvavanyi
+Name[zh_CN]=扫描仪
+Name[zh_HK]=掃描器
+Name[zh_TW]=掃描器
+Name[zu]=Umhloli
+Comment=Open images from your scanner into KView
+Comment[af]=Open beelde van jou skandeerder binnein K-bekyk
+Comment[ar]=يفتح الصور الموجودة على ماسحك الضوئي في برنامج KView
+Comment[bg]=Сканиране и отваряне на изображения от скенера
+Comment[bs]=Otvara slike sa skenera u KView
+Comment[ca]=Obre les imatges de l'escàner a KView
+Comment[cs]=Otevírá obrázky ze skeneru do KView
+Comment[cy]=Agor delweddau oddiwrth eich sganiwr yn KGweld
+Comment[da]=åbn billeder fra din skanner til KView
+Comment[de]=Lädt Bilder vom Scanner in KView
+Comment[el]=Ανοίξτε εικόνες από το σαρωτή σας στο KView
+Comment[es]=Abre imágenes desde su escáner en KView
+Comment[et]=Avab skaneeritud pilte rakendusega KView
+Comment[eu]=Zure eskanerretik irudiak KView-en erakusten ditu
+Comment[fa]=باز کردن تصاویر از پویشگرتان در KView
+Comment[fi]=Avaa kuvan skannerilta KView-ohjelmaan
+Comment[fr]=Ouvre des images de votre scanner dans KView
+Comment[gl]=Obre as imaxes do teu escáner en KView
+Comment[he]=פתיחת תמונות מהסורק שלך ב־KView
+Comment[hi]=आपके स्कैनर से के-व्यू में छवि खोलता है
+Comment[hu]=Kép beolvasása lapolvasóról a KView-ba
+Comment[is]=Senda myndir frá skannanum í KView
+Comment[it]=Apre le immagini provenienti dallo scanner in KView
+Comment[ja]=スキャナから画像を開き KView に転送します
+Comment[kk]=Сканерден KView-ға кескінді түсіру
+Comment[km]=បើក​រូបភាព​ពី​ម៉ាស៊ីន​ស្កេន​របស់​អ្នក​ក្នុង KView
+Comment[lt]=Atveria paveikslėlius iš Jūsų skanerio į KView
+Comment[ms]=Buka imej dari pengimbas anda ke dalam KView
+Comment[nb]=Åpner bilder fra skanneren til KView
+Comment[nds]=Haalt Biller vun Dien Inleser na KView
+Comment[ne]=तपाईँको स्क्यानरबाट केडीई दृश्य भित्र छवि खोल्नुहोस्
+Comment[nl]=Scan afbeeldingen rechtstreeks in KView
+Comment[nn]=Opnar bilete frå skannaren i KView
+Comment[nso]=Bula diponagalo gotswa go selebeledi sa gago goya kago KView
+Comment[pl]=Otwiera obrazki ze skanera w przeglądarce KView
+Comment[pt]=Abrir as imagens do seu 'scanner' no KView
+Comment[pt_BR]=Abre imagens do seu digitalizador no KVisualização
+Comment[ro]=Deschide imagini din scaner în KView
+Comment[ru]=Сканирование изображений в KView
+Comment[se]=Rahpá govaid skánneris KView:as
+Comment[sk]=Otvorí obrázky z vášho skeneru v KView
+Comment[sl]=Odpre sliko iz vašega skenerja v KView
+Comment[sr]=Отвара слике из вашег скенера у KView-у
+Comment[sr@Latn]=Otvara slike iz vašeg skenera u KView-u
+Comment[sv]=Öppnar bilder från bildläsaren i Kview
+Comment[ta]= கேகாட்சியின் வருடியில் இருந்து பிம்பங்களைத் திற
+Comment[tg]=Сканеронии тасвирот дар KView
+Comment[tr]=Tarayıcıdan KView'a resim gönderin
+Comment[uk]=Відкриває зображення з вашого сканера в KView
+Comment[ven]=Vulani zwifanyiso ubva kha tshinanguludzi uya kha mbonalelo ya K
+Comment[wa]=Drovi des imådjes di vosse sicanrece avou KView
+Comment[xh]=Vula imifanekiso evela kumvavanyisi wakho kwi KView
+Comment[zh_CN]=从您的扫描仪中打开图像至 KView
+Comment[zh_HK]=從您的掃描器開啟圖像至 KView
+Comment[zh_TW]=從您的掃描器開啟影像至 KView
+Comment[zu]=Vula izithombe ezisuka kumhloli wakho kwi-KView
diff --git a/kview/modules/scanner/kviewscanner.h b/kview/modules/scanner/kviewscanner.h
new file mode 100644
index 00000000..cdb32d67
--- /dev/null
+++ b/kview/modules/scanner/kviewscanner.h
@@ -0,0 +1,50 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ 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, Boston, MA 02110-1301, USA.
+
+*/
+
+// $Id$
+
+#ifndef __kviewscanner_h
+#define __kviewscanner_h
+
+#include <kparts/plugin.h>
+#include <klibloader.h>
+
+class KURL;
+class KScanDialog;
+namespace KImageViewer { class Viewer; }
+
+class KViewScanner : public KParts::Plugin
+{
+ Q_OBJECT
+public:
+ KViewScanner( QObject* parent, const char* name, const QStringList & );
+ virtual ~KViewScanner();
+
+//public slots:
+
+private slots:
+ void slotScan();
+ void slotImgScanned( const QImage & );
+
+private:
+ KScanDialog * m_pScandlg;
+ KImageViewer::Viewer * m_pViewer;
+};
+
+// vim:sw=4:ts=4:cindent
+#endif
diff --git a/kview/modules/scanner/kviewscanner.rc b/kview/modules/scanner/kviewscanner.rc
new file mode 100644
index 00000000..43e60593
--- /dev/null
+++ b/kview/modules/scanner/kviewscanner.rc
@@ -0,0 +1,12 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="kviewscanner" library="kview_scannerplugin">
+ <MenuBar>
+ <Menu name="tools"><Text>&amp;Tools</Text>
+ <Action name="plugin_scan"/>
+ </Menu>
+ </MenuBar>
+ <ToolBar name="extraToolBar">
+ <text>Extra Toolbar</text>
+ <Action name="plugin_scan"/>
+ </ToolBar>
+</kpartplugin>
diff --git a/kview/modules/template/Makefile.am b/kview/modules/template/Makefile.am
new file mode 100644
index 00000000..29ddc94c
--- /dev/null
+++ b/kview/modules/template/Makefile.am
@@ -0,0 +1,15 @@
+INCLUDES = -I$(top_srcdir)/kview $(all_includes)
+
+kde_module_LTLIBRARIES = kview_templateplugin.la
+
+kview_templateplugin_la_SOURCES = kviewtemplate.cpp
+kview_templateplugin_la_LIBADD = $(LIB_KFILE) $(LIB_KPARTS) -lkdeprint
+kview_templateplugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+
+plugdir = $(kde_datadir)/kview/kpartplugins
+plug_DATA = kviewtemplate.desktop kviewtemplate.rc
+
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/kviewtemplateplugin.pot
diff --git a/kview/modules/template/kviewtemplate.cpp b/kview/modules/template/kviewtemplate.cpp
new file mode 100644
index 00000000..c8c6dc9d
--- /dev/null
+++ b/kview/modules/template/kviewtemplate.cpp
@@ -0,0 +1,43 @@
+/* This file is in the public domain */
+
+// $Id$
+
+#include "kviewtemplate.h"
+
+#include <qobjectlist.h>
+
+#include <kaction.h>
+/*#include <klocale.h>*/
+#include <kgenericfactory.h>
+#include <kdebug.h>
+#include <kimageviewer/viewer.h>
+
+typedef KGenericFactory<KViewTemplate> KViewTemplateFactory;
+K_EXPORT_COMPONENT_FACTORY( kview_templateplugin, KViewTemplateFactory( "kviewtemplateplugin" ) )
+
+KViewTemplate::KViewTemplate( QObject* parent, const char* name, const QStringList & )
+ : Plugin( parent, name )
+{
+ QObjectList * viewerList = parent->queryList( 0, "KImageViewer Part", false, false );
+ m_pViewer = static_cast<KImageViewer::Viewer *>( viewerList->getFirst() );
+ delete viewerList;
+ if( m_pViewer )
+ {
+ (void) new KAction( /*i18n(*/ "&Do Something" /*)*/, 0, 0,
+ this, SLOT( yourSlot() ),
+ actionCollection(), "plugin_template" );
+ }
+ else
+ kdWarning( 4630 ) << "no KImageViewer interface found - the template plugin won't work" << endl;
+}
+
+KViewTemplate::~KViewTemplate()
+{
+}
+
+void KViewTemplate::yourSlot()
+{
+}
+
+// vim:sw=4:ts=4:cindent
+#include "kviewtemplate.moc"
diff --git a/kview/modules/template/kviewtemplate.desktop b/kview/modules/template/kviewtemplate.desktop
new file mode 100644
index 00000000..e1039d06
--- /dev/null
+++ b/kview/modules/template/kviewtemplate.desktop
@@ -0,0 +1,129 @@
+[Desktop Entry]
+Icon=mypluginicon
+Type=Service
+ServiceTypes=KPluginInfo
+
+X-KDE-PluginInfo-Author=Your Name
+X-KDE-PluginInfo-Email=Your@address
+X-KDE-PluginInfo-Name=kviewtemplate
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-License=Public Domain
+X-KDE-PluginInfo-EnabledByDefault=true
+
+Name=Template
+Name[af]=Werkvoorbeeld
+Name[ar]=قالب
+Name[bg]=Шаблон
+Name[br]=Patrom
+Name[bs]=Šablon
+Name[ca]=Plantilla
+Name[cs]=Šablona
+Name[cy]=Patrymlun
+Name[da]=Skabelon
+Name[de]=Vorlage
+Name[el]=Πρότυπο
+Name[eo]=Ŝablono
+Name[es]=Plantilla
+Name[et]=Mallid
+Name[eu]=Txantiloia
+Name[fa]=قالب
+Name[fi]=Pohja
+Name[fr]=Modèle
+Name[ga]=Teimpléad
+Name[gl]=Modelo
+Name[he]=תבנית
+Name[hi]=टैम्प्लेट
+Name[hu]=Sablon
+Name[is]=Snið
+Name[it]=Modello
+Name[ja]=テンプレート
+Name[kk]=Үлгі
+Name[km]=ពុម្ព
+Name[lt]=Šablonas
+Name[ms]=Templat
+Name[nb]=Mal
+Name[nds]=Vörlaag
+Name[ne]=टेम्प्लेट
+Name[nl]=Sjabloon
+Name[nn]=Mal
+Name[nso]=Papiso
+Name[pl]=Wzorzec
+Name[pt]=Modelo
+Name[pt_BR]=Modelo
+Name[ro]=Model
+Name[ru]=Шаблон
+Name[se]=Málle
+Name[sk]=Šablóna
+Name[sl]=Predloga
+Name[sr]=Шаблон
+Name[sr@Latn]=Šablon
+Name[sv]=Mall
+Name[ta]=வார்ப்புரு
+Name[tg]=Қолиб
+Name[tr]=Şablon
+Name[uk]=Шаблон
+Name[uz]=Namuna
+Name[uz@cyrillic]=Намуна
+Name[wa]=Modele
+Name[zh_CN]=模板
+Name[zh_HK]=範本
+Name[zh_TW]=範本
+Name[zu]=i-template
+Comment=A longer description of what the plugin does
+Comment[af]='n langer beskrywing van wat die inplak doen
+Comment[ar]=وصف أطول عن عمل البرنامج المساعد
+Comment[bg]=Подробно описание на приставката
+Comment[bs]=Duži opis onoga što dodatak radi
+Comment[ca]=Una descripció més llarga del que fa l'endollat
+Comment[cs]=Zde by měl být delší popis modulu
+Comment[cy]=Disgrifiad hirach o beth mae'r ategyn yn ei wneud
+Comment[da]=En længere beskrivelse af hvad dette plugin gør
+Comment[de]=Hier sollte eine längere Beschreibung des Moduls stehen
+Comment[el]=Μια μεγαλύτερη περιγραφή για το τι κάνει το πρόσθετο
+Comment[eo]=Pli longa priskribo pri la kromaĵo
+Comment[es]=Una descripción más completa de la función del plugin
+Comment[et]=Pluginate tegevuse pikemad kirjeldused
+Comment[eu]=Pluginak egiten duenaren azalpen luzeagoa
+Comment[fa]=توصیفی طولانی‌تر از آنچه وصله انجام می‌دهد
+Comment[fi]=Pidempi kuvaus, mitä liitännäinen tekee
+Comment[fr]=Une plus longue description de ce que fait le module
+Comment[gl]=Unha descrición máis longa do que pode facer a extensión
+Comment[he]=תיאור מפורט יותר לגבי מה שהתוסף עושה
+Comment[hi]=प्लगइन के बारे में लंबा वर्णन कि वह क्या करता है
+Comment[hr]=Duži opis umetka
+Comment[hu]=Ez a bővítőmodul részletesebb leírása
+Comment[is]=hér ætti að vera smá lýsing á hvað þetta gerir
+Comment[it]=Una descrizione più lunga di quello che fa il plugin
+Comment[ja]=ここにより詳細なプラグインの記述をします
+Comment[kk]=Плагин модульдің түсініктемесі
+Comment[km]=សេចក្ដី​ពណ៌នា​វែង អំពី​មុខងារ​របស់​កម្មវិធី​ជំនួយ
+Comment[lt]=Ilgesnis aprašymas, ką daro priedas
+Comment[ms]=Huraian panjang tentang apa yang plugin lakukan
+Comment[nb]=En lengre beskrivelse av hva modulen gjør
+Comment[nds]=En länger Beschrieven vun't Könen vun dat Moduul
+Comment[ne]=प्लगइनले गर्ने कामको बारेमा लामो वर्णन
+Comment[nl]=Plaats hier een kleine omschrijving van uw plugin
+Comment[nn]=Ei lengre skildring av kva modulen gjer
+Comment[nso]=Thlaloso ye telele ya seo ya seo plugin ese dirago
+Comment[pl]=Dłuższy opis tego, co wtyczka robi
+Comment[pt]=Uma descrição mais extensa do que o 'plugin' faz
+Comment[pt_BR]= Uma descrição maior do que um plugin faz
+Comment[ro]=O descriere mai lungă a modulului
+Comment[ru]=А здесь должно быть описание модуля
+Comment[se]=Guhkkit čilgehus mii muitala maid lassemoduvla bargá
+Comment[sk]=Tu by mal byť popis, čo modul robí
+Comment[sl]=Daljši opis, kaj naredi ta vstavek
+Comment[sr]=Дужи опис чему прикључак служи
+Comment[sr@Latn]=Duži opis čemu priključak služi
+Comment[sv]=En längre beskrivningen av vad insticksprogrammet gör
+Comment[ta]= சொருகுப்பொருள் செய்த பணியின் நீண்ட வருணனை
+Comment[tg]=Дар инҷо бояд тасвироти модул бошад
+Comment[tr]=Eklentinin uzun açıklaması
+Comment[uk]=Докладний опис можливостей втулку
+Comment[ven]=Thalutshedzo khulwane ya ine plugin ya ita zwone
+Comment[wa]=On discrijhaedje pus complet di çou k' est fwait på tchôke-divins
+Comment[xh]=Inkcazelo ende echaza ukuba iplagi ezingaphakathi zenza ntoni na
+Comment[zh_CN]=这里应该填写插件功能详细一点的描述
+Comment[zh_HK]=這個插件的功用的較長描述
+Comment[zh_TW]=關於這個外掛程式的所做所為的較長描述
+Comment[zu]=incazelo ende yokuthi i-plugin yenzani
diff --git a/kview/modules/template/kviewtemplate.h b/kview/modules/template/kviewtemplate.h
new file mode 100644
index 00000000..1d158b05
--- /dev/null
+++ b/kview/modules/template/kviewtemplate.h
@@ -0,0 +1,27 @@
+/* This file is in the public domain */
+
+// $Id$
+
+#ifndef __kviewtemplate_h
+#define __kviewtemplate_h
+
+#include <kparts/plugin.h>
+
+namespace KImageViewer { class Viewer; }
+
+class KViewTemplate : public KParts::Plugin
+{
+ Q_OBJECT
+public:
+ KViewTemplate( QObject* parent, const char* name, const QStringList & );
+ virtual ~KViewTemplate();
+
+private slots:
+ void yourSlot();
+
+private:
+ KImageViewer::Viewer * m_pViewer;
+};
+
+// vim:sw=4:ts=4:cindent
+#endif
diff --git a/kview/modules/template/kviewtemplate.rc b/kview/modules/template/kviewtemplate.rc
new file mode 100644
index 00000000..03d51f57
--- /dev/null
+++ b/kview/modules/template/kviewtemplate.rc
@@ -0,0 +1,11 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="kviewtemplate" library="kview_templateplugin">
+ <MenuBar>
+ <Menu name="tools"><Text>&amp;Tools</Text>
+ <Action name="plugin_template"/>
+ </Menu>
+ </MenuBar>
+ <ToolBar name="extraToolBar">
+ <Action name="plugin_template"/>
+ </ToolBar>
+</kpartplugin>
diff --git a/kview/photobook/Makefile.am b/kview/photobook/Makefile.am
new file mode 100644
index 00000000..967a2def
--- /dev/null
+++ b/kview/photobook/Makefile.am
@@ -0,0 +1,19 @@
+
+INCLUDES = $(all_includes)
+
+kde_module_LTLIBRARIES = libphotobook.la
+
+libphotobook_la_SOURCES = photobook.cpp
+
+libphotobook_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+libphotobook_la_LIBADD = $(LIB_KFILE) $(LIB_KPARTS)
+
+partrcdir = $(kde_servicesdir)
+partrc_DATA = photobook.desktop
+
+METASOURCES = AUTO
+
+KDE_ICON = photobook
+
+partdir = $(kde_datadir)/photobook
+part_DATA = photobookui.rc
diff --git a/kview/photobook/cr16-app-photobook.png b/kview/photobook/cr16-app-photobook.png
new file mode 100644
index 00000000..bfc9b9cc
--- /dev/null
+++ b/kview/photobook/cr16-app-photobook.png
Binary files differ
diff --git a/kview/photobook/cr22-app-photobook.png b/kview/photobook/cr22-app-photobook.png
new file mode 100644
index 00000000..915f3dba
--- /dev/null
+++ b/kview/photobook/cr22-app-photobook.png
Binary files differ
diff --git a/kview/photobook/photobook.cpp b/kview/photobook/photobook.cpp
new file mode 100644
index 00000000..082bfd49
--- /dev/null
+++ b/kview/photobook/photobook.cpp
@@ -0,0 +1,292 @@
+/*
+Copyright (c) 2004,2005 Charles Samuels <charles@kde.org>
+
+ This file is hereby licensed under the GNU General Public License version
+ 2 or later at your option.
+
+ This file is licensed under the Qt Public License version 1 with the
+ condition that the licensed will be governed under the Laws of California
+ (USA) instead of Norway. Disputes will be settled in Santa Clara county
+ courts.
+
+ This file is licensed under the following additional license. Be aware
+ that it is identical to the BSD license, except for the added clause 3:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. By integrating this software into any other software codebase, you waive
+ all rights to any patents associated with the stated codebase.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "photobook.h"
+
+#include <kparts/componentfactory.h>
+#include <kaction.h>
+#include <kstdaccel.h>
+#include <kstandarddirs.h>
+
+Previews::Previews(PhotoBook *parent, const QStringList &mimetypes)
+ : KFileIconView(parent, 0)
+{
+ mPhotoBook = parent;
+ mMimeTypes = mimetypes;
+
+ connect(&mDirLister, SIGNAL(clear()), SLOT(slotClearView()));
+ connect(&mDirLister, SIGNAL(completed()), SLOT(doneListing()));
+ connect(
+ &mDirLister, SIGNAL(newItems(const KFileItemList &)),
+ SLOT(insertNewFiles(const KFileItemList &))
+ );
+ connect(
+ signaler(), SIGNAL(fileSelected(const KFileItem*)),
+ SLOT(open(const KFileItem*))
+ );
+ connect(
+ &mDirLister, SIGNAL(deleteItem(KFileItem *)),
+ SLOT(removeItem(KFileItem *))
+ );
+
+ connect(
+ &mDirLister, SIGNAL( refreshItems( const KFileItemList& ) ),
+ SLOT( slotRefreshItems( const KFileItemList& ) )
+ );
+
+ setFixedWidth(128);
+}
+
+Previews::~Previews()
+{
+
+}
+
+
+void Previews::slotRefreshItems( const KFileItemList& items )
+{
+ KFileItemListIterator it( items );
+ for ( ; it.current(); ++it )
+ updateView( it.current() );
+}
+
+void Previews::slotClearView()
+{
+ clearView();
+}
+
+
+void Previews::insertNewFiles(const KFileItemList &items)
+{
+ addItemList(items);
+}
+
+void Previews::removeItem(KFileItem *item)
+{
+ KFileIconView::removeItem(item);
+}
+
+
+void Previews::go(const KFileItem *k)
+{
+ setSelected(k, true);
+ setCurrentItem(k);
+ ensureItemVisible(k);
+ open(k);
+ updateButton();
+}
+
+void Previews::updateButton()
+{
+ mPhotoBook->updateButton( ( nextItem(currentFileItem())!=0L ), ( prevItem(currentFileItem())!=0L ));
+}
+
+void Previews::openURL(const KURL &url)
+{
+ mDirLister.setMimeFilter(mMimeTypes);
+ mDirLister.openURL(url);
+}
+
+void Previews::open(const KFileItem *item)
+{
+ if (!item->isDir())
+ {
+ const KURL &u = item->url();
+ emit open(u);
+ updateButton();
+ }
+}
+
+void Previews::doneListing()
+{
+ // eep! -- this should not be necessary
+ QTimer::singleShot(0, this, SLOT(goToFirst()));
+}
+
+void Previews::goToFirst()
+{
+ if (firstFileItem())
+ go(firstFileItem());
+ else
+ updateButton();
+}
+
+
+
+PhotoBook::PhotoBook(QWidget *parent, PhotoBookPart *part, const char *name)
+ : QSplitter(parent, name)
+{
+
+ QStringList mimetypes;
+
+ KTrader::OfferList offers = KTrader::self()->query(
+ "KImageViewer/Viewer", "KParts/ReadOnlyPart",
+ "DesktopEntryName == 'kviewviewer'", QString::null
+ );
+
+ for (
+ KTrader::OfferList::Iterator i(offers.begin());
+ i != offers.end(); ++i
+ )
+ {
+ KService::Ptr service = *i;
+ mViewer = KParts::ComponentFactory::
+ createPartInstanceFromService<KParts::ReadOnlyPart>( service, this, 0, this );
+
+ // is this the correct way to get the supported mimetypes?
+ if (mViewer)
+ {
+ KSimpleConfig e(locate("services", service->desktopEntryPath()));
+ e.setGroup("Desktop Entry");
+ mimetypes = QStringList::split(';', e.readEntry("MimeType"));
+ break;
+ }
+ }
+
+
+ mList = new Previews(this, mimetypes);
+
+ mFit = mViewer->action("fittowin");
+
+ connect(mList, SIGNAL(open(const KURL&)), mViewer, SLOT(openURL(const KURL&)));
+ connect(mViewer, SIGNAL(completed()), mFit, SLOT(activate()));
+
+ part->insertChildClient(mViewer);
+}
+
+void PhotoBook::openURL(const KURL &url)
+{
+ mList->openURL(url);
+ mList->setIgnoreMaximumSize();
+ mList->showPreviews();
+}
+
+void PhotoBook::next()
+{
+ KFileItem *k = mList->nextItem(mList->currentFileItem());
+ if (k)
+ mList->go(k);
+}
+
+void PhotoBook::previous()
+{
+ KFileItem *k = mList->prevItem(mList->currentFileItem());
+ if (k)
+ mList->go(k);
+}
+
+
+void PhotoBook::updateButton( bool nextExist, bool previousExit)
+{
+ emit emitUpdateButton( nextExist, previousExit );
+}
+
+K_EXPORT_COMPONENT_FACTORY(libphotobook, PhotoBookFactory )
+
+PhotoBookPart::PhotoBookPart(
+ QWidget *parentWidget, const char *widgetName,
+ QObject *parent, const char *name,
+ const QStringList&
+ )
+ : KParts::ReadOnlyPart(parent, name)
+{
+ setInstance(PhotoBookFactory::instance());
+
+ new PhotoBookBrowserExtension(this);
+ bv = new PhotoBook(parentWidget, this, widgetName);
+ setWidget(bv);
+
+ connect(
+ bv, SIGNAL(emitUpdateButton(bool, bool)),
+ this, SLOT(slotUpdateButton(bool, bool))
+ );
+ m_pNextAction = KStdAction::next(bv, SLOT(next()), actionCollection(), "next");
+ m_pPreviousAction = KStdAction::prior(bv, SLOT(previous()), actionCollection(), "previous");
+
+ setXMLFile( "photobookui.rc" );
+
+}
+
+PhotoBookPart::~PhotoBookPart()
+{
+
+}
+
+
+void PhotoBookPart::slotUpdateButton( bool nextExit, bool previousExit)
+{
+ m_pPreviousAction->setEnabled( previousExit );
+ m_pNextAction->setEnabled( nextExit );
+}
+
+bool PhotoBookPart::openURL(const KURL &url)
+{
+ bv->openURL(url);
+ return true;
+}
+
+
+KAboutData* PhotoBookPart::createAboutData()
+{
+ return new KAboutData(
+ "photobook", I18N_NOOP("Photo Book"),
+ "1.0", I18N_NOOP("Easily browse a folder of photographs"),
+ KAboutData::License_GPL,
+ I18N_NOOP("Copyright (c) 2004,2005 Charles Samuels <charles@kde.org>")
+ );
+}
+
+bool PhotoBookPart::openFile()
+{
+ return true;
+}
+
+
+
+PhotoBookBrowserExtension::PhotoBookBrowserExtension(PhotoBookPart *p)
+ : KParts::BrowserExtension(p, "PhotoBookBrowserExtension")
+{
+
+}
+
+
+
+
+#include "photobook.moc"
+
diff --git a/kview/photobook/photobook.desktop b/kview/photobook/photobook.desktop
new file mode 100644
index 00000000..cb218a80
--- /dev/null
+++ b/kview/photobook/photobook.desktop
@@ -0,0 +1,131 @@
+[Desktop Entry]
+GenericName=Photobook
+GenericName[bg]=Фотоалбум
+GenericName[br]=Levr foto
+GenericName[ca]=Llibre de fotografies
+GenericName[da]=Fotoalbum
+GenericName[de]=Photobuch
+GenericName[es]=Libro de fotografías
+GenericName[et]=Fotoalbum
+GenericName[fa]=کتاب عکس
+GenericName[fi]=Valokuvakirja
+GenericName[fr]=Album photo
+GenericName[gl]=Libro de Fotografías
+GenericName[he]=ספר תמונות
+GenericName[hu]=Fényképalbum
+GenericName[is]=Myndabók
+GenericName[it]=Album fotografico
+GenericName[ja]=フォトブック
+GenericName[kk]=Фотоальбом
+GenericName[km]=សៀវភៅ​រូបថត
+GenericName[lt]=Fotoalbumas
+GenericName[ms]=Bukufoto
+GenericName[nb]=Fotoalbum
+GenericName[nds]=Fotoalbum
+GenericName[ne]=फोटो पुस्तक
+GenericName[nl]=Fotoboek
+GenericName[nn]=Fotoalbum
+GenericName[pa]=ਫੋਟੋ ਬੁੱਕ
+GenericName[pl]=Album ze zdjęciami
+GenericName[pt]=Álbum Fotográfico
+GenericName[pt_BR]=Álbum de Fotos
+GenericName[ro]=Colecţie de fotografii
+GenericName[sk]=Album fotiek
+GenericName[sl]=Album slik
+GenericName[sr]=Фотокњига
+GenericName[sr@Latn]=Fotoknjiga
+GenericName[sv]=Fotoalbum
+GenericName[ta]=புகைப்படப் புத்தகம்
+GenericName[tr]=Albüm
+GenericName[uz]=Rasmlar toʻplami
+GenericName[uz@cyrillic]=Расмлар тўплами
+GenericName[zh_HK]=照相簿
+
+MimeType=inode/directory
+Icon=photobook
+Name=Photobook
+Name[br]=Levr foto
+Name[ca]=Llibre de fotografies
+Name[da]=Fotoalbum
+Name[es]=Libro de fotografías
+Name[et]=Fotoalbum
+Name[fa]=کتاب عکس
+Name[fi]=Valokuvakirja
+Name[fr]=Album photo
+Name[gl]=Libro de Fotografías
+Name[he]=ספר תמונות
+Name[hu]=Fényképalbum
+Name[is]=Myndabók
+Name[it]=Album fotografico
+Name[kk]=Фотоальбом
+Name[km]=សៀវភៅ​រូបថត
+Name[lt]=Fotoalbumas
+Name[ms]=Bukufoto
+Name[nb]=Fotoalbum
+Name[ne]=फोटो पुस्तक
+Name[nl]=Fotoboek
+Name[nn]=Fotoalbum
+Name[pa]=ਫੋਟੋ ਬੁੱਕ
+Name[pl]=Album zdjęciowy
+Name[pt]=Álbum Fotográfico
+Name[pt_BR]=Álbum de Fotos
+Name[ro]=Colecţia de fotografii
+Name[sk]=Album fotiek
+Name[sr]=Фотокњига
+Name[sr@Latn]=Fotoknjiga
+Name[sv]=Fotoalbum
+Name[ta]=புகைப்படப் புத்தகம்
+Name[tr]=Albüm
+Name[uz]=Rasmlar toʻplami
+Name[uz@cyrillic]=Расмлар тўплами
+Name[zh_HK]=照相簿
+Comment=Easily browse a folder of photographs
+Comment[bg]=Колекциониране на снимки като във фотоалбум
+Comment[bs]=Jednostavno pregledajte direktorij sa fotografijama
+Comment[ca]=Mirar fàcilment una carpeta de fotografies
+Comment[cs]=Jednoduché prohlížení složek s fotkami
+Comment[da]=Mappe med fotografier, nem at gennemse
+Comment[de]=Auf einfache Weise einen Ordner nach Photos durchsuchen
+Comment[el]=Εύκολη περιήγηση σε ένα φάκελο φωτογραφιών
+Comment[es]=Vistazo rápido de una carpeta con fotografías
+Comment[et]=Fotode kausta mugav lehitsemine
+Comment[eu]=Arakatu argazki karpetak modu errazan
+Comment[fa]=مرور آسان پوشه‌ای از عکسها
+Comment[fi]=Selaile helpolla valokuvakansioita
+Comment[fr]=Naviguer facilement dans un dossier contenant des photos
+Comment[gl]=Explorar doadamente un cartafol de fotografías
+Comment[he]=דפדף בקלות בתיקייה המכילה תמונות
+Comment[hu]=Könyvtárba helyezett fényképek nézegetéséhez
+Comment[is]=Flettu á auðveldan hátt gegnum möppu með myndum
+Comment[it]=Sfoglia facilmente una cartella di fotografie
+Comment[ja]=写真を含むフォルダをブラウズ
+Comment[kk]=Қапшықтағы фотоларды шолу
+Comment[km]=រកមើល​ថត​រូបថត​យ៉ាង​ងាយស្រួល
+Comment[lt]=Lengvai naršykite fotografijų aplankus
+Comment[ms]=Layar folder fotograf dengan mudah
+Comment[nb]=Enkel lesing av mapper med bilder
+Comment[nds]=Op eenfache Oort en Foto-Orner dörkieken
+Comment[ne]=फोटोग्राफको फोल्डर सजिलै ब्राउज गर्नुहोस्
+Comment[nl]=Blader eenvoudig door een map met foto's
+Comment[nn]=Enkel vising av mapper med bilete
+Comment[pl]=Łatwe przeglądanie folderów ze zdjęciami
+Comment[pt]=Navegue facilmente numa pasta de fotografias
+Comment[pt_BR]=Navegue facilmente por uma pasta cheia de fotos
+Comment[ro]=Răsfoiţi cu uşurinţă un folder de fotografii
+Comment[ru]=Просмотр папок с фотографиями
+Comment[sk]=Jednoducho prehliada priečinky s fotografiami
+Comment[sl]=Zlahka brskajte po mapi s fotografijami
+Comment[sr]=Лако прегледајте фасциклу са сликама
+Comment[sr@Latn]=Lako pregledajte fasciklu sa slikama
+Comment[sv]=Bläddra enkelt i en katalog med fotografier
+Comment[ta]=புகைப்படங்களின் அடைவை சுலபமாக உலாவ
+Comment[tr]=Fotoğraflarla dolu bir dizini kolayca gez
+Comment[uk]=Простий перегляд тек з фотографіями
+Comment[zh_CN]=轻松浏览照片文件夹
+Comment[zh_HK]=容易地瀏覽資料夾的照片
+Comment[zh_TW]=輕易地瀏覽相片的資料夾
+ServiceTypes=KParts/ReadOnlyPart,Browser/View
+X-KDE-Library=libphotobook
+X-KDE-BrowserView-Args=DetailedList
+X-DCOP-ServiceType=Multi
+Type=Service
diff --git a/kview/photobook/photobook.h b/kview/photobook/photobook.h
new file mode 100644
index 00000000..3da5cf78
--- /dev/null
+++ b/kview/photobook/photobook.h
@@ -0,0 +1,140 @@
+/*
+Copyright (c) 2004 Charles Samuels <charles@kde.org>
+
+ This file is hereby licensed under the GNU General Public License version
+ 2 or later at your option.
+
+ This file is licensed under the Qt Public License version 1 with the
+ condition that the licensed will be governed under the Laws of California
+ (USA) instead of Norway. Disputes will be settled in Santa Clara county
+ courts.
+
+ This file is licensed under the following additional license. Be aware
+ that it is identical to the BSD license, except for the added clause 3:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. By integrating this software into any other software codebase, you waive
+ all rights to any patents associated with the stated codebase.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef PHOTOBOOK_H
+#define PHOTOBOOK_H
+
+#include <qsplitter.h>
+#include <kfileiconview.h>
+#include <kdirlister.h>
+
+#include <kparts/part.h>
+#include <kparts/browserextension.h>
+#include <kparts/genericfactory.h>
+
+class Previews;
+class PhotoBookPart;
+
+class PhotoBook : public QSplitter
+{
+Q_OBJECT
+ Previews *mList;
+ KAction *mFit;
+ KParts::ReadOnlyPart *mViewer;
+
+public:
+ PhotoBook(QWidget *parent, PhotoBookPart *part, const char *name=0);
+ void openURL(const KURL &url);
+ void updateButton(bool, bool );
+
+public slots:
+ void next();
+ void previous();
+
+signals:
+ void emitUpdateButton( bool, bool );
+};
+
+class Previews : public KFileIconView
+{
+Q_OBJECT
+
+ KDirLister mDirLister;
+ PhotoBook *mPhotoBook;
+ QStringList mMimeTypes;
+
+public:
+ Previews(PhotoBook *parent, const QStringList &mimetypes);
+ ~Previews();
+ void openURL(const KURL &url);
+
+ PhotoBook *bv() { return mPhotoBook; }
+ void updateButton( );
+
+public slots:
+ void go(const KFileItem*);
+
+signals:
+ void open(const KURL & ki);
+
+private slots:
+ void insertNewFiles(const KFileItemList &);
+ void removeItem(KFileItem *item);
+ void open(const KFileItem*);
+ void doneListing();
+ void goToFirst();
+ void slotRefreshItems( const KFileItemList& items );
+ void slotClearView();
+};
+
+
+class PhotoBookPart : public KParts::ReadOnlyPart
+{
+Q_OBJECT
+ PhotoBook *bv;
+ KAction *m_pPreviousAction;
+ KAction *m_pNextAction;
+
+public:
+ PhotoBookPart(
+ QWidget *parentWidget, const char *widgetName,
+ QObject *parent, const char *name=0,
+ const QStringList& args = QStringList()
+ );
+ ~PhotoBookPart();
+
+ virtual bool openURL(const KURL &url);
+ static KAboutData* createAboutData();
+ virtual bool openFile();
+
+public slots:
+ void slotUpdateButton( bool nextExit, bool previousExit);
+};
+
+typedef KParts::GenericFactory<PhotoBookPart> PhotoBookFactory;
+
+class PhotoBookBrowserExtension : public KParts::BrowserExtension
+{
+Q_OBJECT
+public:
+ PhotoBookBrowserExtension(PhotoBookPart *p);
+};
+
+
+#endif
+
diff --git a/kview/photobook/photobookui.rc b/kview/photobook/photobookui.rc
new file mode 100644
index 00000000..fbc89f62
--- /dev/null
+++ b/kview/photobook/photobookui.rc
@@ -0,0 +1,14 @@
+<!DOCTYPE kpartplugin>
+<kpartplugin name="PhotoBook Part" library="libphotobook" version="2">
+<MenuBar>
+ <Menu name="view"><text>&amp;View</text>
+ <Action name="previous"/>
+ <Action name="next"/>
+ </Menu>
+</MenuBar>
+
+<Toolbar name="go"><text>Go</text>
+ <Action name="previous"/>
+ <Action name="next"/>
+</Toolbar>
+</kpartplugin>
diff --git a/kview/version.h b/kview/version.h
new file mode 100644
index 00000000..e4a147a5
--- /dev/null
+++ b/kview/version.h
@@ -0,0 +1,3 @@
+#ifndef KVIEW_VERSION
+#define KVIEW_VERSION KDE_VERSION_STRING
+#endif