public inbox for [email protected]  
help / color / mirror / Atom feed
From: Neel Patel <[email protected]>
To: Dave Page <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin4][runtime]: Download feature in runtime
Date: Fri, 1 Jul 2016 10:13:42 +0530
Message-ID: <CACCA4P2bEpUNZhkGQLY1JnMiBChFhauLpqiuAgJQiYcTV6YZ7g@mail.gmail.com> (raw)
In-Reply-To: <CA+OCxozY73dR+0OrOrO-urNHaUOJBXjUJB1q31-oMRyM4jXoyg@mail.gmail.com>
References: <CACCA4P2eP9URRcHXXiPftxodmV_da57pjSw9PKLgpjEHjrb6MQ@mail.gmail.com>
	<CA+OCxozY73dR+0OrOrO-urNHaUOJBXjUJB1q31-oMRyM4jXoyg@mail.gmail.com>
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

--94eb2c0b642492f54705368ba1d1
Content-Type: text/plain; charset=UTF-8

Hi Dave,

On Thu, Jun 30, 2016 at 7:31 PM, Dave Page <[email protected]> wrote:

> Hi
>
> On Thu, Jun 30, 2016 at 10:42 AM, Neel Patel
> <[email protected]> wrote:
> > Hi,
> >
> > Please find attached patch file for initial version of download file in
> > runtime application.
>
> I've attached an update with some improved messages, and setting the
> progress dialogue to be modal (seeing as we cannot have multiple
> downloads, and it's easy to lose the dialogue).
>
> > With this patch, we have implemented two features.
> >
> > Feature 1 :- Normal "Download file" from runtime application
> >
> > Previously "Download file" was not implemented in runtime application.
> > With this patch file, we have handled Qt signal for download file
> properly.
>
> This seems to work fine. I did get one crash (after I cancelled a
> download, then tried it again), but I couldn't reproduce that.
>

Okay. I will try to reproduce the issue and also i will try to review the
code again if i can find something regrading crash.


>
> > Feature 2 :-   "download" attribute support for 'a' tag for client side
> > download
> >
> > As per our knowledge, webkit has not implemented the download attribute
> at
> > 'a' tag.
> > Currently it shows under development from below link.
> >
> > https://bugreports.qt.io/browse/QTBUG-47732
> >
> > We did not found any signal in Qt for download attribute feature but to
> > implement this feature in runtime application, we added one workaround to
> > make it work with download CSV file.
> >
> > When we click on download buttons, we are getting Qt signal
> "urlLinkClicked"
> > and in that url we are finding "data:text/csv" from encoded URL generated
> > from sqleditor. Once we found that tag then we are decoding the csv data
> and
> > writing to file.
> >
> > Is that right approach ? Should we add our own custom mime-type to
> header ?
> > Let us know your thoughts on this feature.
>
> This doesn't work so well, for a number of reasons:
>
> 1) QT Creator is complaining that your regexp contains an invalid
> escape sequence (line 546).
>

I will fix.

>
> 2) The default file name seems to be the entire data blob. I would
> suggest making the file name "download.csv" if we don't know anything
> better. The "csv" part should be taken from the mime type (see below)
>
> 3) Should we handle all "data:" downloads in this way? Taking the file
> type and default extension from the mimetype offered.
>

We can handle all "data:" download. We will extract the filename and
extension from mime type.
As i know, Qt provides QUrlQuery class which will be useful to find the key
value pair. I will test and let you know.

e.g. If we have header as below

"data:text/csv;charset=utf-8;Content-disposition:attachment;filename=download.csv;"



view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: [pgAdmin4][runtime]: Download feature in runtime
  In-Reply-To: <CACCA4P2bEpUNZhkGQLY1JnMiBChFhauLpqiuAgJQiYcTV6YZ7g@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox