summaryrefslogtreecommitdiff
path: root/plugingui/filebrowser.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-04-16 21:33:38 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2017-04-16 21:33:38 +0200
commit14c76e247f982b153adba005283826a2b722f89f (patch)
tree4482b81f0cd812571183a244b40b06c978bfc056 /plugingui/filebrowser.cc
parent41a34f74ed1cf16428533724c5eb6f381d813850 (diff)
Hacky filebrowser-as-a-Dialog implementation.
Diffstat (limited to 'plugingui/filebrowser.cc')
-rw-r--r--plugingui/filebrowser.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/plugingui/filebrowser.cc b/plugingui/filebrowser.cc
index 50e34c3..3d3df99 100644
--- a/plugingui/filebrowser.cc
+++ b/plugingui/filebrowser.cc
@@ -69,6 +69,8 @@ FileBrowser::FileBrowser(Widget* parent)
CONNECT(&lineedit, enterPressedNotifier, this, &FileBrowser::handleKeyEvent);
CONNECT(&listbox, selectionNotifier,
this, &FileBrowser::listSelectionChanged);
+ CONNECT(this, fileSelectNotifier,
+ this, &FileBrowser::select);
btn_sel.setText("Select");
CONNECT(&btn_sel, clickNotifier, this, &FileBrowser::selectButtonClicked);
@@ -166,6 +168,15 @@ void FileBrowser::handleKeyEvent()
void FileBrowser::cancel()
{
+ has_filename = false;
+ hide();
+ fileSelectCancelNotifier();
+}
+
+void FileBrowser::select(const std::string& file)
+{
+ has_filename = true;
+ filename = file;
hide();
}
@@ -255,4 +266,14 @@ void FileBrowser::changeDir()
listbox.addItems(items);
}
+std::string FileBrowser::getFilename() const
+{
+ return filename;
+}
+
+bool FileBrowser::hasFilename() const
+{
+ return has_filename;
+}
+
} // GUI::