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

List:       kde-core-devel
Subject:    Re: New KDE printing system
From:       Simon Hausmann <sh () caldera ! de>
Date:       2001-02-28 15:45:21
[Download RAW message or body]

On Wed, Feb 28, 2001 at 04:32:04PM +0100, Michael Goffioul wrote:
> > > Actually the factory is (will be) used to create other objects as well, like
> > > job lister, printer manager, UI manager (those are objects defined in the
> > > printing management tool I'm developing).
> >
> > Ok. Then I take back my suggestion to hide it completely. But your
> > initial description was:
> 
> This is work in progress. There's still a lot of things to implement... I described
> here the basic use a developer should know about to be able to use the library.
> 
> > The "DO NOT delete" warning indicates that the API is tricky to use,
> > doesn't ?
> 
> There's 2 reasons to not delete the KPrinter object:
>     - avoid a crash, however this can be solved easily with a few lines of code
>     - more importantly, the last configuration is re-used, so the user doesn't
>         have to re-configure everything. The selected printer as well as the
>         printing options are recovered.
> 
> I don't think it is really tricky to write:
> 
> KPrinter    *printer = KPrinterFactory::self()->printer();
> <do whatever you want with the KPrinter object, except deleting it>;

I agree, it's in fact very easy to write. But it's inconsistent with the Qt
way :-}

I would love to be able to write

KPrinter *printer = new KPrinter;
<do stuff>
delete printer;

Because then I could convert existing code right away. (and it would make it
really easy to keep an application compatible to both, kdeprint and qprinter)

I'm sure there's a way to still store the last used data in a shared (and
global) KPrinterPrivate data structure or something :-)

(I'd volunteer to come up with a patch, if you agree with making it consistent
to Qt :-)

Bye,
 Simon

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

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