linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #07611
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3364: Open own list when using get/browse file list on self
------------------------------------------------------------
revno: 3364
committer: Fredrik Ullner <ullner@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Wed 2013-11-13 22:45:15 +0100
message:
Open own list when using get/browse file list on self
modified:
changelog.txt
dcpp/Exception.h
dcpp/QueueManager.cpp
dcpp/QueueManager.h
win32/HubFrame.cpp
win32/PrivateFrame.cpp
win32/UserInfoBase.cpp
win32/UserInfoBase.h
win32/UsersFrame.cpp
--
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-11 16:54:49 +0000
+++ changelog.txt 2013-11-13 21:45:15 +0000
@@ -1,4 +1,5 @@
* [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)
-- 0.831 2013-11-11 --
* [L#1249810] Fix NMDC TTH search responses (emtee)
=== modified file 'dcpp/Exception.h'
--- dcpp/Exception.h 2013-01-18 21:28:38 +0000
+++ dcpp/Exception.h 2013-11-13 21:45:15 +0000
@@ -50,6 +50,13 @@
virtual ~name() throw() { } \
}
+#define EXTEND_EXCEPTION(name, parent) class name : public parent { \
+public:\
+ name() : parent(#name) { } \
+ name(const string& aError) : parent(#name ": " + aError) { } \
+ virtual ~name() throw() { } \
+}
+
#else // _DEBUG
#define STANDARD_EXCEPTION(name) class name : public Exception { \
@@ -58,6 +65,14 @@
name(const string& aError) : Exception(aError) { } \
virtual ~name() throw() { } \
}
+
+#define EXTEND_EXCEPTION(name, parent) class name : public parent { \
+public:\
+ name() : parent() { } \
+ name(const string& aError) : parent(aError) { } \
+ virtual ~name() throw() { } \
+}
+
#endif
} // namespace dcpp
=== modified file 'dcpp/QueueManager.cpp'
--- dcpp/QueueManager.cpp 2013-09-15 16:39:42 +0000
+++ dcpp/QueueManager.cpp 2013-11-13 21:45:15 +0000
@@ -529,7 +529,7 @@
// Check that we're not downloading from ourselves...
if(aUser == ClientManager::getInstance()->getMe()) {
- throw QueueException(_("You're trying to download from yourself!"));
+ throw QueueSelfException(_("You're trying to download from yourself!"));
}
// Check if we're not downloading something already in our share
=== modified file 'dcpp/QueueManager.h'
--- dcpp/QueueManager.h 2013-02-14 16:25:20 +0000
+++ dcpp/QueueManager.h 2013-11-13 21:45:15 +0000
@@ -48,6 +48,7 @@
using std::unordered_map;
STANDARD_EXCEPTION(QueueException);
+EXTEND_EXCEPTION(QueueSelfException, QueueException);
class UserConnection;
=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp 2013-09-15 18:28:03 +0000
+++ win32/HubFrame.cpp 2013-11-13 21:45:15 +0000
@@ -260,7 +260,7 @@
status->setHelpId(STATUS_SHARED, IDH_HUB_SHARED);
status->setHelpId(STATUS_AVERAGE_SHARED, IDH_HUB_AVERAGE_SHARED);
- addAccel(FALT, 'G', [this] { handleGetList(); });
+ addAccel(FALT, 'G', [this] { handleGetList(getParent()); });
addAccel(FCONTROL, 'R', [this] { reconnect(); });
addAccel(FALT, 'P', [this] { handlePrivateMessage(getParent()); });
addAccel(FALT, 'U', [this] { users->setFocus(); });
@@ -487,7 +487,7 @@
if(!param.empty()) {
auto ui = findUser(param);
if(ui) {
- ui->getList();
+ ui->getList(getParent());
}
}
} else if(Util::stricmp(cmd.c_str(), _T("ignore")) == 0) {
@@ -840,7 +840,7 @@
bool HubFrame::handleUsersKeyDown(int c) {
if(c == VK_RETURN && users->hasSelected()) {
- handleGetList();
+ handleGetList(getParent());
return true;
}
return false;
@@ -1323,7 +1323,7 @@
void HubFrame::handleDoubleClickUsers() {
if(users->hasSelected()) {
- users->getSelectedData()->getList();
+ users->getSelectedData()->getList(getParent());
}
}
=== modified file 'win32/PrivateFrame.cpp'
--- win32/PrivateFrame.cpp 2013-09-15 16:39:42 +0000
+++ win32/PrivateFrame.cpp 2013-11-13 21:45:15 +0000
@@ -372,7 +372,7 @@
handleAddFavorite();
addStatus(T_("Favorite user added"));
} else if(Util::stricmp(cmd.c_str(), _T("getlist")) == 0) {
- handleGetList();
+ handleGetList(getParent());
} else if(Util::stricmp(cmd.c_str(), _T("ignore")) == 0) {
handleIgnoreChat(true);
} else if(Util::stricmp(cmd.c_str(), _T("unignore")) == 0) {
=== modified file 'win32/UserInfoBase.cpp'
--- win32/UserInfoBase.cpp 2013-04-12 21:10:13 +0000
+++ win32/UserInfoBase.cpp 2013-11-13 21:45:15 +0000
@@ -32,6 +32,7 @@
#include "PrivateFrame.h"
#include "HubFrame.h"
+#include "DirectoryListingFrame.h"
void UserInfoBase::matchQueue() {
try {
@@ -40,18 +41,29 @@
LogManager::getInstance()->message(e.getError());
}
}
-void UserInfoBase::getList() {
+void UserInfoBase::getList(TabViewPtr parent) {
try {
QueueManager::getInstance()->addList(user, QueueItem::FLAG_CLIENT_VIEW);
+ } catch(const QueueSelfException& e) {
+ getOwnList(parent);
} catch(const Exception& e) {
LogManager::getInstance()->message(e.getError());
}
}
-void UserInfoBase::browseList() {
+void UserInfoBase::browseList(TabViewPtr parent) {
if(!user.user->getCID())
return;
try {
QueueManager::getInstance()->addList(user, QueueItem::FLAG_CLIENT_VIEW | QueueItem::FLAG_PARTIAL_LIST);
+ } catch(const QueueSelfException& e) {
+ getOwnList(parent);
+ } catch(const Exception& e) {
+ LogManager::getInstance()->message(e.getError());
+ }
+}
+void UserInfoBase::getOwnList(TabViewPtr parent) {
+ try {
+ DirectoryListingFrame::openOwnList(parent);
} catch(const Exception& e) {
LogManager::getInstance()->message(e.getError());
}
=== modified file 'win32/UserInfoBase.h'
--- win32/UserInfoBase.h 2013-03-03 20:15:35 +0000
+++ win32/UserInfoBase.h 2013-11-13 21:45:15 +0000
@@ -38,8 +38,9 @@
UserInfoBase(const HintedUser& u) : user(u) { }
virtual ~UserInfoBase() { }
- virtual void getList();
- virtual void browseList();
+ virtual void getList(TabViewPtr);
+ virtual void browseList(TabViewPtr);
+ virtual void getOwnList(TabViewPtr);
virtual void matchQueue();
virtual void pm(TabViewPtr);
virtual void grant();
@@ -110,11 +111,11 @@
void handleMatchQueue() {
handleUserFunction([](UserInfoBase* u) { u->matchQueue(); });
}
- void handleGetList() {
- handleUserFunction([](UserInfoBase* u) { u->getList(); });
+ void handleGetList(TabViewPtr parent) {
+ handleUserFunction([&](UserInfoBase* u) { u->getList(parent); });
}
- void handleBrowseList() {
- handleUserFunction([](UserInfoBase* u) { u->browseList(); });
+ void handleBrowseList(TabViewPtr parent) {
+ handleUserFunction([&](UserInfoBase* u) { u->browseList(parent); });
}
void handleAddFavorite() {
handleUserFunction([](UserInfoBase* u) { u->addFav(); });
@@ -151,8 +152,8 @@
UserTraits traits;
for_each(users, [&](const UserInfoBase* u) { traits.parse(u); });
- menu->appendItem(T_("&Get file list"), [this] { this->t().handleGetList(); }, dwt::IconPtr(), true, defaultIsGetList);
- menu->appendItem(T_("&Browse file list"), [this] { this->t().handleBrowseList(); });
+ menu->appendItem(T_("&Get file list"), [this, parent] { this->t().handleGetList(parent); }, dwt::IconPtr(), true, defaultIsGetList);
+ menu->appendItem(T_("&Browse file list"), [this, parent] { this->t().handleBrowseList(parent); });
menu->appendItem(T_("&Match queue"), [this] { this->t().handleMatchQueue(); });
if(includeSendPM)
menu->appendItem(T_("&Send private message"), [this, parent] { this->t().handlePrivateMessage(parent); }, dwt::IconPtr(), true, !defaultIsGetList);
=== modified file 'win32/UsersFrame.cpp'
--- win32/UsersFrame.cpp 2013-08-19 20:13:24 +0000
+++ win32/UsersFrame.cpp 2013-11-13 21:45:15 +0000
@@ -140,7 +140,7 @@
WinUtil::setTableSort(users, COLUMN_LAST, SettingsManager::USERSFRAME_SORT, COLUMN_NICK);
// TODO check default (browse vs get)
- users->onDblClicked([this] { handleGetList(); });
+ users->onDblClicked([this] { handleGetList(getParent()); });
users->onKeyDown([this](int c) { return handleKeyDown(c); });
users->onContextMenu([this](dwt::ScreenCoordinate pt) { return handleContextMenu(pt); });
users->setSmallImageList(userIcons);