Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bIqJC-0002KZ-UJ for pgadmin-hackers@arkaria.postgresql.org; Fri, 01 Jul 2016 04:44:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bIqJC-0000xl-GK for pgadmin-hackers@arkaria.postgresql.org; Fri, 01 Jul 2016 04:44:06 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bIqIx-0000jq-TT for pgadmin-hackers@postgresql.org; Fri, 01 Jul 2016 04:43:52 +0000 Received: from mail-qk0-x236.google.com ([2607:f8b0:400d:c09::236]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bIqIp-0005Ev-O7 for pgadmin-hackers@postgresql.org; Fri, 01 Jul 2016 04:43:50 +0000 Received: by mail-qk0-x236.google.com with SMTP id o76so70073009qke.0 for ; Thu, 30 Jun 2016 21:43:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=csOV2lInkzR4wIzpeIJkciUnssF1XVMj+xcY9CoC9xQ=; b=CsTMg4+5RQAVCWwpP4nFGiX4Up3ViA9WNZURj5Mo/A1EmUAkL9M6SXj+MSqne2XGkf UQBq/bKf6zVAECATNBVYKhBD5dcSqE58yU6+ZAOwERR7tmwhVx8JYv5W+5gVnmI3Fk1W cGk+u1S1vES4z0sWan0292HWSYlc7coDW6SDOC+ZkzSwH+fUF6RywNh3ZRUX64gR0V3W hU3l3BBZmq05xI+Ajqbnx/Lmq0eo7Quf9xH7H5ss3EZkwY5/mNXuvRMj9DOUY3n/k6Xw d/wwRczqcxW1IlP8VGrffUlAosRuDWB36up1egbjLIGnn7EIMcedupr/WB64XfYqK6f7 NcKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=csOV2lInkzR4wIzpeIJkciUnssF1XVMj+xcY9CoC9xQ=; b=FORtHGNPwyKWvZ4eNY3uKPY8aNdSCtGlWamvsjpSqfX4zxDWd/KNRUO23ypF7hpSJ1 Zl2Dt0cBnEFAnjJy0HphZxiPPCmCB/NfxQsHAcZmeC8kZhccSCo+vWbEd/fpwgSwGy3L bTYrP+/XqL95zDcRNHzRRr77NylbXDx60FD/3m3n6kd2+oV3v/d86dQrON7+qDmnHHHx dDcRjPbSTBtUPnqaks4/D8rAX/S95kArzWBreY9CqH+/nHx6Y8o6FBt6Tz9J3w4SJo8V xr4oLYsaK8xsJwxc9C/eP8DO2j+NIzk9oOzyOgo2qE2T8e1dZaC9BP8y6JnAiIXPUek2 LFaw== X-Gm-Message-State: ALyK8tLqLrr2VK8LPxYOrTY5OiqdDwNY9eH6qYs9DLeBaXOagq20KD36M6s3ArG0dGq8WfNmCaD35TGJioP4RO4r X-Received: by 10.129.158.83 with SMTP id v80mr8530739ywg.9.1467348222656; Thu, 30 Jun 2016 21:43:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.57.14 with HTTP; Thu, 30 Jun 2016 21:43:42 -0700 (PDT) In-Reply-To: References: From: Neel Patel Date: Fri, 1 Jul 2016 10:13:42 +0530 Message-ID: Subject: Re: [pgAdmin4][runtime]: Download feature in runtime To: Dave Page Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary=94eb2c0b642492f54705368ba1d1 X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgadmin-hackers Precedence: bulk Sender: pgadmin-hackers-owner@postgresql.org --94eb2c0b642492f54705368ba1d1 Content-Type: text/plain; charset=UTF-8 Hi Dave, On Thu, Jun 30, 2016 at 7:31 PM, Dave Page wrote: > Hi > > On Thu, Jun 30, 2016 at 10:42 AM, Neel Patel > 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;"