rishiraj
28th January 2009, 07:11
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="));
now if i give the path of the picture--
QDesktopServices::openUrl(QUrl("mailto:?subject=&body=&attach=/path/Desktop/buttons/button1.PNG"));
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());
but, if i write --
QDesktopServices::openUrl(QUrl("mailto:?subject=&body=&attach=fileName"));
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.
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="));
now if i give the path of the picture--
QDesktopServices::openUrl(QUrl("mailto:?subject=&body=&attach=/path/Desktop/buttons/button1.PNG"));
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());
but, if i write --
QDesktopServices::openUrl(QUrl("mailto:?subject=&body=&attach=fileName"));
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.