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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef00043ddd797d7eb54541887a7fc555b4cf364776c4816fd1c0595846b1bfa5
4
- data.tar.gz: ae2776b9ba39d934ca00e2429e025b45b7dc2465a45ff63c3632051c4cadcbbc
3
+ metadata.gz: 1b5ae43229614572636751dc0765e94da577124b603fdfe034464b9ed7b4aac7
4
+ data.tar.gz: 810e536eb5b67bf68c419eae154567c006deb70ef59cdeeb403ec6eaf6c3ac9d
5
5
  SHA512:
6
- metadata.gz: 97834105620607927518ef39a38e3430cd22debf3c1e56637c850ab7ee1f63e774307764bf938e45512efd607d0b6d4fbc84bb016437d252281e5d6c12f0f371
7
- data.tar.gz: c43afc8ec1c5d1fac3e97a8cce5fc90f8844d11727172ccdb57a31e54442e86a90228678003d47dd3eca41b1749c000ef9a4913c1430c66ab9bf61d32a31e430
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", :_on_endprocess_action_triggered)
63
- @whois_action = initialize_actions_act(QIcon::ThemeIcon::EditFind, "", :_on_whois_action_triggered)
64
- @copy_action = initialize_actions_act(QIcon::ThemeIcon::EditCopy, "", :_on_copy_action_triggered)
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, slot)
68
- action = QAction.new(QIcon.from_theme(icon), text, self)
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.contains(".") ? remote_address : "#{remote_address[0, 12]}..."
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 \"#{@lastindex.data.value}\"")
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
@@ -1,3 +1,3 @@
1
1
  module NetmonQt
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-netmon-qt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Doe