diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 47d455dd55be855e4cc691c32f687f723d9247ee (patch) | |
tree | 52e236aaa2576bdb3840ebede26619692fed6d7d /kview/modules/scanner | |
download | tdegraphics-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/modules/scanner')
-rw-r--r-- | kview/modules/scanner/Makefile.am | 15 | ||||
-rw-r--r-- | kview/modules/scanner/kviewscanner.cpp | 96 | ||||
-rw-r--r-- | kview/modules/scanner/kviewscanner.desktop | 127 | ||||
-rw-r--r-- | kview/modules/scanner/kviewscanner.h | 50 | ||||
-rw-r--r-- | kview/modules/scanner/kviewscanner.rc | 12 |
5 files changed, 300 insertions, 0 deletions
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>&Tools</Text> + <Action name="plugin_scan"/> + </Menu> + </MenuBar> + <ToolBar name="extraToolBar"> + <text>Extra Toolbar</text> + <Action name="plugin_scan"/> + </ToolBar> +</kpartplugin> |