Bug 173896 - Sent-to menu entry or send-via-email menu-entry
Summary: Sent-to menu entry or send-via-email menu-entry
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
: 222777 311417 368015 389912 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-10-30 12:34 UTC by Martin Schnieders
Modified: 2018-04-06 13:33 UTC (History)
18 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
script to send an email with *.pdf-files as attachement(s) currently opened by okular (2.15 KB, application/x-shellscript)
2016-08-31 10:59 UTC, mossl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Schnieders 2008-10-30 12:34:43 UTC
Version:            (using KDE 4.1.2)
OS:                Linux
Installed from:    Ubuntu Packages

I would like to see a send-via-email function as it shortens the via to send a ps or pdf or whatever via kontact/kmail.
Comment 1 Brad Hards 2008-12-01 02:47:58 UTC
The kpdf equivalent request to this was #126066.
Comment 2 schmirrwurst 2009-04-06 16:36:48 UTC
The same for me, it is an important feature !
Comment 3 Moritz Moeller-Herrmann 2010-01-08 12:13:51 UTC
Is this planned for KDE-4.4?
Comment 4 Albert Astals Cid 2010-01-09 00:34:25 UTC
No and probably will never be there, i could understand it in dolphin/konqueror, but in okular makes no sense if you ask me
Comment 5 Maciej Pilichowski 2010-01-09 08:11:31 UTC
Let's revert the way of thinking -- you are reading great pdf file. You would like to send it to a friend (quickly and easily). How you do it?

It makes sense in any viewer or editor. Thinking in categories of saving to disk or loading from disk is pre-internet era. Those are today's equivalent to "save" to media X or load from media Y. X, Y can be disk, mail, web page, etc. Each program (editor/viewer) should support this.
Comment 6 Pino Toscano 2010-01-14 23:24:44 UTC
*** Bug 222777 has been marked as a duplicate of this bug. ***
Comment 7 Paul 2010-05-05 04:53:07 UTC
Use case:

1) Go to website
2) Open PDF 
3) Hmm, interesting, I shall send it to a friend
4) Save somewhere
5) Open email 
6) Add PDF as attachment
7) Send email
8) Open Dolphin
9) Find PDF and delete

This gets replaced with

4-9) Send email

This functionality isn't something that should necessarily be part of okular, it would be better served as a Send-To service infrastructure in KDE.  Similar to how Maemo 5 does it perhaps.  So the Send-to could be email, or a website, flickr whatever.  Like a kipi-plugins "export" but not limited just to images.
Comment 8 Piotr Budny 2010-09-07 10:44:07 UTC
I would see this option available too, cause auto downloading from browser makes this file dissapear in hundreds of files (hard to find in dolphin), so: 
1) downloading and auto opening
2) file->attach...
3) kmail composes mail with this pdf
Comment 9 schmirrwurst 2011-05-20 21:15:29 UTC
I find that this is not an option. There no other pdf viewer, where you can't send a copy via email... Its an important function ! 
And I can't believe it is that complicated to implement...
Comment 10 roucaries.bastien+bug 2011-09-04 14:26:22 UTC
Any news of this bug ?
Comment 11 Albert Astals Cid 2011-09-05 09:42:28 UTC
@9: It does not have anything to do with difficulty of implementation (though you said it was so easy and did not attach a patch ;-)) It is about domain of responsability, and Okular domain is pretty far away from sending mails.

@10: Remember, this is a wish, not a but.
Comment 12 sabik 2011-09-08 04:10:00 UTC
Hmm, I wonder if it would be closer to the domain of responsibility for Okular to be a drag'n'drop source; that would help with the use-case without the program becoming a mail client... Not that I'd be planning to implement this, so I can't complain if nobody else does either.
Comment 13 Paul 2011-09-08 04:44:50 UTC
@11 Note that this wish does not allude to okular being able to send email - that would be absurd.  This isn't a domain of responsibility concern.

The "Send-To" suggestion would be a menu item that can launch another application with the location of the currently viewed file as a parameter.

If thunderbird were the sent-to app, then the command line might read:

  thunderbird -compose "attachment='%u'"

