Class: Pincerna::FirefoxBookmark

Inherits:
Bookmark show all
Defined in:
lib/pincerna/firefox_bookmark.rb

Overview

Show the list of Firefox bookmarks.

Constant Summary collapse

ICON =

The icon to show for each feedback item.

Pincerna::Base::ROOT + "/images/firefox.png"
PROFILES_SEARCH =

A wildcard to searc the default profile

File.expand_path("~/Library/Application Support/Firefox/Profiles/*.default")
QUERIES =

The queries to obtain the bookmarks

[
  "SELECT b.title, p.url, b.parent FROM moz_bookmarks b, moz_places p WHERE b.type=1 AND b.fk=p.id",
  "SELECT b.title, b.id, b.parent FROM moz_bookmarks b WHERE b.type=2"
]

Constants inherited from Bookmark

Bookmark::MATCHER, Bookmark::SEPARATOR

Constants inherited from Base

Base::CACHE_ROOT, Base::FULL_NAME, Base::MATCHER, Base::RELEVANT_MATCHES, Base::ROOT, Base::TYPES, Base::WORKFLOW_ROOT

Instance Attribute Summary

Attributes inherited from Base

#format, #format_content_type, #output

Instance Method Summary collapse

Methods inherited from Bookmark

#perform_filtering, #process_results

Methods inherited from Base

#add_feedback_item, execute!, #filter, #format_float, #initialize, #output_feedback, #perform_filtering, #process_results, #round_float

Constructor Details

This class inherits a constructor from Pincerna::Base

Instance Method Details

#read_bookmarksObject

Reads the list of Firefox Bookmarks.



23
24
25
26
27
28
29
30
31
32
# File 'lib/pincerna/firefox_bookmark.rb', line 23

def read_bookmarks
  path = Dir.glob(PROFILES_SEARCH).first
  data = execute_command("/usr/bin/sqlite3", "-echo", "#{path}/places.sqlite", QUERIES.join("; "))

  if data && !data.empty? then
    @folders = {}
    parse_bookmarks_data(data)
    build_paths
  end
end