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

List:       kde-commits
Subject:    Re: branches/kdepim/enterprise/kdepim/korganizer
From:       Reinhold Kainhofer <reinhold () kainhofer ! com>
Date:       2007-04-26 12:51:24
Message-ID: 200704261451.28037.reinhold () kainhofer ! com
[Download RAW message or body]

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

Am Donnerstag, 26. April 2007 schrieb Volker Krause:
> SVN commit 658232 by vkrause:
>
> Support inline attachments.

> @@ -175,7 +196,13 @@
>    if ( att->isUri() ) {
>      emit openURL( att->uri() );
>    } else {
> -    // FIXME: Handle binary attachments
> +    KTempFile f;
> +    if ( !f.file() )
> +      return;
> +    QCString decoded = KCodecs::base64Decode( QCString( att->data() ) );
> +    f.file()->writeBlock( decoded.data(), decoded.length() );
> +    f.file()->close();
> +    KRun::runURL( f.name(), att->mimeType(), true, false );

I think this will work with applications like OpenOffice, when one instance is 
already running. The new instance simply tells the running instance to open 
that file, quits and the temp file is removed before the running instance 
gets a chance at opening the file.

>  void KOEditorAttachments::slotEdit()
>  {
>    QListViewItem *item = mAttachments->currentItem();
> @@ -209,7 +244,21 @@
>      if ( !uri.isEmpty() )
>        attitem->setUri( uri.url() );
>    } else {
> -    // FIXME: Handle binary attachments
> +    KURL uri = KPimURLRequesterDlg::getURL( QString::null, i18n(
> +         "File to be attached:"), this, i18n("Add Attachment") );
> +    if ( !uri.isEmpty() ) {
> +          QString tmpFile;
> +      if ( KIO::NetAccess::download( uri, tmpFile, this ) ) {

Is that temp file ever removed?

> @@ -235,11 +284,28 @@
>  }
>
>  void KOEditorAttachments::addAttachment( const QString &uri,
> -                                         const QString &mimeType )
> +                                         const QString &mimeType, bool
> asUri ) {
>    AttachmentListItem *item = new AttachmentListItem( 0, mAttachments );
> -  item->setUri( uri );
> -  if ( !mimeType.isEmpty() ) item->setMimeType( mimeType );
> +  if ( asUri ) {
> +    item->setUri( uri );
> +    if ( !mimeType.isEmpty() ) item->setMimeType( mimeType );
> +  } else {
> +    QString tmpFile;
> +    if ( KIO::NetAccess::download( uri, tmpFile, this ) ) {

Is that file ever removed?

Cheers,
Reinhold
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGMKBPTqjEwhXvPN0RAhGgAJ9WWFoJ7U4UYx+DDE1TB3nToeknYwCfRLUo
vzBb83Sam5Dq4cCUyyqoVYo=
=GBRX
-----END PGP SIGNATURE-----
[prev in list] [next in list] [prev in thread] [next in thread] 

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