linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #02528
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2298: Keep search history in file list windows
------------------------------------------------------------
revno: 2298
committer: eMTee <emtee11@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Sun 2010-11-21 16:59:18 +0100
message:
Keep search history in file list windows
modified:
changelog.txt
help/settings_history.html
win32/DirectoryListingFrame.cpp
win32/DirectoryListingFrame.h
win32/ParamDlg.cpp
win32/ParamDlg.h
win32/WinUtil.cpp
win32/WinUtil.h
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt 2010-11-19 15:11:20 +0000
+++ changelog.txt 2010-11-21 15:59:18 +0000
@@ -33,6 +33,7 @@
* Add a menu to change the group of a fav hub more easily (poy)
* [ADC] Support hidden users as per the ADC ext spec (poy)
* [ADC] Group search extensions with the "GR" param (poy)
+* Keep search history in file list windows (emtee)
-- 0.770 2010-07-05 --
* [L#550300] Catch more potential file corruptions (thanks bigmuscle)
=== modified file 'help/settings_history.html'
--- help/settings_history.html 2009-11-18 14:36:17 +0000
+++ help/settings_history.html 2010-11-21 15:59:18 +0000
@@ -54,8 +54,8 @@
<h2 id="searchhistory">Search history</h2>
<p cshelp="IDH_SETTINGS_HISTORY_SEARCH_HISTORY">
- The number of old search lines that will be shown in the drop-down control of the
- <placeholder><a href="window_search.html">Search</a></placeholder> window. (default: 10)
+ The number of old search lines that will be shown in the Search drop-down controls of the
+ <placeholder><a href="window_search.html">Search</a></placeholder> and <placeholder><a href="window_file_list.html">File List</a></placeholder> windows. (default: 10)
</p>
</body>
</html>
=== modified file 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp 2010-07-10 14:36:48 +0000
+++ win32/DirectoryListingFrame.cpp 2010-11-21 15:59:18 +0000
@@ -49,6 +49,8 @@
DirectoryListingFrame::UserMap DirectoryListingFrame::lists;
+TStringList DirectoryListingFrame::lastSearches;
+
int DirectoryListingFrame::ItemInfo::getImage() const {
if(type == DIRECTORY || type == USER) {
return dir->getComplete() ? WinUtil::getDirIconIndex() : WinUtil::getDirMaskedIndex();
@@ -891,12 +893,20 @@
{
if(!findNext) {
// Prompt for substring to find
- ParamDlg dlg(this, T_("Search for file"), T_("Enter search string"));
+ ParamDlg dlg(this, T_("Search for file"), T_("Enter search string"), lastSearches, 0, true /*comboBoxEdit*/);
if(dlg.run() != IDOK)
return;
- findStr = Text::fromT(dlg.getValue());
+ const tstring& value = dlg.getValue();
+ if(!value.empty() && std::find(lastSearches.begin(), lastSearches.end(), value) == lastSearches.end()) {
+ size_t i = max(SETTING(SEARCH_HISTORY) - 1, 0);
+ while(lastSearches.size() > i) {
+ lastSearches.erase(lastSearches.end() - 1);
+ }
+ lastSearches.insert(lastSearches.begin(), value);
+ }
+ findStr = Text::fromT(value);
skipHits = 0;
} else {
skipHits++;
=== modified file 'win32/DirectoryListingFrame.h'
--- win32/DirectoryListingFrame.h 2010-07-10 14:36:48 +0000
+++ win32/DirectoryListingFrame.h 2010-11-21 15:59:18 +0000
@@ -182,6 +182,8 @@
bool updating;
bool searching;
+ static TStringList lastSearches;
+
StringMap ucLineParams;
typedef unordered_map<UserPtr, DirectoryListingFrame*, User::Hash> UserMap;
=== modified file 'win32/ParamDlg.cpp'
--- win32/ParamDlg.cpp 2010-07-10 14:36:48 +0000
+++ win32/ParamDlg.cpp 2010-11-21 15:59:18 +0000
@@ -39,12 +39,12 @@
addTextBox(name, value, password);
}
-ParamDlg::ParamDlg(dwt::Widget* parent, const tstring& title, const tstring& name, const TStringList& choices, size_t sel) :
+ParamDlg::ParamDlg(dwt::Widget* parent, const tstring& title, const tstring& name, const TStringList& choices, size_t sel, bool edit) :
GridDialog(parent, width),
left(0)
{
onInitDialog(std::bind(&ParamDlg::initDialog, this, title));
- addComboBox(name, choices, sel);
+ addComboBox(name, choices, sel, edit);
}
void ParamDlg::addTextBox(const tstring& name, const tstring& value, bool password) {
@@ -55,8 +55,8 @@
initFs.push_back(std::bind(&ParamDlg::initIntTextBox, this, name, value, min, max));
}
-void ParamDlg::addComboBox(const tstring& name, const TStringList& choices, size_t sel) {
- initFs.push_back(std::bind(&ParamDlg::initComboBox, this, name, choices, sel));
+void ParamDlg::addComboBox(const tstring& name, const TStringList& choices, size_t sel, bool edit) {
+ initFs.push_back(std::bind(&ParamDlg::initComboBox, this, name, choices, sel, edit));
}
void ParamDlg::initTextBox(const tstring& name, const tstring& value, bool password) {
@@ -80,8 +80,8 @@
valueFs.push_back(std::bind((tstring (TextBox::*)() const)(&TextBox::getText), box));
}
-void ParamDlg::initComboBox(const tstring& name, const TStringList& choices, size_t sel) {
- ComboBoxPtr box = left->addChild(GroupBox::Seed(name))->addChild(WinUtil::Seeds::Dialog::comboBox);
+void ParamDlg::initComboBox(const tstring& name, const TStringList& choices, size_t sel, bool edit) {
+ ComboBoxPtr box = left->addChild(GroupBox::Seed(name))->addChild(edit ? WinUtil::Seeds::Dialog::comboBoxEdit : WinUtil::Seeds::Dialog::comboBox);
for(TStringList::const_iterator i = choices.begin(), iend = choices.end(); i != iend; ++i)
box->addValue(*i);
box->setSelected(sel);
=== modified file 'win32/ParamDlg.h'
--- win32/ParamDlg.h 2010-07-10 14:36:48 +0000
+++ win32/ParamDlg.h 2010-11-21 15:59:18 +0000
@@ -32,11 +32,11 @@
/// shorthand constructor that adds a text box
ParamDlg(dwt::Widget* parent, const tstring& title, const tstring& name, const tstring& value = Util::emptyStringT, bool password = false);
/// shorthand constructor that adds a combo box
- ParamDlg(dwt::Widget* parent, const tstring& title, const tstring& name, const TStringList& choices, size_t sel = 0);
+ ParamDlg(dwt::Widget* parent, const tstring& title, const tstring& name, const TStringList& choices, size_t sel = 0, bool edit = false);
void addTextBox(const tstring& name, const tstring& value = Util::emptyStringT, bool password = false);
void addIntTextBox(const tstring& name, const tstring& value, const int min = UD_MINVAL, const int max = UD_MAXVAL);
- void addComboBox(const tstring& name, const TStringList& choices, size_t sel = 0);
+ void addComboBox(const tstring& name, const TStringList& choices, size_t sel = 0, bool edit = false);
const TStringList& getValues() const { return values; }
const tstring& getValue() const { return values[0]; }
@@ -52,7 +52,7 @@
void initTextBox(const tstring& name, const tstring& value, bool password);
void initIntTextBox(const tstring& name, const tstring& value, const int min, const int max);
- void initComboBox(const tstring& name, const TStringList& choices, size_t sel);
+ void initComboBox(const tstring& name, const TStringList& choices, size_t sel, bool edit);
bool initDialog(const tstring& title);
void okClicked();
=== modified file 'win32/WinUtil.cpp'
--- win32/WinUtil.cpp 2010-10-29 16:31:08 +0000
+++ win32/WinUtil.cpp 2010-11-21 15:59:18 +0000
@@ -88,6 +88,7 @@
const Tree::Seed WinUtil::Seeds::treeView;
const ComboBox::Seed WinUtil::Seeds::Dialog::comboBox;
+const ComboBox::Seed WinUtil::Seeds::Dialog::comboBoxEdit;
const TextBox::Seed WinUtil::Seeds::Dialog::textBox;
const TextBox::Seed WinUtil::Seeds::Dialog::intTextBox;
const RichTextBox::Seed WinUtil::Seeds::Dialog::richTextBox;
=== modified file 'win32/WinUtil.h'
--- win32/WinUtil.h 2010-10-24 18:06:17 +0000
+++ win32/WinUtil.h 2010-11-21 15:59:18 +0000
@@ -85,6 +85,7 @@
struct Dialog {
static const ComboBox::Seed comboBox;
+ static const ComboBox::Seed comboBoxEdit;
static const TextBox::Seed textBox;
static const TextBox::Seed intTextBox;
static const RichTextBox::Seed richTextBox;