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--
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--
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' - -
fileName
= QFileDialog::getOpenFileName(this,tr
("Open File"),
QDir::currentPath());
fileName = QFileDialog::getOpenFileName(this,tr("Open File"), QDir::currentPath());
To copy to clipboard, switch view to plain text mode
but, if i write --
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.
Bookmarks