Review Request 129992: Fix save image/sound files to relative path in kvtml2writer

Xin Huang xinhuang.abc at gmail.com
Tue Mar 14 08:31:52 UTC 2017


Oops. You are right. My mistake. Sorry. I will update the patch ASAP.

On Mon, 13 Mar 2017 at 4:43 PM Albert Astals Cid <aacid at kde.org> wrote:

> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/129992/
> keduvocdocument/keduvockvtml2writer.cpp
> <https://git.reviewboard.kde.org/r/129992/diff/2/?file=492311#file492311line537> (Diff
> revision 2)
>
> 537
>
>         if ( KIO::upUrl(docDirUrl).isParentOf( translation->imageUrl()) ) {
>
> i don't think using docDirUrl and upUrl is what we want, since you're going two levels up in the url now, no?
>
>
> - Albert Astals Cid
>
> On March 6th, 2017, 11:24 p.m. UTC, Xin Huang wrote:
> Review request for KDE Edu.
> By Xin Huang.
>
> *Updated March 6, 2017, 11:24 p.m.*
> *Repository: * libkeduvocdocument
> Description
>
> bool KEduVocKvtml2Writer::writeTranslation( QDomElement &translationElement, KEduVocTranslation*
>  translation )
> {
>     // ...
>     // sound
>     if ( !translation->soundUrl().isEmpty() ) {
>         QString urlString;
>         qDebug() << "soundUrl" << translation->soundUrl();
>         if ( KIO::upUrl(m_doc->url().adjusted(QUrl::RemoveFilename)).isParentOf( translation->soundUrl()) ) {
>             // try to save as relative url
>             urlString = m_doc->url().toString(QUrl::RemoveFilename) + '/' + translation->soundUrl().toString();     // <------------ HERE
>         } else {
>             urlString =  translation->soundUrl().url();
>         }
>         qDebug() << "urlString" << urlString;
>         translationElement.appendChild( newTextElement( KVTML_SOUND, urlString ) );
>     }
>
> Notice the line marked: The soundUrl of a translation parley passed in is
> "file:///path/to/kvtml/kvtmlfilename_files/File:En-us-Word.ogg", and the
> m_doc->url() is "file:///path/to/kvtml/kvtmlfilename.kvtml". By the old
> logic saving as relative url, the result will be
> "file:///path/to/kvtml/file:///path/to/kvtml/kvtmlfilename_files/Files:En-us-word.ogg".
>
> Diffs
>
>    - keduvocdocument/keduvockvtml2writer.cpp (ff9c292)
>
> View Diff <https://git.reviewboard.kde.org/r/129992/diff/>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20170314/cfd2f534/attachment.html>


More information about the kde-edu mailing list