KTempFile->QTemporaryFile

Albert Astals Cid aacid at kde.org
Sun Sep 10 22:59:50 BST 2006


A Diumenge 10 Setembre 2006 17:14, Jaison Lee va escriure:
> One of the items in the kdelibs TODO is:
>
> - KDE 4: Check if QTemporaryFile is good enough to dump KTempFile
>   (Albert Astals Cid)

You can see this thread about the feedback i got 
http://lists.kde.org/?t=112583223900003&r=1&w=2

Dirk seemed to be against it.

Albert

>
> I've been looking at this recently along with Will Entriken.
> QTemporaryFile is certainly capable of doing everything KTempFile does
> and more, and it is probably worth the effort of making a few changes
> to increase consistency between the APIs. There are a few caveats,
> however:
>
> * KTempFile defaults to ~/.kde/tmp-${HOSTNAME} whereas QTemporaryFile
> defaults to /tmp (or /var/tmp)
>
> * KTempFile does not autoremove by default whereas QTemporaryFile does.
>
> * KTempFile HAS-A QFile whereas QTemporaryFile IS-A QFile, which just
> makes some porting less simple than a search-and-replace.
>
> * Most function calls have different names (KTempFile::setAutoDelete()
> versus QTemporaryFile::setAutoRemove()) We should probably go with the
> Qt vernacular for consistency.
>
> * KTempFile is used EVERYWHERE in the codebase and in a variety of ways.
>
> For all these reasons, I think we should create a new very small class
> called KTemporaryFile that inherits from QTemporaryFile. It will be in
> charge of setting the desired tmp directory, as well as setting
> autoremove false (if we decide we want to keep that behaviour). It
> will also provide a good place to put equivalents of the textStream()
> and dataStream() functions which I think will be handy shortcuts and
> make porting a bit easier.
>
> My plan then would be:
>
> Step 1) Create KTemporaryFile and mark KTempFile deprecated.
> Step 2) Port all existing KTempFiles to KTemporaryFile.
> Step 3) Remove KTempFile.
>
> This will provide Will and I ample time to complete step 2, while
> making sure that the codebase remains able to be compiled.
>
> So how does this sound to everyone? Does this look like something
> worth doing? Any comments on my overall plan? Should KTemporaryFile
> still default autoRemove to false even though QTemporaryFile defaults
> true? (Personally I would say no; take the Qt default in this case.)




More information about the kde-core-devel mailing list