linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #07612
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3365: Added menu option on hub tab for only searching in that hub
------------------------------------------------------------
revno: 3365
committer: Fredrik Ullner <ullner@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Wed 2013-11-13 22:48:31 +0100
message:
Added menu option on hub tab for only searching in that hub
modified:
changelog.txt
win32/HubFrame.cpp
win32/HubFrame.h
win32/SearchFrame.cpp
win32/SearchFrame.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 2013-11-13 21:45:15 +0000
+++ changelog.txt 2013-11-13 21:48:31 +0000
@@ -1,5 +1,6 @@
* [L#1115765] Added ability to filter out files and directories from the share (ullner)
* [L#1225420] Open own list when using get/browse file list on self (ullner)
+* [L#1250614] Added menu option on hub tab for only searching in that hub (ullner)
-- 0.831 2013-11-11 --
* [L#1249810] Fix NMDC TTH search responses (emtee)
=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp 2013-11-13 21:45:15 +0000
+++ win32/HubFrame.cpp 2013-11-13 21:48:31 +0000
@@ -1292,6 +1292,7 @@
menu->appendItem(T_("&Reconnect\tCtrl+R"), [this] { reconnect(); }, WinUtil::menuIcon(IDI_RECONNECT));
menu->appendItem(T_("Copy &address to clipboard"), [this] { handleCopyHub(); });
+ menu->appendItem(T_("&Search hub"), [this] { handleSearchHub(); }, WinUtil::menuIcon(IDI_SEARCH));
menu->appendItem(T_("&Disconnect"), [this] { disconnect(false); }, WinUtil::menuIcon(IDI_HUB_OFF));
prepareMenu(menu, UserCommand::CONTEXT_HUB, url);
@@ -1321,6 +1322,10 @@
WinUtil::setClipboard(Text::toT(url));
}
+void HubFrame::handleSearchHub() {
+ WinUtil::searchHub(Text::toT(url));
+}
+
void HubFrame::handleDoubleClickUsers() {
if(users->hasSelected()) {
users->getSelectedData()->getList(getParent());
=== modified file 'win32/HubFrame.h'
--- win32/HubFrame.h 2013-09-15 18:28:03 +0000
+++ win32/HubFrame.h 2013-11-13 21:48:31 +0000
@@ -234,6 +234,7 @@
void handleShowUsersClicked();
void handleDoubleClickUsers();
void handleCopyHub();
+ void handleSearchHub();
void handleAddAsFavorite();
void showFilterOpts();
=== modified file 'win32/SearchFrame.cpp'
--- win32/SearchFrame.cpp 2013-04-09 17:20:25 +0000
+++ win32/SearchFrame.cpp 2013-11-13 21:48:31 +0000
@@ -91,8 +91,8 @@
}
}
-void SearchFrame::openWindow(TabViewPtr parent, const tstring& str, SearchManager::TypeModes type) {
- frames.insert(new SearchFrame(parent, str, type));
+void SearchFrame::openWindow(TabViewPtr parent, const tstring& str, SearchManager::TypeModes type, const tstring& url) {
+ frames.insert(new SearchFrame(parent, str, type, url));
}
void SearchFrame::closeAll() {
@@ -100,7 +100,7 @@
i->close(true);
}
-SearchFrame::SearchFrame(TabViewPtr parent, const tstring& initialString, SearchManager::TypeModes initialType_) :
+SearchFrame::SearchFrame(TabViewPtr parent, const tstring& initialString, SearchManager::TypeModes initialType_, const tstring& hubUrl) :
BaseType(parent, T_("Search"), IDH_SEARCH, IDI_SEARCH, false),
paned(0),
options(0),
@@ -294,7 +294,15 @@
if(!client->isConnected())
continue;
- onHubAdded(new HubInfo(client));
+ auto hubInfo = new HubInfo(client);
+
+ bool checkedHub = true;
+ if(!hubUrl.empty())
+ {
+ checkedHub = hubInfo->url == hubUrl;
+ }
+
+ onHubAdded(hubInfo, checkedHub);
}
}
@@ -894,9 +902,9 @@
callAsync([this, sr] { addResult(sr); });
}
-void SearchFrame::onHubAdded(HubInfo* info) {
+void SearchFrame::onHubAdded(HubInfo* info, bool defaultHubState) {
int nItem = hubs->insert(info);
- hubs->setChecked(nItem, (hubs->isChecked(0) ? info->op : true));
+ hubs->setChecked(nItem, (hubs->isChecked(0) ? info->op : defaultHubState));
hubs->setColumnWidth(0, LVSCW_AUTOSIZE);
}
=== modified file 'win32/SearchFrame.h'
--- win32/SearchFrame.h 2013-03-18 18:26:38 +0000
+++ win32/SearchFrame.h 2013-11-13 21:48:31 +0000
@@ -55,7 +55,7 @@
const string& getId() const;
static void openWindow(TabViewPtr parent, const tstring& str = Util::emptyStringT,
- SearchManager::TypeModes type = SearchManager::TYPE_ANY);
+ SearchManager::TypeModes type = SearchManager::TYPE_ANY, const tstring& url = Util::emptyStringT );
static void closeAll();
private:
@@ -204,7 +204,7 @@
std::string token;
- SearchFrame(TabViewPtr parent, const tstring& initialString, SearchManager::TypeModes initialType_);
+ SearchFrame(TabViewPtr parent, const tstring& initialString, SearchManager::TypeModes initialType_, const tstring& url = Util::emptyStringT);
virtual ~SearchFrame();
void handlePurgeClicked();
@@ -260,7 +260,7 @@
virtual void on(ClientUpdated, Client* c) noexcept;
virtual void on(ClientDisconnected, Client* c) noexcept;
- void onHubAdded(HubInfo* info);
+ void onHubAdded(HubInfo* info, bool defaultHubState = true);
void onHubChanged(HubInfo* info);
void onHubRemoved(HubInfo* info);
};
=== modified file 'win32/WinUtil.cpp'
--- win32/WinUtil.cpp 2013-08-19 20:13:24 +0000
+++ win32/WinUtil.cpp 2013-11-13 21:48:31 +0000
@@ -832,6 +832,10 @@
SearchFrame::openWindow(mainWindow->getTabView(), Text::toT(aHash.toBase32()), SearchManager::TYPE_TTH);
}
+void WinUtil::searchHub(const tstring& aUrl) {
+ SearchFrame::openWindow(mainWindow->getTabView(), Util::emptyStringT, SearchManager::TYPE_ANY, aUrl);
+}
+
void WinUtil::addLastDir(const tstring& dir) {
auto i = find(lastDirs.begin(), lastDirs.end(), dir);
if(i != lastDirs.end()) {
=== modified file 'win32/WinUtil.h'
--- win32/WinUtil.h 2013-08-19 20:13:24 +0000
+++ win32/WinUtil.h 2013-11-13 21:48:31 +0000
@@ -280,6 +280,7 @@
static void copyMagnet(const TTHValue& aHash, const tstring& aFile, int64_t size);
static void searchAny(const tstring& aSearch);
static void searchHash(const TTHValue& aHash);
+ static void searchHub(const tstring& aUrl);
static string makeMagnet(const TTHValue& aHash, const string& aFile, int64_t size);
static void addLastDir(const tstring& dir);