Results 1 to 10 of 10

Thread: attaching file after opening default email client(Qt 4.4,Linux)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2008
    Location
    My spaceship needs repairs..so, I am stuck on beautiful earth
    Posts
    98
    Thanks
    25
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Post attaching file after opening default email client(Qt 4.4,Linux)

    Hi,
    need help in implementing this--
    When I click 'email photo', the default email client should open up and the photo currently displayed in the gallery is automatically attached.

    I have got the default email client to open (but,can't attach the photo) by using this--
    Qt Code:
    1. QDesktopServices::openUrl(QUrl("mailto:?subject=&body=&attach="));
    To copy to clipboard, switch view to plain text mode 
    now if i give the path of the picture--
    Qt Code:
    1. QDesktopServices::openUrl(QUrl("mailto:?subject=&body=&attach=/path/Desktop/buttons/button1.PNG"));
    To copy to clipboard, switch view to plain text mode 
    the pic gets attached.But,I don't want that (cause I will keep opening different picture files in the application so, filenames will keep changing).

    When I view/open any picture ,I get it's path in a variable 'fileName' - -
    Qt Code:
    1. fileName = QFileDialog::getOpenFileName(this,tr("Open File"), QDir::currentPath());
    To copy to clipboard, switch view to plain text mode 

    but, if i write --
    Qt Code:
    1. QDesktopServices::openUrl(QUrl("mailto:?subject=&body=&attach=fileName"));
    To copy to clipboard, switch view to plain text mode 
    it doesn't work and shows "cannot attach 'fileName':no such file or directory."
    But,if you use a QMessageBox inside the email() slot to print 'fileName', you get the correct filepath.

    Can anyone suggest on what to change in the code to get the correct file attached?
    Thanks in advance.
    Last edited by rishiraj; 28th January 2009 at 07:27. Reason: spelling error
    If everything seems to be going well, you have obviously overlooked something.

Similar Threads

  1. Replies: 7
    Last Post: 5th January 2009, 08:27
  2. Opening swf file in the default browser
    By munna in forum Qt Programming
    Replies: 16
    Last Post: 5th May 2006, 09:33
  3. Opening the default mail client
    By munna in forum Newbie
    Replies: 5
    Last Post: 3rd April 2006, 13:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.