Index: src/interface/settings/optionspage_transfer.h
===================================================================
--- src/interface/settings/optionspage_transfer.h (revision 3532)
+++ src/interface/settings/optionspage_transfer.h (working copy)
@@ -8,6 +8,10 @@
virtual bool LoadPage();
virtual bool SavePage();
virtual bool Validate();
+
+protected:
+ DECLARE_EVENT_TABLE()
+ void OnBrowseDefaultDownloadDirectory(wxCommandEvent& event);
};
#endif //__OPTIONSPAGE_TRANSFER_H__
Index: src/interface/settings/optionspage_transfer.cpp
===================================================================
--- src/interface/settings/optionspage_transfer.cpp (revision 3532)
+++ src/interface/settings/optionspage_transfer.cpp (working copy)
@@ -4,6 +4,11 @@
#include "optionspage.h"
#include "optionspage_transfer.h"
+BEGIN_EVENT_TABLE(COptionsPageTransfer, COptionsPage)
+EVT_BUTTON(XRCID("ID_BROWSEDEFDIR"), COptionsPageTransfer::OnBrowseDefaultDownloadDirectory)
+END_EVENT_TABLE()
+
+
bool COptionsPageTransfer::LoadPage()
{
bool failure = false;
@@ -40,6 +45,10 @@
#endif
XRCCTRL(*this, "ID_REPLACED", wxStaticText)->SetLabel(filtered);
+ SetCheckFromOption(XRCID("ID_ENABLE_DEFDOWNLOADDIR"), OPTION_ENABLE_DEFAULT_DOWNLOAD_DIRECTORY, failure);
+
+ SetTextFromOption(XRCID("ID_DEFAULTDIR"), OPTION_DEFAULT_DOWNLOAD_DIRECTORY, failure);
+
return !failure;
}
@@ -53,6 +62,9 @@
m_pOptions->SetOption(OPTION_SPEEDLIMIT_BURSTTOLERANCE, GetChoice(XRCID("ID_BURSTTOLERANCE")));
SetOptionFromText(XRCID("ID_REPLACE"), OPTION_INVALID_CHAR_REPLACE);
SetOptionFromCheck(XRCID("ID_ENABLE_REPLACE"), OPTION_INVALID_CHAR_REPLACE_ENABLE);
+
+ SetOptionFromCheck(XRCID("ID_ENABLE_DEFDOWNLOADDIR"), OPTION_ENABLE_DEFAULT_DOWNLOAD_DIRECTORY);
+ SetOptionFromText(XRCID("ID_DEFAULTDIR"), OPTION_DEFAULT_DOWNLOAD_DIRECTORY);
return true;
}
@@ -103,3 +115,25 @@
return true;
}
+
+void COptionsPageTransfer::OnBrowseDefaultDownloadDirectory(wxCommandEvent& event)
+{
+ // Get control handler
+ wxTextCtrl* pTextCtrl = XRCCTRL(*this, "ID_DEFAULTDIR", wxTextCtrl);
+
+ // Select a folder for default download directory
+ const wxString& curDir = pTextCtrl->GetValue();
+
+ // Open DirSelector
+ const wxString& dir = ::wxDirSelector(_("Default Download Directory"), curDir);
+
+ // Pressed OK
+ if (!dir.empty())
+ {
+ // Update setting
+ wxTextCtrl* pTextCtrl = XRCCTRL(*this, "ID_DEFAULTDIR", wxTextCtrl);
+
+ pTextCtrl->ChangeValue(dir);
+ }
+}
+
Index: src/interface/Mainfrm.cpp
===================================================================
--- src/interface/Mainfrm.cpp (revision 3532)
+++ src/interface/Mainfrm.cpp (working copy)
@@ -3393,6 +3393,29 @@
}
context_controls.pLocalViewHeader = new CLocalViewHeader(context_controls.pLocalSplitter, pState);
+
+ // Check if "Default Download Directory" is enabled
+ if (COptions::Get()->GetOptionVal(OPTION_ENABLE_DEFAULT_DOWNLOAD_DIRECTORY))
+ {
+ wxString error;
+
+ // Fetch setting
+ const wxString& defaultDownloadDirectory = COptions::Get()->GetOption(OPTION_DEFAULT_DOWNLOAD_DIRECTORY);
+
+ // Set Local Dir
+ if ((defaultDownloadDirectory != _T("")) && (!pState->SetLocalDir(defaultDownloadDirectory, &error)))
+ {
+ if (error != _T(""))
+ {
+ wxMessageBox(error, _("Failed to change default download directory"), wxICON_INFORMATION);
+ }
+ else
+ {
+ wxBell();
+ }
+ }
+ }
+
if (COptions::Get()->GetOptionVal(OPTION_SHOW_TREE_LOCAL))
{
context_controls.pLocalTreeViewPanel->SetHeader(context_controls.pLocalViewHeader);
Index: src/interface/Options.h
===================================================================
--- src/interface/Options.h (revision 3532)
+++ src/interface/Options.h (working copy)
@@ -79,6 +79,8 @@
OPTION_INVALID_CHAR_REPLACE_ENABLE,
OPTION_INVALID_CHAR_REPLACE,
OPTION_ALREADYCONNECTED_CHOICE,
+ OPTION_ENABLE_DEFAULT_DOWNLOAD_DIRECTORY,
+ OPTION_DEFAULT_DOWNLOAD_DIRECTORY,
// Has to be last element
OPTIONS_NUM
Index: src/interface/resources/settings.xrc
===================================================================
--- src/interface/resources/settings.xrc (revision 3532)
+++ src/interface/resources/settings.xrc (working copy)
@@ -971,6 +971,61 @@
wxGROW
+
@@ -2159,4 +2214,4 @@
-
\ No newline at end of file
+
Index: src/interface/Options.cpp
===================================================================
--- src/interface/Options.cpp (revision 3532)
+++ src/interface/Options.cpp (working copy)
@@ -147,7 +147,9 @@
{ "Filteredit window size", string, _T(""), false },
{ "Enable invalid char filter", number, _T("1"), false },
{ "Invalid char replace", string, _T("_"), false },
- { "Already connected choice", number, _T("0"), false }
+ { "Already connected choice", number, _T("0"), false },
+ { "Use default download dir", number, _T("0"), false },
+ { "Default Download Directory", string, _T(""), false }
};
struct t_default_option