Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Add multiple function select in UploadAll dialog #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions first_plugin_ida/first.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
from hashlib import sha256, md5, sha1
from base64 import b64encode, b64decode

from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

# Constants
#-------------------------------------------------------------------------------
FIRST_INDEX = {
Expand Down Expand Up @@ -2669,6 +2672,7 @@ def __init__(self, header, data, parent=None):

self.select_all_flag = False
self.rows_selected = set()
self.last_selected_row = None

def set_row_selected(self, row):
'''Causes a row to be selected or deselected.
Expand Down Expand Up @@ -3113,10 +3117,7 @@ def __init__(self, dialog):

def __data(self, thread, data):
if ('failed' in data) and data['failed']:
if 'msg' not in data:
return

msg = '[1st] Error: {}'.format(data['msg'])
msg = '[1st] Error: {}'.format(result['msg'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause an exception to occur, result is not a variable in the scope of __data. I believe the original master and dev branch correctly checks.

idaapi.execute_ui_requests((FIRSTUI.Requests.Print(msg),))
return

Expand Down Expand Up @@ -4109,7 +4110,18 @@ def table_clicked(self, index, table_view, data_model):
self.select_all.setChecked(False)
self.select_all.stateChanged.connect(self.select_all_callback)

data_model.set_row_selected(index.row())
modifiers = QtGui.QGuiApplication.keyboardModifiers()
row_nr = index.row()
if modifiers == Qt.ShiftModifier and data_model.last_selected_row is not None:
if row_nr >= data_model.last_selected_row:
for x in xrange(data_model.last_selected_row + 1, row_nr + 1):
data_model.set_row_selected(x)
else:
for x in xrange(row_nr, data_model.last_selected_row):
data_model.set_row_selected(x)
else:
data_model.set_row_selected(row_nr)
data_model.last_selected_row = row_nr
table_view.reset()

def get_selected_data(self):
Expand Down