Where %u is replaced with the current file. dbus would require a different launch.

Functionally it isn't that different from "open with" that other applications have as far as I can see, only there needs to be a way to register how each application needs the parameters to be set up to get the right behaviour.
Comment 14 Andreas Karrenbauer 2011-11-04 10:17:26 UTC
I desperately wish to see this functionality in okular, too.

In the meanwhile, I use the following not-so-nice-trick, which works together with kmail (perhaps also with other mail clients):

Create a new message in kmail. Then switch to okular and click on File->Open..., which opens a file dialog having the current pdf selected. Then drag&drop the file from the file list to the message window.

Note that the Open file dialog has the right folder and the right file preselected (the view with the files is centered to the desired file even if it is a temp folder with many other files), whereas the dialogs for "save as" and "save a copy" may point to a different folder such as "Documents" or something recently used.
Comment 15 Albert Astals Cid 2011-11-10 13:51:11 UTC
@12: Yes that'd be more like it, actually i thought it worked, but i see it does not
Comment 16 Moritz Moeller-Herrmann 2011-12-22 10:01:04 UTC
Here is a konqueror service menu that does the same for konqueror - send as kmail attachment. Can you not add something similar to okular? Should be really simple, you just need to hand over the file location to a script.

Even better would be to use 
xdg-email [--utf8] [--cc address] [--bcc address] [--subject text] [--body text] [--attach file] 

which would work even with other email clients. See http://portland.freedesktop.org/xdg-utils-1.0/


# Send-Attach.desktop
# Sends selected files as Kmail attachments.
# v4.0.5
# Tested with KDE 4.7.2

