linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05036
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2750: double-clicking file lists in the system log opens them in the prog; fix file list activation upo...
------------------------------------------------------------
revno: 2750
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sun 2011-12-25 19:48:06 +0100
message:
double-clicking file lists in the system log opens them in the prog; fix file list activation upon user actions
modified:
win32/DirectoryListingFrame.cpp
win32/FinishedFrameBase.h
win32/MainWindow.cpp
win32/SystemFrame.cpp
win32/SystemFrame.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 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp 2011-12-22 22:14:45 +0000
+++ win32/DirectoryListingFrame.cpp 2011-12-25 18:48:06 +0000
@@ -106,7 +106,8 @@
if(prev == lists.end()) {
openWindow_(parent, aFile, aDir, aUser, aSpeed, activate);
} else {
- activate = prev->second->isActive() ? FORCE_ACTIVE : FOLLOW_SETTING;
+ if(activate != FORCE_ACTIVE && prev->second->isActive())
+ activate = FORCE_ACTIVE;
prev->second->close();
parent->callAsync([=] { openWindow_(parent, aFile, aDir, aUser, aSpeed, activate); });
}
=== modified file 'win32/FinishedFrameBase.h'
--- win32/FinishedFrameBase.h 2011-12-22 22:14:45 +0000
+++ win32/FinishedFrameBase.h 2011-12-25 18:48:06 +0000
@@ -287,7 +287,7 @@
void open(TabViewPtr parent, const string& ownList) {
// see if we are opening our own file list.
if(in_UL && file == ownList) {
- DirectoryListingFrame::openOwnList(parent);
+ DirectoryListingFrame::openOwnList(parent, Util::emptyStringT, DirectoryListingFrame::FORCE_ACTIVE);
return;
}
@@ -297,7 +297,8 @@
const auto& users = entry->getUsers();
auto hu = find(users.cbegin(), users.cend(), u);
if(hu != users.cend()) {
- DirectoryListingFrame::openWindow(parent, Text::toT(file), Util::emptyStringT, *hu, entry->getAverageSpeed());
+ DirectoryListingFrame::openWindow(parent, Text::toT(file), Util::emptyStringT,
+ *hu, entry->getAverageSpeed(), DirectoryListingFrame::FORCE_ACTIVE);
return;
}
}
=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp 2011-12-25 16:47:44 +0000
+++ win32/MainWindow.cpp 2011-12-25 18:48:06 +0000
@@ -1172,9 +1172,10 @@
void MainWindow::handleOpenFileList() {
tstring file;
if(WinUtil::browseFileList(this, file)) {
- UserPtr u = DirectoryListing::getUserFromFilename(Text::fromT(file));
- if (u) {
- DirectoryListingFrame::openWindow(getTabView(), file, Util::emptyStringT, HintedUser(u, Util::emptyString), 0);
+ auto u = DirectoryListing::getUserFromFilename(Text::fromT(file));
+ if(u) {
+ DirectoryListingFrame::openWindow(getTabView(), file, Util::emptyStringT,
+ HintedUser(u, Util::emptyString), 0, DirectoryListingFrame::FORCE_ACTIVE);
} else {
dwt::MessageBox(this).show(T_("Invalid file list name"), _T(APPNAME) _T(" ") _T(VERSIONSTRING),
dwt::MessageBox::BOX_OK, dwt::MessageBox::BOX_ICONEXCLAMATION);
=== modified file 'win32/SystemFrame.cpp'
--- win32/SystemFrame.cpp 2011-12-22 22:14:45 +0000
+++ win32/SystemFrame.cpp 2011-12-25 18:48:06 +0000
@@ -20,9 +20,12 @@
#include "SystemFrame.h"
+#include <dcpp/DirectoryListing.h>
#include <dcpp/File.h>
#include <dcpp/LogManager.h>
+#include <dcpp/ShareManager.h>
+#include "DirectoryListingFrame.h"
#include "HoldRedraw.h"
#include "ShellMenu.h"
#include "WinUtil.h"
@@ -46,8 +49,9 @@
initStatus();
- auto path = Text::toT(Util::validateFileName(LogManager::getInstance()->getPath(LogManager::SYSTEM)));
- status->onDblClicked(STATUS_STATUS, [path] { WinUtil::openFile(path); });
+ status->onDblClicked(STATUS_STATUS, [] {
+ WinUtil::openFile(Text::toT(Util::validateFileName(LogManager::getInstance()->getPath(LogManager::SYSTEM))));
+ });
layout();
@@ -82,6 +86,24 @@
setDirty(SettingsManager::BOLD_SYSTEM_LOG);
}
+void SystemFrame::openFile(const string& path) const {
+ // see if we are opening our own file list.
+ if(path == ShareManager::getInstance()->getBZXmlFile()) {
+ DirectoryListingFrame::openOwnList(getParent(), Util::emptyStringT, DirectoryListingFrame::FORCE_ACTIVE);
+ return;
+ }
+
+ // see if we are opening a file list.
+ auto u = DirectoryListing::getUserFromFilename(path);
+ if(u) {
+ DirectoryListingFrame::openWindow(getParent(), Text::toT(path), Util::emptyStringT,
+ HintedUser(u, Util::emptyString), 0, DirectoryListingFrame::FORCE_ACTIVE);
+ return;
+ }
+
+ WinUtil::openFile(Text::toT(path));
+}
+
void SystemFrame::layout() {
dwt::Rectangle r(this->getClientSize());
@@ -101,8 +123,8 @@
if(File::getSize(path_a) != -1) {
ShellMenuPtr menu = addChild(ShellMenu::Seed());
menu->setTitle(escapeMenu(path), WinUtil::fileImages->getIcon(WinUtil::getFileIcon(path_a)));
- menu->appendItem(T_("&Open"), [path] { WinUtil::openFile(path); }, dwt::IconPtr(), true, true);
- menu->appendItem(T_("Open &folder"), [path] { WinUtil::openFolder(path); });
+ menu->appendItem(T_("&Open"), [this, &path_a] { openFile(path_a); }, dwt::IconPtr(), true, true);
+ menu->appendItem(T_("Open &folder"), [&path] { WinUtil::openFolder(path); });
menu->appendShellMenu(StringList(1, path_a));
menu->open(pt);
return true;
@@ -111,9 +133,9 @@
}
bool SystemFrame::handleDoubleClick(const dwt::MouseEvent& mouseEvent) {
- tstring path = log->textUnderCursor(mouseEvent.pos, true);
- if(File::getSize(Text::fromT(path)) != -1) {
- WinUtil::openFile(path);
+ string path = Text::fromT(log->textUnderCursor(mouseEvent.pos, true));
+ if(File::getSize(path) != -1) {
+ openFile(path);
return true;
}
return false;
=== modified file 'win32/SystemFrame.h'
--- win32/SystemFrame.h 2011-05-04 19:32:00 +0000
+++ win32/SystemFrame.h 2011-12-25 18:48:06 +0000
@@ -49,6 +49,7 @@
bool preClosing();
void addLine(time_t t, const tstring& msg);
+ void openFile(const string& path) const;
bool handleContextMenu(const dwt::ScreenCoordinate& pt);
bool handleDoubleClick(const dwt::MouseEvent& mouseEvent);