linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #02716
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2341: add "Previous" button for DirectoryListing
------------------------------------------------------------
revno: 2341
committer: eMTee <emtee11@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Sat 2010-12-11 19:16:14 +0100
message:
add "Previous" button for DirectoryListing
modified:
changelog.txt
help/window_file_list.html
win32/DirectoryListingFrame.cpp
win32/DirectoryListingFrame.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-12-10 22:16:24 +0000
+++ changelog.txt 2010-12-11 18:16:14 +0000
@@ -33,7 +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 thanks to "SEGA" (poy)
-* Keep search history in file list windows (emtee)
+* Keep search history in file list windows; add "Previous" button for backwards searching (emtee)
* Update OpenSSL to version 1.0.0c (poy)
* [L#378829] Make sure our OpenSSL binaries aren't "optimized for MS-DOS" (poy)
* [L#674545] Add magnet keyword search (thanks flow84)
=== modified file 'help/window_file_list.html'
--- help/window_file_list.html 2009-03-22 17:24:47 +0000
+++ help/window_file_list.html 2010-12-11 18:16:14 +0000
@@ -68,8 +68,10 @@
<dd cshelp="IDH_FILE_LIST_MATCH_QUEUE">Search the list for items you are currently downloading; found items will be automatically added as sources for your current downloads.</dd>
<dt>Find</dt>
<dd cshelp="IDH_FILE_LIST_FIND">Find items based on search strings you can specify.</dd>
+ <dt>Previous</dt>
+ <dd cshelp="IDH_FILE_LIST_PREV">Go backwards for previous items found based on search strings you have specified by pressing the "Find" button.</dd>
<dt>Next</dt>
- <dd cshelp="IDH_FILE_LIST_NEXT">Continue the search for items based on search strings you have specified by pressing the "Find" button.</dd>
+ <dd cshelp="IDH_FILE_LIST_NEXT">Continue searching for more items based on search strings you have specified by pressing the "Find" button.</dd>
</dl>
</body>
</html>
=== modified file 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp 2010-12-01 17:58:05 +0000
+++ win32/DirectoryListingFrame.cpp 2010-12-11 18:16:14 +0000
@@ -172,6 +172,7 @@
dirs(0),
files(0),
paned(0),
+ findPrev(0),
find(0),
findNext(0),
listDiff(0),
@@ -234,12 +235,17 @@
cs.caption = T_("Find");
find = addChild(cs);
find->setHelpId(IDH_FILE_LIST_FIND);
- find->onClicked(std::bind(&DirectoryListingFrame::handleFind, this));
+ find->onClicked(std::bind(&DirectoryListingFrame::handleFind, this, FIND_START));
+
+ cs.caption = T_("Previous");
+ findPrev = addChild(cs);
+ findPrev->setHelpId(IDH_FILE_LIST_PREV);
+ findPrev->onClicked(std::bind(&DirectoryListingFrame::handleFind, this, FIND_PREV));
cs.caption = T_("Next");
findNext = addChild(cs);
findNext->setHelpId(IDH_FILE_LIST_NEXT);
- findNext->onClicked(std::bind(&DirectoryListingFrame::handleFindNext, this));
+ findNext->onClicked(std::bind(&DirectoryListingFrame::handleFind, this, FIND_NEXT));
}
initStatus();
@@ -248,6 +254,7 @@
status->setText(STATUS_FILE_LIST_DIFF, T_("Subtract list"));
status->setText(STATUS_MATCH_QUEUE, T_("Match queue"));
status->setText(STATUS_FIND, T_("Find"));
+ status->setText(STATUS_PREV, T_("Previous"));
status->setText(STATUS_NEXT, T_("Next"));
treeRoot = dirs->insert(NULL, new ItemInfo(true, dl->getRoot()));
@@ -298,6 +305,7 @@
status->mapWidget(STATUS_FILE_LIST_DIFF, listDiff);
status->mapWidget(STATUS_MATCH_QUEUE, matchQueue);
status->mapWidget(STATUS_FIND, find);
+ status->mapWidget(STATUS_PREV, findPrev);
status->mapWidget(STATUS_NEXT, findNext);
paned->setRect(r);
@@ -315,16 +323,9 @@
SettingsManager::getInstance()->set(SettingsManager::DIRECTORYLISTINGFRAME_WIDTHS, WinUtil::toString(files->getColumnWidths()));
}
-void DirectoryListingFrame::handleFind() {
- searching = true;
- findFile(false);
- searching = false;
- updateStatus();
-}
-
-void DirectoryListingFrame::handleFindNext() {
- searching = true;
- findFile(true);
+void DirectoryListingFrame::handleFind(int direction) {
+ searching = true;
+ findFile(direction);
searching = false;
updateStatus();
}
@@ -896,9 +897,15 @@
return 0;
}
-void DirectoryListingFrame::findFile(bool findNext)
+void DirectoryListingFrame::findFile(int direction)
{
- if(!findNext) {
+ if(findStr.empty() && direction != FIND_START) {
+ direction = FIND_START;
+ }
+
+ switch (direction) {
+ case FIND_START:
+ {
// Prompt for substring to find
ParamDlg dlg(this, T_("Search for file"), T_("Enter search string"), lastSearches, 0, true /*comboBoxEdit*/);
@@ -915,8 +922,17 @@
}
findStr = Text::fromT(value);
skipHits = 0;
- } else {
+ break;
+ }
+ case FIND_NEXT:
skipHits++;
+ break;
+ case FIND_PREV:
+ if (skipHits == 0) {
+ dwt::MessageBox(this).show(T_("No matches"), T_("Find previous"));
+ return;
+ }
+ skipHits--;
}
if(findStr.empty())
@@ -974,6 +990,8 @@
dirs->setSelected(NULL);
dirs->setSelected(oldDir);
dwt::MessageBox(this).show(T_("No matches"), T_("Search for file"));
+ if (skipHits > 0)
+ skipHits--;
}
}
=== modified file 'win32/DirectoryListingFrame.h'
--- win32/DirectoryListingFrame.h 2010-12-01 17:58:05 +0000
+++ win32/DirectoryListingFrame.h 2010-12-11 18:16:14 +0000
@@ -58,6 +58,7 @@
STATUS_FILE_LIST_DIFF,
STATUS_MATCH_QUEUE,
STATUS_FIND,
+ STATUS_PREV,
STATUS_NEXT,
STATUS_LAST
};
@@ -87,6 +88,12 @@
COLUMN_LAST
};
+ enum {
+ FIND_START,
+ FIND_NEXT,
+ FIND_PREV
+ };
+
class ItemInfo : public FastAlloc<ItemInfo> {
public:
enum ItemType {
@@ -156,6 +163,7 @@
WidgetFilesPtr files;
WidgetVPanedPtr paned;
+ ButtonPtr findPrev;
ButtonPtr find;
ButtonPtr findNext;
ButtonPtr listDiff;
@@ -209,8 +217,7 @@
void addShellPaths(const ShellMenuPtr& menu, const vector<ItemInfo*>& sel);
void addUserMenu(const MenuPtr& menu);
- void handleFind();
- void handleFindNext();
+ void handleFind(int direction);
void handleListDiff();
void handleMatchQueue();
@@ -253,7 +260,7 @@
void initStatusText();
void updateStatus();
- void findFile(bool findNext);
+ void findFile(int direction);
HTREEITEM findFile(const StringSearch& str, HTREEITEM root, int &foundFile, int &skipHits);
// MDIChildFrame