KTemporaryFile::createLocalFile()

Dominik Haumann dhdev at gmx.de
Fri Jul 6 22:39:38 BST 2007


On Wednesday 04 July 2007, Dominik Haumann wrote:
> Hi,
>
> QTemporaryFile has static functions
>   QTemporaryFile * createLocalFile ( QFile & file )
>   QTemporaryFile * createLocalFile ( const QString & fileName )
>
> We have the following scenario in Kate:
>  1. somehow get a (temporary) file that is not deleted
>  2. run a diff programm and write the data to this file
>  3. call KRun::runUrl() to open kompare to show the diff
>  4. as kompare has the option X-KDE-HasTempFileOption it will remove
>     the file on application exit
>
> The code to solve (1) right now looks like this:
>
>   KTemporaryFile tmpfile;
>   tmpfile.setAutoRemove(false);
>   tmpfile.open();
>   QString fileName = tmpfile.fileName();
>   tmpfile.close();
>
> K/QTemporaryFile does not provide this functionality directly, the
> attached patch adds QString KTemporaryFile::createLocalFile()
> with the above implementation.
>
> Do we want that / ok to commit?
> If so, do I have to wait for a monday or what are the terms right now?

I've solved the issue for kate now even in a secure way if I understand 
correctly ;) We don't need this function anymore. I've also talked to David 
and Thiago and the consense is that such a thingy is sometimes needed but 
bad practice for the given reasons (see thread), and that's why it should 
not be supported in public API.

Cheers,
Dominik




More information about the kde-core-devel mailing list