[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin,all/allfiles
Actions=openKmailAttachment
Encoding=UTF-8
MimeType=application/octet-stream
ExcludeServiceTypes=application/x-iso,kdedevice/*,inode/directory

[Desktop Action openKmailAttachment]
Name=Send File As Attachment
Name[cz]=Odeslat soubor e-mailem
Name[de]=Datei als Anhang versenden
Name[en]=Send File As Attachment
Name[es]=Enviar como archivo adjunto
Name[fr]=Envoyer le fichier en pièce jointe
Name[pt]=Enviar por correio-e
Name[pt_BR]=Enviar arquivo como anexo
Name[sk]=Poslať e-mailom

Icon=kmail
Exec=kmail --composer --attach %F `echo attachment=\'file://%F\' | sed 's/ \//,file:\/\/\//g'`
X-Ubuntu-Gettext-Domain=desktop_kdebase
Comment 17 Pino Toscano 2012-12-09 15:09:24 UTC
*** Bug 311417 has been marked as a duplicate of this bug. ***
Comment 18 robertkehl 2013-02-20 18:50:43 UTC
A Send-As-Email functionality is very desirable. Restricting to kmail is not desirable, though; the system-wide email application should be used instead.
Comment 19 Moritz Moeller-Herrmann 2015-09-20 10:49:30 UTC
There is still interest in this feature - it is a glaring omission if you ask me, seriously making okular uncomfortable to use compared to all other PDF readers I regularly use.
Comment 20 Rok 2015-12-17 09:22:07 UTC
The developers should (sometimes) listen to the public.

This feature is in now-days really as common as saving file to the disk. This is true for all applications which can open any file. In fact the proper integration of KDE enables simple and consistent implementation of SHARE function.

If I look into the future it is more important than SaveAs. From user perspective (tablet users) this enables to save file not only disk but also on different -internet media.
Comment 21 Rok 2015-12-17 13:23:51 UTC
I have an idea. Is it possible to implement KIO slave protocol for sending mail? You will choose SaveAs in any application and forward this to kmail or anything else...
Comment 22 alex braga 2016-06-25 16:08:29 UTC
like acrobat reader the possibility to send directly the file via email, and stamp the file or just the page I like in > to print to file.
The best way also send just the page I would like to send via email from a new option print to send email page thanks
Comment 23 mossl 2016-08-30 15:47:21 UTC
*** Bug 368015 has been marked as a duplicate of this bug. ***
Comment 24 mossl 2016-08-30 15:50:36 UTC
okular is a great pdf-program, but I miss this function really. Maybe it could be realized by enabling addons - e.g. an addon that calls a shell-script could do nearly everything. (and would give developers the possibility to hand this work over ...)
Comment 25 robertkehl 2016-08-30 18:16:53 UTC
Forget about the idea, nobody needs it apparantly, they are moving to other programs an "apps".
Comment 26 robertkehl 2016-08-30 18:19:53 UTC
*** This bug has been confirmed by popular vote. ***
Comment 27 mossl 2016-08-31 10:55:14 UTC
assign this script to any global shortcut, and enjoy:

-------------------------------------------------
#!/bin/bash

# opens a new mail in kmail or (if installed) in thunderbird, with the selected 
# files as attachement
# modify the "lsof"-line if you want to find other files than *.pdf currently opened by okular...

# prerequisites: zenity

# attention: the colon (,) is used as separator for multiple attachements, and "?" might be a
# problem too
# , and ? are converted to URI (%2C resp. %3F) other troublemakers could be solved that way too

# THIS SCRIPT WILL !!!_NOT_!!! WORK FOR FILENAMES WITH LINEBREAKS - who ever thinks to need
# linebreaks in a filename is free to write a script of it's own ...

if [ "$(which zenity)" = "" ] ; then
        echo "zenity NOT installed, please install with: sudo apt install zenity"
        exit 0
fi

if [ "$(which thunderbird)" != "" ] ; then
        MailModus="TB"
else
        if [ "$(which kmail)" != "" ] ; then
                MailModus="KM"
        else
                echo "Neither KMail nor Thunderbird found ... exiting!"
                exit 0
        fi
fi


AllFilesOpen=$(lsof -c okular -Fn | grep -e '.*\.pdf' | sed s/n//)

IFSORIG=$IFS
IFS="
"

FilesToProcess=$(zenity	--text="Please select file(s) to send per mail..." \
			--list --multiple --separator="$IFS" \
			--column="*.pdf-files currently open" $AllFilesOpen \
			--width=750 --height=300)

if [ "$FilesToProcess" = "" ] ; then
	exit 0
fi

for FileToEncode in $FilesToProcess
do
        if [ $(echo $FileToEncode | grep -c ",") = "1" ] ; then
                FileToEncode=$(echo "$FileToEncode" | sed 's/,/%2C/g')
        fi

        if [ $(echo $FileToEncode | grep -c "?") = "1" ] ; then
                FileToEncode=$(echo "$FileToEncode" | sed 's/\?/%3F/g')
        fi
        case $MailModus in
        "TB")
            FilesProcessed="$FilesProcessed""file://""$FileToEncode"","
            ;;
        "KM")
            FilesProcessed="$FilesProcessed"" --attach 'file://""$FileToEncode""'"
            ;;
        *)
        esac
            
done

FilesProcessed=$(echo $FilesProcessed | sed -e 's/,$//g')

IFS=$IFSORIG

case $MailModus in
"TB")
    thunderbird -compose "attachment='$FilesProcessed'"
    ;;
"KM")
    echo "$FilesProcessed" | xargs kmail
    ;;
*)
esac

exit 0
-------------------------------------------------
Comment 28 mossl 2016-08-31 10:59:39 UTC
Created attachment 100858 [details]
script to send an email with *.pdf-files as attachement(s) currently opened by okular
Comment 29 Kevin Ottens 2017-10-18 14:55:23 UTC
Git commit a5da013a4da20f9230775fdf52275c5136e4f172 by Kevin Ottens.
Committed on 18/10/2017 at 14:55.
Pushed by ervin into branch 'master'.

Add a "share" menu to Okular

Summary: This is implemented using the Purpose framework.

Reviewers: aacid

Subscribers: #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8244

M  +15   -0    CMakeLists.txt
M  +3    -0    config-okular.h.cmake
M  +65   -0    part.cpp
M  +17   -0    part.h
M  +1    -0    part.rc

https://commits.kde.org/okular/a5da013a4da20f9230775fdf52275c5136e4f172
Comment 30 Albert Astals Cid 2018-02-05 17:48:15 UTC
*** Bug 389912 has been marked as a duplicate of this bug. ***