[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: AW: API change request
From:       Alex Merry <huntedhacker () tiscali ! co ! uk>
Date:       2007-09-03 23:58:34
Message-ID: 200709040100.20139.huntedhacker () tiscali ! co ! uk
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


On Tuesday 04 Sep 2007, Nhuh Put wrote:
> KScanDialogFactory can disappear completly, all the necessary stuff
> is already in KPluginFactory. I would port libkscan and remove the
> factory class nex Monday.

Patch attached.

Is there any problem with changing the requested translation catalogue 
from libkscan to just kscan?  Is there anything else I should do if I 
do change it?

Alex



-- 
KDE: http://www.kde.org
Ubuntu/Kubuntu: http://www.ubuntu.org http://www.kubuntu.org

["kscan.diff" (text/x-diff)]

Index: kdelibs/kio/kio/kscan.cpp
===================================================================
--- kdelibs/kio/kio/kscan.cpp	(revision 708118)
+++ kdelibs/kio/kio/kscan.cpp	(working copy)
@@ -119,99 +119,5 @@ int KOCRDialog::nextId()
 }
 
 
-///////////////////////////////////////////////////////////////////
-
-class KScanDialogFactory::KScanDialogFactoryPrivate
-{
-public:
-    KComponentData m_componentData;
-};
-
-KScanDialogFactory::KScanDialogFactory( const char *componentName,
-                                        const char *catalogName,
-                                        QObject *parent )
-    : KPluginFactory(componentName, catalogName, parent),
-      d( new KScanDialogFactoryPrivate )
-{
-}
-
-KScanDialogFactory::~KScanDialogFactory()
-{
-    delete d;
-}
-
-QObject *KScanDialogFactory::createObject( QObject *parent,
-                                           const char *classname,
-                                           const QStringList &args )
-{
-    if ( strcmp( classname, "KScanDialog" ) != 0 )
-        return 0;
-
-    if ( parent && !parent->isWidgetType() )
-       return 0;
-
-    Q_UNUSED( args );
-
-    return createDialog( static_cast<QWidget *>( parent ) );
-}
-
-void KScanDialogFactory::setName(const QByteArray &componentName)
-{
-    d->m_componentData = KComponentData(componentName);
-}
-
-const KComponentData &KScanDialogFactory::componentData() const
-{
-    return d->m_componentData;
-}
-
-
-///////////////////////////////////////////////////////////////////
-
-class KOCRDialogFactory::KOCRDialogFactoryPrivate
-{
-public:
-    KComponentData m_componentData;
-};
-
-KOCRDialogFactory::KOCRDialogFactory( const char *componentName,
-                                      const char *catalogName,
-                                      QObject *parent )
-    : KPluginFactory(componentName, catalogName, parent),
-      d( new KOCRDialogFactoryPrivate )
-{
-}
-
-KOCRDialogFactory::~KOCRDialogFactory()
-{
-    delete d;
-}
-
-QObject *KOCRDialogFactory::createObject( QObject *parent,
-                                          const char *classname,
-                                          const QStringList &args )
-{
-    if ( strcmp( classname, "KOCRDialog" ) != 0 )
-        return 0;
-
-    if ( parent && !parent->isWidgetType() )
-       return 0;
-
-    Q_UNUSED( args );
-
-    return createDialog( static_cast<QWidget *>( parent ) );
-}
-
-void KOCRDialogFactory::setName(const QByteArray &componentName)
-{
-    d->m_componentData = KComponentData(componentName);
-}
-
-const KComponentData &KOCRDialogFactory::componentData() const
-{
-    return d->m_componentData;
-}
-
-
 
 #include "kscan.moc"
Index: kdelibs/kio/kio/kscan.h
===================================================================
--- kdelibs/kio/kio/kscan.h	(revision 708118)
+++ kdelibs/kio/kio/kscan.h	(working copy)
@@ -56,9 +56,6 @@ class QImage;
  * This will create and show a non-modal scanning dialog. Connect to more
  * signals if you like.
  *
- * If you implement an own scan-dialog, you also have to implement a
- * KScanDialogFactory.
- *
  * @short A baseclass and accessor for Scanning Dialogs
  * @author Carsten Pfeiffer <pfeiffer@kde.org>
  */
