kio Library: kscan.cpp Source File (kio Library)

| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kscan.cpp

    00001 /* This file is part of the KDE libraries
    00002     Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>
    00003
    00004     This library is free software; you can redistribute it and/or
    00005     modify it under the terms of the GNU Library General Public
    00006     License as published by the Free Software Foundation; either
    00007     version 2 of the License, or (at your option) any later version.
    00008
    00009     This library is distributed in the hope that it will be useful,
    00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012     Library General Public License for more details.
    00013
    00014     You should have received a copy of the GNU Library General Public License
    00015     along with this library; see the file COPYING.LIB.  If not, write to
    00016     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017     Boston, MA 02111-1307, USA.
    00018 */
    00019
    00020 #include <qfile.h>
    00021
    00022 #include <klocale.h>
    00023 #include <ktrader.h>
    00024
    00025 #include "kscan.h"
    00026
    00027 // static factory method
    00028 KScanDialog * KScanDialog::getScanDialog( QWidget *parent, const char *name,
    00029                       bool modal )
    00030 {
    00031     KTrader::OfferList offers = KTrader::self()->query("KScan/KScanDialog");
    00032     if ( offers.isEmpty() )
    00033     return 0L;
    00034
    00035     KService::Ptr ptr = *(offers.begin());
    00036     KLibFactory *factory = KLibLoader::self()->factory( QFile::encodeName(ptr->library()) );
    00037
    00038     if ( !factory )
    00039         return 0;
    00040
    00041     QStringList args;
    00042     args << QString::number( (int)modal );
    00043
    00044     QObject *res = factory->create( parent, name, "KScanDialog", args );
    00045
    00046     return dynamic_cast<KScanDialog *>( res );
    00047 }
    00048
    00049
    00050 KScanDialog::KScanDialog( int dialogFace, int buttonMask,
    00051               QWidget *parent, const char *name, bool modal )
    00052     : KDialogBase( dialogFace, i18n("Acquire Image"), buttonMask, Close,
    00053            parent, name, modal, true ),
    00054       m_currentId( 1 )
    00055 {
    00056 }
    00057
    00058 KScanDialog::~KScanDialog()
    00059 {
    00060 }
    00061
    00062 bool KScanDialog::setup()
    00063 {
    00064     return true;
    00065 }
    00066
    00068
    00069
    00070 // static factory method
    00071 KOCRDialog * KOCRDialog::getOCRDialog( QWidget *parent, const char *name,
    00072                       bool modal )
    00073 {
    00074     KTrader::OfferList offers = KTrader::self()->query("KScan/KOCRDialog");
    00075     if ( offers.isEmpty() )
    00076     return 0L;
    00077
    00078     KService::Ptr ptr = *(offers.begin());
    00079     KLibFactory *factory = KLibLoader::self()->factory( QFile::encodeName(ptr->library()) );
    00080
    00081     if ( !factory )
    00082         return 0;
    00083
    00084     QStringList args;
    00085     args << QString::number( (int)modal );
    00086
    00087     QObject *res = factory->create( parent, name, "KOCRDialog", args );
    00088
    00089     return dynamic_cast<KOCRDialog *>( res );
    00090 }
    00091
    00092
    00093 KOCRDialog::KOCRDialog( int dialogFace, int buttonMask,
    00094               QWidget *parent, const char *name, bool modal )
    00095     : KDialogBase( dialogFace, i18n("OCR Image"), buttonMask, Close,
    00096            parent, name, modal, true ),
    00097       m_currentId( 1 )
    00098 {
    00099
    00100 }
    00101
    00102 KOCRDialog::~KOCRDialog()
    00103 {
    00104 }
    00105
    00106
    00108
    00109
    00110 KScanDialogFactory::KScanDialogFactory( QObject *parent, const char *name )
    00111     : KLibFactory( parent, name ),
    00112       m_instance( 0L )
    00113 {
    00114 }
    00115
    00116 KScanDialogFactory::~KScanDialogFactory()
    00117 {
    00118     delete m_instance;
    00119 }
    00120
    00121 QObject *KScanDialogFactory::createObject( QObject *parent, const char *name,
    00122                                            const char *classname,
    00123                                            const QStringList &args )
    00124 {
    00125     if ( strcmp( classname, "KScanDialog" ) != 0 )
    00126         return 0;
    00127
    00128     if ( parent && !parent->isWidgetType() )
    00129        return 0;
    00130
    00131     bool modal = false;
    00132
    00133     if ( args.count() == 1 )
    00134         modal = (bool)args[ 0 ].toInt();
    00135
    00136     return createDialog( static_cast<QWidget *>( parent ), name, modal );
    00137 }
    00138
    00139
    00141
    00142
    00143 KOCRDialogFactory::KOCRDialogFactory( QObject *parent, const char *name )
    00144     : KLibFactory( parent, name ),
    00145       m_instance( 0L )
    00146 {
    00147 }
    00148
    00149 KOCRDialogFactory::~KOCRDialogFactory()
    00150 {
    00151     delete m_instance;
    00152 }
    00153
    00154 QObject *KOCRDialogFactory::createObject( QObject *parent, const char *name,
    00155                                            const char *classname,
    00156                                            const QStringList &args )
    00157 {
    00158     if ( strcmp( classname, "KOCRDialog" ) != 0 )
    00159         return 0;
    00160
    00161     if ( parent && !parent->isWidgetType() )
    00162        return 0;
    00163
    00164     bool modal = false;
    00165
    00166     if ( args.count() == 1 )
    00167         modal = (bool)args[ 0 ].toInt();
    00168
    00169     return createDialog( static_cast<QWidget *>( parent ), name, modal );
    00170 }
    00171
    00172 void KScanDialog::virtual_hook( int id, void* data )
    00173 { KDialogBase::virtual_hook( id, data ); }
    00174
    00175 void KScanDialogFactory::virtual_hook( int id, void* data )
    00176 { KLibFactory::virtual_hook( id, data ); }
    00177
    00178 void KOCRDialog::virtual_hook( int id, void* data )
    00179 { KDialogBase::virtual_hook( id, data ); }
    00180
    00181 void KOCRDialogFactory::virtual_hook( int id, void* data )
    00182 { KLibFactory::virtual_hook( id, data ); }
    00183
    00184
    00185 #include "kscan.moc"

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:24:03 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003