/usr/share/nautilus-python/extensions/nautilus-qdigidoc.py is in nautilus-qdigidoc 0.4.1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | #
# QDigiDoc Nautilus Extension
#
# Copyright (C) 2010 Erkko Kebbinau
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
import os
import urllib
import gettext
import locale
from gi.repository import Nautilus, GObject, Gio
APP = 'nautilus-qdigidoc'
class OpenDigidocExtension(GObject.GObject, Nautilus.MenuProvider):
def __init__(self):
pass
def _open_client(self, paths):
args = ""
for path in paths:
args += "\"%s\" " % path
cmd = ("qdigidocclient " + args + "&")
os.system(cmd)
def menu_activate_cb(self, menu, paths):
self._open_client(paths)
def valid_file(self, file):
return file.get_file_type() == Gio.FileType.REGULAR and file.get_uri_scheme() == 'file'
def get_file_items(self, window, files):
paths = []
for file in files:
if self.valid_file(file):
path = urllib.unquote(file.get_uri()[7:])
paths.append(path)
if len(paths) < 1:
return
locale.setlocale(locale.LC_ALL, '')
gettext.bindtextdomain(APP)
gettext.textdomain(APP)
_ = gettext.gettext
tooltip_message = gettext.ngettext('Sign selected file with Digidoc3 Client',
'Sign selected files with Digidoc3 Client',
len(paths))
item = Nautilus.MenuItem(
name="OpenDigidocExtension::DigidocSigner",
label=_('Sign with ID card'),
tip=tooltip_message
)
item.set_property('icon', 'qdigidoc-client')
item.connect('activate', self.menu_activate_cb, paths)
return item,
|