@@ -168,54 +165,6 @@ private:
 
 
 /**
- * A factory for creating a KScanDialog. You need to reimplement
- * createDialog().
- * @short Factory for creating KScanDialogs
- */
-class KIO_EXPORT KScanDialogFactory : public KPluginFactory
-{
-public:
-    virtual ~KScanDialogFactory();
-
-    /**
-     * Your library should reimplement this method to return your KScanDialog
-     * derived dialog.
-     * @param parent the QWidget's parent, or 0
-     */
-    virtual KScanDialog * createDialog( QWidget *parent=0 ) = 0;
-
-protected:
-    /**
-     * Creates a new KScanDialogFactory.
-     * @param parent the QWidget's parent, or 0
-     */
-    KScanDialogFactory( const char *componentName = 0,
-                        const char *catalogName = 0,
-                        QObject *parent = 0 );
-
-    virtual QObject* createObject( QObject* parent = 0,
-                                   const char* classname = "QObject",
-                                   const QStringList &args = QStringList() );
-
-
-    /**
-     * Creates a new instance with the given name.
-     * @param componentName the name of the instance
-     */
-    void setName(const QByteArray &componentName);
-
-    /**
-     * Returns the instance.
-     * @return the KComponentData
-     */
-    const KComponentData &componentData() const;
-
-private:
-    class KScanDialogFactoryPrivate;
-    KScanDialogFactoryPrivate * const d;
-};
-
-/**
  * Base class for OCR Dialogs.
  */
 class KIO_EXPORT KOCRDialog : public KPageDialog
@@ -286,56 +235,4 @@ private:
 };
 
 
-/**
- * A factory for creating a KOCRDialog. You need to reimplement
- * createDialog().
- * @short Factory for creating KScanDialogs
- */
-class KIO_EXPORT KOCRDialogFactory : public KPluginFactory
-{
-public:
-    virtual ~KOCRDialogFactory();
-
-    /**
-     * Your library should reimplement this method to return your KOCRDialog
-     * derived dialog.
-     * @param parent the QWidget's parent, or 0
-     * @param modal if true the dialog is model
-     */
-    virtual KOCRDialog * createDialog( QWidget *parent=0,
-					bool modal=false ) = 0;
-
-protected:
-    /**
-     * Creates a new KScanDialogFactory.
-     * @param parent the QWidget's parent, or 0
-     */
-
-    KOCRDialogFactory( const char *componentName = 0,
-                       const char *catalogName = 0,
-                       QObject *parent = 0 );
-
-    virtual QObject* createObject( QObject* parent = 0,
-                                   const char* classname = "QObject",
-                                   const QStringList &args = QStringList() );
-
-
-    /**
-     * Creates a new instance with the given name.
-     * @param componentName the name of the instance
-     */
-    void setName(const QByteArray &componentName);
-
-    /**
-     * Returns the instance.
-     * @return the KComponentData
-     */
-    const KComponentData &componentData() const;
-
-private:
-    class KOCRDialogFactoryPrivate;
-    KOCRDialogFactoryPrivate * const d;
-};
-
-
 #endif // KSCAN_H
Index: kdegraphics/libkscan/scandialog.cpp
===================================================================
--- kdegraphics/libkscan/scandialog.cpp	(revision 708154)
+++ kdegraphics/libkscan/scandialog.cpp	(working copy)
@@ -48,27 +48,14 @@
 
 #define SCANDIA_SPLITTER_SIZES "ScanDialogSplitter %1"
 
-K_EXPORT_PLUGIN(ScanDialogFactory("kscan", "libkscan"))
-
-ScanDialogFactory::ScanDialogFactory( const char *componentName,
-                                      const char *catalogName,
-                                      QObject *parent )
-    : KScanDialogFactory( componentName, catalogName, parent )
-{
-    setName( "ScanDialogFactory" );
-    //KGlobal::locale()->insertCatalog( QString::fromLatin1("libkscan") );
-}
-
-KScanDialog * ScanDialogFactory::createDialog( QWidget *parent)
-{
-    return new ScanDialog( parent );
-}
+K_PLUGIN_FACTORY( ScanDialogFactory, registerPlugin<ScanDialog>(); )
+K_EXPORT_PLUGIN( ScanDialogFactory("kscan", "libkscan") )
 
 
 ///////////////////////////////////////////////////////////////////
 
 
-ScanDialog::ScanDialog( QWidget *parent )
+ScanDialog::ScanDialog( QWidget *parent, const QVariantList & )
    : KScanDialog( Tabbed, Close|Help, parent ),
      good_scan_connect(false)
 {
Index: kdegraphics/libkscan/scandialog.h
===================================================================
--- kdegraphics/libkscan/scandialog.h	(revision 708154)
+++ kdegraphics/libkscan/scandialog.h	(working copy)
@@ -34,7 +34,7 @@ class ScanDialog : public KScanDialog
    Q_OBJECT
 
 public:
-   ScanDialog( QWidget *parent = 0 );
+   ScanDialog( QWidget *parent = 0, const QVariantList &args = QVariantList() );
    ~ScanDialog();
 
    virtual bool setup();
@@ -68,17 +68,5 @@ private:
    ScanDialogPrivate *d;
 };
 
-class ScanDialogFactory : public KScanDialogFactory
-{
-public:
-   ScanDialogFactory( const char *componentName = 0,
-                      const char *catalogName = 0,
-                      QObject *parent=0 );
-
-protected:
-   virtual KScanDialog * createDialog( QWidget *parent=0 );
-
-
-};
 
 #endif // SCAN_H

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic