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

List:       koffice-devel
Subject:    Re: KSpread publish/subscribe update
From:       David Faure <david () mandrakesoft ! com>
Date:       2002-07-26 8:03:16
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 25 July 2002 15:58, Nicolas Schryve wrote:
> Others comments are welcome.

#include <kde/kio/netaccess.h>
That's wrong. The correct include is <kio/netaccess.h>
Only some distributions (redhat?) put the includes under kde/, others don't.
And if you compiled the rest of KDE/KOffice already, you have passed the right
flags to configure already, so you don't need the "kde/" in here.

The indentation stlil looks very messed up...
(pasted, so it uses only spaces, and shows how it looks for me:)

+       if (!URL.isLocalFile() )
+               {
+               QString extension,m_file;
+               QString fileName = URL.fileName();
+               int extensionPos = fileName.findRev( '.' );
+               if ( extensionPos != -1 )
+               {
+                       extension = fileName.mid( extensionPos ); // keep the '.'
+                       }
+               KTempFile tempFile( QString::null, extension );
+               m_file = tempFile.name();
+
+               KURL destURL;
+               destURL.setPath( m_file );
+               //Download synchronously. If not fatal error!

+               if (KIO::NetAccess::exists(destURL))
+                       {
+             KIO::NetAccess::del(destURL);
+            }
That's overkill. KTempFile creates a local file, always. Use KTempFile::unlink()
to get rid of it.

+               if ( ! KIO::NetAccess::dircopy(URL,destURL)  )      //KIO::file_copy( \
URL, destURL, 0600, true, false );      ->don't work in this case That's a bit \
overkill too. What doesn't work with file_copy?

Hmm, more generally: why use NetAccess at all?
What you do below is   shell->openDocument( URL ) !!!
The local copy, destURL, isn't used at all.

I would suggest to get rid of all the tempfile & NetAccess stuff,
keep the openDocument(URL), and connect to the completed() slot
(see kparts/part.h) in order to do the rest of the stuff _after_ the loading
is finished (the current code only works by accident...)


+ void slotOpenDynamicURL( KURL URL, int firstCol, int lastCol,QString Cell);
Use 
const KURL &url
instead of "KURL URL"
Copying KURLs is a bit expensive.

- -- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://people.mandrakesoft.com/~david/
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
KOffice 1.2 RC1 is slightly delayed. Stay tuned.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9QQJE72KcVAmwbhARAuKEAJ9JDI/5RU1VERsToszJ5kHtWr4pCgCgkcAa
T4Ezt8J/2hUnyABz+LrhB4k=
=cqjm
-----END PGP SIGNATURE-----

_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel


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

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