mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-18 21:31:00 +00:00
Added context menu entry for Opera bookmark files.
This commit is contained in:
parent
6906c2b136
commit
3dc513a88d
3 changed files with 46 additions and 2 deletions
|
|
@ -15,8 +15,8 @@ Features:
|
|||
- checking: Added support for Google Chrome bookmark files.
|
||||
- gui: Preselect filename on save dialog when editing file:// URLs.
|
||||
Closes: SF bug #3176022
|
||||
- gui: Add context menu entries for finding Google Chrome bookmark
|
||||
file.
|
||||
- gui: Add context menu entries for finding Google Chrome and Opera
|
||||
bookmark files.
|
||||
|
||||
|
||||
6.3 "Due Date" (released 6.2.2011)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,41 @@
|
|||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
import os
|
||||
|
||||
# Windows filename encoding
|
||||
nt_filename_encoding="mbcs"
|
||||
|
||||
# List of possible Opera bookmark files.
|
||||
OperaBookmarkFiles = (
|
||||
"bookmarks.adr", # for Opera >= 10.0
|
||||
"opera6.adr",
|
||||
)
|
||||
|
||||
|
||||
def get_profile_dir ():
|
||||
"""Return path where all profiles of current user are stored."""
|
||||
if os.name == 'nt':
|
||||
basedir = unicode(os.environ["APPDATA"], nt_filename_encoding)
|
||||
dirpath = os.path.join(basedir, u"Opera")
|
||||
elif os.name == 'posix':
|
||||
basedir = unicode(os.environ["HOME"])
|
||||
dirpath = os.path.join(basedir, u".opera")
|
||||
return dirpath
|
||||
|
||||
|
||||
def find_bookmark_file ():
|
||||
"""Return the bookmark file of the Default profile.
|
||||
Returns absolute filename if found, or empty string if no bookmark file
|
||||
could be found.
|
||||
"""
|
||||
dirname = os.path.join(get_profile_dir(), "profile")
|
||||
if os.path.isdir(dirname):
|
||||
for name in OperaBookmarkFiles:
|
||||
fname = os.path.join(dirname, name)
|
||||
if os.path.isfile(fname):
|
||||
return fname
|
||||
return u""
|
||||
|
||||
|
||||
def parse_bookmarks (data):
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ class LineEdit (QtGui.QLineEdit):
|
|||
action.triggered.connect(self.add_firefox)
|
||||
action = menu.addAction(_("Google Chrome bookmark file"))
|
||||
action.triggered.connect(self.add_chromium)
|
||||
action = menu.addAction(_("Opera bookmark file"))
|
||||
action.triggered.connect(self.add_opera)
|
||||
menu.exec_(event.globalPos())
|
||||
|
||||
def add_firefox (self):
|
||||
|
|
@ -76,3 +78,10 @@ class LineEdit (QtGui.QLineEdit):
|
|||
fname = find_bookmark_file()
|
||||
if fname:
|
||||
self.setText(fname)
|
||||
|
||||
def add_opera (self):
|
||||
"""Copy Opery bookmark file URL."""
|
||||
from ..bookmarks.opera import find_bookmark_file
|
||||
fname = find_bookmark_file()
|
||||
if fname:
|
||||
self.setText(fname)
|
||||
|
|
|
|||
Loading…
Reference in a new issue