Add button to manually add blacklisted post URLs
Supports pasting multiple URLs at once (space or newline separated).
This commit is contained in:
parent
781f03e85b
commit
558c07877b
@ -254,6 +254,10 @@ class SettingsDialog(QDialog):
|
|||||||
layout.addWidget(self._bl_post_list)
|
layout.addWidget(self._bl_post_list)
|
||||||
|
|
||||||
bl_post_row = QHBoxLayout()
|
bl_post_row = QHBoxLayout()
|
||||||
|
add_post_btn = QPushButton("Add...")
|
||||||
|
add_post_btn.clicked.connect(self._bl_add_post)
|
||||||
|
bl_post_row.addWidget(add_post_btn)
|
||||||
|
|
||||||
remove_post_btn = QPushButton("Remove Selected")
|
remove_post_btn = QPushButton("Remove Selected")
|
||||||
remove_post_btn.clicked.connect(self._bl_remove_post)
|
remove_post_btn.clicked.connect(self._bl_remove_post)
|
||||||
bl_post_row.addWidget(remove_post_btn)
|
bl_post_row.addWidget(remove_post_btn)
|
||||||
@ -265,6 +269,20 @@ class SettingsDialog(QDialog):
|
|||||||
layout.addLayout(bl_post_row)
|
layout.addLayout(bl_post_row)
|
||||||
return w
|
return w
|
||||||
|
|
||||||
|
def _bl_add_post(self) -> None:
|
||||||
|
from PySide6.QtWidgets import QInputDialog
|
||||||
|
text, ok = QInputDialog.getMultiLineText(
|
||||||
|
self, "Add Blacklisted Posts",
|
||||||
|
"Paste URLs (one per line or space-separated):",
|
||||||
|
)
|
||||||
|
if ok and text.strip():
|
||||||
|
urls = text.replace("\n", " ").split()
|
||||||
|
for url in urls:
|
||||||
|
url = url.strip()
|
||||||
|
if url:
|
||||||
|
self._db.add_blacklisted_post(url)
|
||||||
|
self._bl_post_list.addItem(url)
|
||||||
|
|
||||||
def _bl_remove_post(self) -> None:
|
def _bl_remove_post(self) -> None:
|
||||||
item = self._bl_post_list.currentItem()
|
item = self._bl_post_list.currentItem()
|
||||||
if item:
|
if item:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user