ruby-netmon-qt 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/netmon-qt/app/components/connstableview.rb +17 -26
- data/lib/netmon-qt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1b5ae43229614572636751dc0765e94da577124b603fdfe034464b9ed7b4aac7
|
|
4
|
+
data.tar.gz: 810e536eb5b67bf68c419eae154567c006deb70ef59cdeeb403ec6eaf6c3ac9d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b530cefa1913b5253f33dc071f220dc7c88742e6150a9f0c3664b6a4e96f8a6a9137bf6dd30cc9559beeb1ddb7ee875c19ffc271823557ef759a7b18babff99
|
|
7
|
+
data.tar.gz: d96e4ed33ca77f5eb5e163d6ca618c2963ff309d4f7829fa0b33b1029a85a934f179a53fb1775c122a9873c5f954b8300af06a58789313f42fe7270742f41a08
|
|
@@ -24,9 +24,6 @@ class ConnsTableView < RubyQt6::Bando::QWidget
|
|
|
24
24
|
slot "_on_autorefreshbtn_toggled(bool)"
|
|
25
25
|
slot "_on_autorefresh_timer_timeout()"
|
|
26
26
|
slot "_on_tableview_custom_context_menu_requested(QPoint)"
|
|
27
|
-
slot "_on_endprocess_action_triggered()"
|
|
28
|
-
slot "_on_whois_action_triggered()"
|
|
29
|
-
slot "_on_copy_action_triggered()"
|
|
30
27
|
end
|
|
31
28
|
|
|
32
29
|
attr_reader :processfilter, :protocolfilter, :statefilter, :userfilter
|
|
@@ -59,15 +56,13 @@ class ConnsTableView < RubyQt6::Bando::QWidget
|
|
|
59
56
|
end
|
|
60
57
|
|
|
61
58
|
def initialize_actions
|
|
62
|
-
@endprocess_action = initialize_actions_act(QIcon::ThemeIcon::ApplicationExit, "End Process"
|
|
63
|
-
@whois_action = initialize_actions_act(QIcon::ThemeIcon::EditFind, ""
|
|
64
|
-
@copy_action = initialize_actions_act(QIcon::ThemeIcon::EditCopy, ""
|
|
59
|
+
@endprocess_action = initialize_actions_act(QIcon::ThemeIcon::ApplicationExit, "End Process")
|
|
60
|
+
@whois_action = initialize_actions_act(QIcon::ThemeIcon::EditFind, "")
|
|
61
|
+
@copy_action = initialize_actions_act(QIcon::ThemeIcon::EditCopy, "")
|
|
65
62
|
end
|
|
66
63
|
|
|
67
|
-
def initialize_actions_act(icon, text
|
|
68
|
-
|
|
69
|
-
action.triggered.connect(self, slot)
|
|
70
|
-
action
|
|
64
|
+
def initialize_actions_act(icon, text)
|
|
65
|
+
QAction.new(QIcon.from_theme(icon), text, self)
|
|
71
66
|
end
|
|
72
67
|
|
|
73
68
|
def initialize_toolbar
|
|
@@ -201,40 +196,36 @@ class ConnsTableView < RubyQt6::Bando::QWidget
|
|
|
201
196
|
menu.set_attribute(Qt::WA_DeleteOnClose)
|
|
202
197
|
|
|
203
198
|
pid = @lastindex.sibling_at_column(COLUMN_PROCESS_ID).data.value.to_s
|
|
204
|
-
remote_address = @lastindex.sibling_at_column(COLUMN_REMOTE_ADDRESS).data.value
|
|
205
|
-
remote_address = remote_address.
|
|
199
|
+
remote_address = @lastindex.sibling_at_column(COLUMN_REMOTE_ADDRESS).data.value.to_s
|
|
200
|
+
remote_address = remote_address.include?(".") ? remote_address : "#{remote_address[0, 12]}..."
|
|
201
|
+
text = @lastindex.data.value.to_s
|
|
206
202
|
|
|
207
203
|
@endprocess_action.set_enabled(pid.to_i.nonzero?)
|
|
208
204
|
@whois_action.set_text("Whois #{remote_address} - via IPinfo")
|
|
209
|
-
@copy_action.set_text("Copy \"#{
|
|
205
|
+
@copy_action.set_text("Copy \"#{text}\"")
|
|
210
206
|
|
|
211
207
|
menu.add_action(@endprocess_action)
|
|
212
208
|
menu.add_separator
|
|
213
209
|
menu.add_action(@whois_action)
|
|
214
210
|
menu.add_action(@copy_action)
|
|
215
211
|
|
|
216
|
-
menu.exec(@tableview.viewport.map_to_global(position))
|
|
212
|
+
case menu.exec(@tableview.viewport.map_to_global(position))
|
|
213
|
+
when @endprocess_action then _on_endprocess_action_triggered(pid)
|
|
214
|
+
when @whois_action then _on_whois_action_triggered(remote_address)
|
|
215
|
+
when @copy_action then _on_copy_action_triggered(text)
|
|
216
|
+
end
|
|
217
217
|
end
|
|
218
218
|
|
|
219
|
-
def _on_endprocess_action_triggered
|
|
220
|
-
return unless @lastindex.valid?
|
|
221
|
-
|
|
222
|
-
pid = @lastindex.sibling_at_column(COLUMN_PROCESS_ID).data.value
|
|
219
|
+
def _on_endprocess_action_triggered(pid)
|
|
223
220
|
QProcess.execute("kill", QStringList.new << "-9" << pid)
|
|
224
221
|
end
|
|
225
222
|
|
|
226
|
-
def _on_whois_action_triggered
|
|
227
|
-
return unless @lastindex.valid?
|
|
228
|
-
|
|
229
|
-
remote_address = @lastindex.sibling_at_column(COLUMN_REMOTE_ADDRESS).data.value
|
|
223
|
+
def _on_whois_action_triggered(remote_address)
|
|
230
224
|
url = QUrl.new("https://ipinfo.io/#{remote_address}")
|
|
231
225
|
QDesktopServices.open_url(url)
|
|
232
226
|
end
|
|
233
227
|
|
|
234
|
-
def _on_copy_action_triggered
|
|
235
|
-
return unless @lastindex.valid?
|
|
236
|
-
|
|
237
|
-
text = @lastindex.data.value
|
|
228
|
+
def _on_copy_action_triggered(text)
|
|
238
229
|
QApplication.clipboard.set_text(text)
|
|
239
230
|
end
|
|
240
231
|
end
|
data/lib/netmon-qt/version.rb
CHANGED