forked from dmayer/idb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplist_file_widget.rb
64 lines (50 loc) · 1.53 KB
/
plist_file_widget.rb
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
require_relative 'path_list_widget_item'
class PlistFileWidget < Qt::Widget
def initialize *args
super *args
@refresh = Qt::PushButton.new "Refresh"
@refresh.connect(SIGNAL :released) {
refresh
}
@list = Qt::ListWidget.new self
@list.connect(SIGNAL('itemDoubleClicked(QListWidgetItem*)')) { |item|
cache_name = $selected_app.cache_file item.full_path
if cache_name.nil?
$log.error "File #{item.full_path} could not be downloaded. Either the file does not exist (e.g., dead symlink) or there is a permission problem."
else
$device.ops.open cache_name
end
}
# @list.setContextMenuPolicy(Qt::CustomContextMenu);
# @list.connect(SIGNAL('customContextMenuRequested(QPoint)')) { |item|
# menu = Qt::Menu.new("Context menu", self)
# menu.addAction(Qt::Action.new("Hello", self));
# menu.exec(mapToGlobal(pos));
#
# }
# "Launch app"
layout = Qt::VBoxLayout.new do |v|
v.add_widget(@list)
v.add_widget(@refresh)
end
setLayout(layout)
end
def clear
@list.clear
end
def refresh
@list.clear
plist_files = $selected_app.find_plist_files
plist_files.each { |full_path|
item = PathListWidgetItem.new
if $device.simulator?
item.setText full_path.sub($selected_app.app_dir,'')
else
pc = $device.protection_class full_path
item.setText full_path.sub($selected_app.app_dir,'') + " => " + pc.strip
end
item.full_path = full_path
@list.addItem item
}
end
end