Skip to content

Commit

Permalink
native dialog does not work well on kde so using the qt dialog instead
Browse files Browse the repository at this point in the history
  • Loading branch information
guy-keller committed May 7, 2024
1 parent 693ecb0 commit 3dc5d81
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ def __init__(self, *args, **kwargs):

def open_button_clicked(self) -> None:
print("main :: open_button_clicked")
dialog = QFileDialog()
dialog.setFileMode(QFileDialog.FileMode.AnyFile)

my_filter = QDir.Filter(QDir.Filter.Files)
dialog.setDirectory(QDir.home())
dialog.setFilter(my_filter)
dialog.setNameFilter("*.ovpn")
filenames = QFileDialog.getOpenFileName(
parent=self,
caption="Select OVPN file",
filter="*.ovpn",
options=QFileDialog.Option.DontUseNativeDialog
)

if dialog.exec():
filenames = dialog.selectedFiles()
if filenames and len(filenames) > 0 and filenames[0] != "":
print("main:: open_button_clicked :: filenames:", filenames)
self.status.setText(f"File: {filenames[0]}")
self.status.setToolTip(filenames[0])
self.ovpn_file_path = filenames[0]
Expand Down

0 comments on commit 3dc5d81

Please sign in to comment.