From koffice-devel Fri Jul 26 08:03:16 2002 From: David Faure Date: Fri, 26 Jul 2002 08:03:16 +0000 To: koffice-devel Subject: Re: KSpread publish/subscribe update X-MARC-Message: https://marc.info/?l=koffice-devel&m=102767077029451 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 25 July 2002 15:58, Nicolas Schryve wrote: > Others comments are welcome. #include That's wrong. The correct include is 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