summaryrefslogtreecommitdiff
path: root/indra/newview/llfilepicker.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/llfilepicker.cpp
parentf9af1f4fca028709b0262c0e8c40eefc2ab13d00 (diff)
parente6c0615b97019cf9c8aee267513757c0c2510420 (diff)
merge changes for STORM-1131
Diffstat (limited to 'indra/newview/llfilepicker.cpp')
-rw-r--r--indra/newview/llfilepicker.cpp100
1 files changed, 98 insertions, 2 deletions
diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp
index c14be89641..51e76bcf9b 100644
--- a/indra/newview/llfilepicker.cpp
+++ b/indra/newview/llfilepicker.cpp
@@ -33,6 +33,7 @@
#include "lldir.h"
#include "llframetimer.h"
#include "lltrans.h"
+#include "llviewercontrol.h"
#include "llwindow.h" // beforeDialog()
#if LL_SDL
@@ -104,6 +105,20 @@ LLFilePicker::~LLFilePicker()
// nothing
}
+// 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 LLFilePicker::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 )
+ {
+ mFiles.clear();
+ return false;
+ }
+
+ return true;
+}
const std::string LLFilePicker::getFirstFile()
{
@@ -203,6 +218,12 @@ BOOL LLFilePicker::getOpenFile(ELoadFilter filter)
}
BOOL success = FALSE;
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
// don't provide default file selection
mFilesW[0] = '\0';
@@ -241,6 +262,12 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter)
}
BOOL success = FALSE;
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
// don't provide default file selection
mFilesW[0] = '\0';
@@ -304,6 +331,12 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename)
}
BOOL success = FALSE;
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
mOFN.lpstrFile = mFilesW;
if (!filename.empty())
{
@@ -370,9 +403,9 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename)
{
wcsncpy( mFilesW,L"untitled.jpeg", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
}
- mOFN.lpstrDefExt = L"jpeg";
+ mOFN.lpstrDefExt = L"jpg";
mOFN.lpstrFilter =
- L"JPEG Images (*.jpeg)\0*.jpeg\0" \
+ L"JPEG Images (*.jpg *.jpeg)\0*.jpg;*.jpeg\0" \
L"\0";
break;
case FFSAVE_AVI:
@@ -581,6 +614,12 @@ OSStatus LLFilePicker::doNavChooseDialog(ELoadFilter filter)
NavDialogRef navRef = NULL;
NavReplyRecord navReply;
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
memset(&navReply, 0, sizeof(navReply));
// NOTE: we are passing the address of a local variable here.
@@ -809,6 +848,12 @@ BOOL LLFilePicker::getOpenFile(ELoadFilter filter)
BOOL success = FALSE;
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
OSStatus error = noErr;
reset();
@@ -845,6 +890,12 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter)
BOOL success = FALSE;
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
OSStatus error = noErr;
reset();
@@ -876,6 +927,12 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename)
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;
+ }
+
reset();
mNavOptions.optionFlags &= ~kNavAllowMultipleFiles;
@@ -1100,6 +1157,12 @@ BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename
{
BOOL rtn = FALSE;
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
gViewerWindow->mWindow->beforeDialog();
reset();
@@ -1189,6 +1252,12 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter )
{
BOOL rtn = FALSE;
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
gViewerWindow->mWindow->beforeDialog();
reset();
@@ -1233,6 +1302,12 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter )
{
BOOL rtn = FALSE;
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
gViewerWindow->mWindow->beforeDialog();
reset();
@@ -1263,6 +1338,13 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter )
BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename )
{
+ // if local file browsing is turned off, return without opening dialog
+ // (Even though this is a stub, I think we still should not return anything at all)
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
reset();
llinfos << "getSaveFile suggested filename is [" << filename
@@ -1277,6 +1359,13 @@ BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename
BOOL LLFilePicker::getOpenFile( ELoadFilter filter )
{
+ // if local file browsing is turned off, return without opening dialog
+ // (Even though this is a stub, I think we still should not return anything at all)
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
reset();
// HACK: Static filenames for 'open' until we implement filepicker
@@ -1295,6 +1384,13 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter )
BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter )
{
+ // if local file browsing is turned off, return without opening dialog
+ // (Even though this is a stub, I think we still should not return anything at all)
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
reset();
return FALSE;
}