summaryrefslogtreecommitdiff
path: root/indra/newview/lldirpicker.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2011-04-02 07:07:49 -0400
committerOz Linden <oz@lindenlab.com>2011-04-02 07:07:49 -0400
commite58c809a5816383674d0f1957440fad728e88893 (patch)
tree83f1ff2c4bee8237c4557793143b2133623943a4 /indra/newview/lldirpicker.cpp
parentf9af1f4fca028709b0262c0e8c40eefc2ab13d00 (diff)
parente6c0615b97019cf9c8aee267513757c0c2510420 (diff)
merge changes for STORM-1131
Diffstat (limited to 'indra/newview/lldirpicker.cpp')
-rw-r--r--indra/newview/lldirpicker.cpp40
1 files changed, 39 insertions, 1 deletions
diff --git a/indra/newview/lldirpicker.cpp b/indra/newview/lldirpicker.cpp
index 53101f0ce2..dd243397a1 100644
--- a/indra/newview/lldirpicker.cpp
+++ b/indra/newview/lldirpicker.cpp
@@ -35,6 +35,7 @@
#include "llframetimer.h"
#include "lltrans.h"
#include "llwindow.h" // beforeDialog()
+#include "llviewercontrol.h"
#if LL_LINUX || LL_SOLARIS
# include "llfilepicker.h"
@@ -53,6 +54,23 @@ LLDirPicker LLDirPicker::sInstance;
//
// Implementation
//
+
+// utility function to check if access to local file system via file browser
+// is enabled and if not, tidy up and indicate we're not allowed to do this.
+bool LLDirPicker::check_local_file_access_enabled()
+{
+ // if local file browsing is turned off, return without opening dialog
+ bool local_file_system_browsing_enabled = gSavedSettings.getBOOL("LocalFileSystemBrowsingEnabled");
+ if ( ! local_file_system_browsing_enabled )
+ {
+ mDir.clear(); // Windows
+ mFileName = NULL; // Mac/Linux
+ return false;
+ }
+
+ return true;
+}
+
#if LL_WINDOWS
LLDirPicker::LLDirPicker() :
@@ -72,6 +90,13 @@ BOOL LLDirPicker::getDir(std::string* filename)
{
return FALSE;
}
+
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
BOOL success = FALSE;
// Modal, so pause agent
@@ -231,7 +256,13 @@ BOOL LLDirPicker::getDir(std::string* filename)
if( mLocked ) return FALSE;
BOOL success = FALSE;
OSStatus error = noErr;
-
+
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
mFileName = filename;
// mNavOptions.saveFileName
@@ -289,6 +320,13 @@ void LLDirPicker::reset()
BOOL LLDirPicker::getDir(std::string* filename)
{
reset();
+
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
if (mFilePicker)
{
GtkWindow* picker = mFilePicker->buildFilePicker(false, true,