1
0

Launch explorer

This commit is contained in:
Scott E. Graves
2017-04-25 18:02:58 -05:00
parent 765f974d7a
commit 6a17c04ba8
6 changed files with 22 additions and 1 deletions

View File

@@ -180,6 +180,8 @@
<input type="checkbox" id="ID_SettingsLockWalletOnExit"><br><br>
<h2>Auto-start on Logon</h2>
<input type="checkbox" id="ID_SettingsAutoStart"><br><br>
<h2>Launch file manager on mount</h2>
<input type="checkbox" id="ID_SettingsLaunchFileManager"><br><br>
<h2>Use Bundled siad</h2>
<input type="checkbox" id="ID_SettingsLaunchServer"><br><br>
<h2>API Port</h2>

View File

@@ -172,6 +172,11 @@
if (document.getElementById('sia_settings_window').classList.contains('hidden-element')) {
setValue('ID_SettingsRPCPort', port);
}
},
setLaunchFileManager: (launch) => {
if (document.getElementById('sia_settings_window').classList.contains('hidden-element')) {
setChecked('ID_SettingsLaunchFileManager', launch);
}
}
};
})();
@@ -336,7 +341,8 @@
'UseBundledSiad': getChecked('ID_SettingsLaunchServer'),
'ApiPort': getValue('ID_SettingsApiPort'),
'HostPort': getValue('ID_SettingsHostPort'),
'RpcPort': getValue('ID_SettingsRPCPort')
'RpcPort': getValue('ID_SettingsRPCPort'),
'LaunchFileManager': getChecked('ID_SettingsLaunchFileManager')
}, (success, reason) => {
if (success) {
beginMainApplication();

View File

@@ -26,6 +26,7 @@ public:
JProperty(bool, LockWalletOnExit, public, public, _configDocument)
JProperty(bool, AutoStartOnLogon, public, public, _configDocument)
JProperty(bool, LaunchBundledSiad, public, public, _configDocument)
JProperty(bool, LaunchFileMgrOnMount, public, public, _configDocument)
JProperty(std::string, EventLevel, public, public, _configDocument)
private:

View File

@@ -212,6 +212,7 @@ public:
{
CefRefPtr<CefV8Value> settings = arguments[0];
CefRefPtr<CefV8Value> cb = arguments[1];
_siaDriveConfig->SetLaunchFileMgrOnMount(settings->GetValue("LaunchFileManager")->GetBoolValue());
_siaDriveConfig->SetAutoStartOnLogon(settings->GetValue("AutoStartOnLogon")->GetBoolValue());
_siaDriveConfig->SetLaunchBundledSiad(settings->GetValue("UseBundledSiad")->GetBoolValue());
_siaDriveConfig->SetLockWalletOnExit(settings->GetValue("UnlockOnExit")->GetBoolValue());
@@ -443,6 +444,7 @@ void CSiaDriveApp::SiaApiRefreshCallback(CefRefPtr<CefV8Context> context, const
uiState->SetValue("allocatedRenterFunds", CefV8Value::CreateString(_siaApi->GetRenter()->GetFunds().ToString()), V8_PROPERTY_ATTRIBUTE_NONE);
ExecuteSetter(context, uiActions, "setAutoStartOnLogon", CefV8Value::CreateBool(_siaDriveConfig->GetAutoStartOnLogon()));
ExecuteSetter(context, uiActions, "setLaunchBundledSiad", CefV8Value::CreateBool(_siaDriveConfig->GetLaunchBundledSiad()));
ExecuteSetter(context, uiActions, "setLaunchFileManager", CefV8Value::CreateBool(_siaDriveConfig->GetLaunchFileMgrOnMount()));
ExecuteSetter(context, uiActions, "setApiPort", CefV8Value::CreateUInt(_siaDriveConfig->GetApiPort()));
ExecuteSetter(context, uiActions, "setHostPort", CefV8Value::CreateUInt(_siaDriveConfig->GetHostPort()));
ExecuteSetter(context, uiActions, "setRpcPort", CefV8Value::CreateUInt(_siaDriveConfig->GetRpcPort()));

View File

@@ -114,6 +114,11 @@ bool CSiaDriveConfig::LoadDefaults()
changed = true;
}
if (!CheckLaunchFileMgrOnMount())
{
SetLaunchFileMgrOnMount(true);
changed = true;
}
return changed;
}

View File

@@ -3,6 +3,7 @@
#include <uploadmanager.h>
#include <dokan.h>
#include <filepath.h>
#include <siadriveconfig.h>
using namespace Sia::Api;
using namespace Sia::Api::Dokan;
@@ -1949,6 +1950,10 @@ private:
static NTSTATUS DOKAN_CALLBACK Sia_Mounted(PDOKAN_FILE_INFO dokanFileInfo)
{
CEventSystem::EventSystem.NotifyEvent(CreateSystemEvent(DriveMounted(_mountPoint)));
if (_siaDriveConfig->GetLaunchFileMgrOnMount())
{
::ShellExecute(nullptr, L"open", &_mountPoint[0], nullptr, nullptr, SW_SHOWDEFAULT);
}
return STATUS_SUCCESS;
}