- removed --filetransfer-src and --filetransfer-des args.
- on Window, temporarily use user desktop directory as drop target.
This commit is contained in:
parent
760e38eeba
commit
340e31298e
|
@ -725,7 +725,12 @@ CClient::onFileRecieveCompleted()
|
||||||
m_fileTransferDes = m_screen->getDropTarget();
|
m_fileTransferDes = m_screen->getDropTarget();
|
||||||
if (!m_fileTransferDes.empty()) {
|
if (!m_fileTransferDes.empty()) {
|
||||||
std::fstream file;
|
std::fstream file;
|
||||||
m_fileTransferDes.append("/").append(m_dragFileList.at(0));
|
#ifdef SYSAPI_WIN32
|
||||||
|
m_fileTransferDes.append("\\");
|
||||||
|
#else
|
||||||
|
m_fileTransferDes.append("/");
|
||||||
|
#endif
|
||||||
|
m_fileTransferDes.append(m_dragFileList.at(0));
|
||||||
file.open(m_fileTransferDes.c_str(), std::ios::out | std::ios::binary);
|
file.open(m_fileTransferDes.c_str(), std::ios::out | std::ios::binary);
|
||||||
if (!file.is_open()) {
|
if (!file.is_open()) {
|
||||||
// TODO: file open failed
|
// TODO: file open failed
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "CArchMiscWindows.h"
|
#include "CArchMiscWindows.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pbt.h>
|
#include <pbt.h>
|
||||||
|
#include <Shlobj.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// add backwards compatible multihead support (and suppress bogus warning).
|
// add backwards compatible multihead support (and suppress bogus warning).
|
||||||
|
@ -140,6 +141,11 @@ CMSWindowsScreen::CMSWindowsScreen(
|
||||||
forceShowCursor();
|
forceShowCursor();
|
||||||
LOG((CLOG_DEBUG "screen shape: %d,%d %dx%d %s", m_x, m_y, m_w, m_h, m_multimon ? "(multi-monitor)" : ""));
|
LOG((CLOG_DEBUG "screen shape: %d,%d %dx%d %s", m_x, m_y, m_w, m_h, m_multimon ? "(multi-monitor)" : ""));
|
||||||
LOG((CLOG_DEBUG "window is 0x%08x", m_window));
|
LOG((CLOG_DEBUG "window is 0x%08x", m_window));
|
||||||
|
|
||||||
|
char desktopPath[MAX_PATH];
|
||||||
|
SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, desktopPath);
|
||||||
|
m_desktopPath = CString(desktopPath);
|
||||||
|
LOG((CLOG_DEBUG "temporarily use desktop directory for drop target: %s", m_desktopPath.c_str()));
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
delete m_keyState;
|
delete m_keyState;
|
||||||
|
@ -1849,3 +1855,9 @@ CMSWindowsScreen::getDraggingFileDir()
|
||||||
|
|
||||||
return m_draggingFileDir;
|
return m_draggingFileDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CString&
|
||||||
|
CMSWindowsScreen::getDropTarget() const
|
||||||
|
{
|
||||||
|
return m_desktopPath;
|
||||||
|
}
|
||||||
|
|
|
@ -117,6 +117,8 @@ public:
|
||||||
virtual bool isPrimary() const;
|
virtual bool isPrimary() const;
|
||||||
virtual void fakeDraggingFiles(CString str);
|
virtual void fakeDraggingFiles(CString str);
|
||||||
virtual CString& getDraggingFileDir();
|
virtual CString& getDraggingFileDir();
|
||||||
|
virtual const CString&
|
||||||
|
getDropTarget() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// IPlatformScreen overrides
|
// IPlatformScreen overrides
|
||||||
|
@ -327,6 +329,8 @@ private:
|
||||||
s_screen;
|
s_screen;
|
||||||
|
|
||||||
IEventQueue* m_events;
|
IEventQueue* m_events;
|
||||||
|
|
||||||
|
CString m_desktopPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1662,7 +1662,7 @@ CServer::onMouseUp(ButtonID id)
|
||||||
if (!m_screen->isOnScreen()) {
|
if (!m_screen->isOnScreen()) {
|
||||||
CString& dir = m_screen->getDraggingFileDir();
|
CString& dir = m_screen->getDraggingFileDir();
|
||||||
if (!dir.empty()) {
|
if (!dir.empty()) {
|
||||||
LOG((CLOG_DEBUG "drop file to client: %s", dir.c_str()));
|
LOG((CLOG_DEBUG "send file to client: %s", dir.c_str()));
|
||||||
sendFileToClient(dir.c_str());
|
sendFileToClient(dir.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1952,10 +1952,16 @@ void
|
||||||
CServer::onFileRecieveCompleted()
|
CServer::onFileRecieveCompleted()
|
||||||
{
|
{
|
||||||
if (isReceivedFileSizeValid()) {
|
if (isReceivedFileSizeValid()) {
|
||||||
|
m_fileTransferDes = m_screen->getDropTarget();
|
||||||
if (!m_fileTransferDes.empty() && m_dragFileList.size() > 0) {
|
if (!m_fileTransferDes.empty() && m_dragFileList.size() > 0) {
|
||||||
std::fstream file;
|
std::fstream file;
|
||||||
CString dropTarget = m_fileTransferDes;
|
CString dropTarget = m_fileTransferDes;
|
||||||
dropTarget.append("/").append(m_dragFileList.at(0));
|
#ifdef SYSAPI_WIN32
|
||||||
|
dropTarget.append("\\");
|
||||||
|
#else
|
||||||
|
dropTarget.append("/");
|
||||||
|
#endif
|
||||||
|
dropTarget.append(m_dragFileList.at(0));
|
||||||
file.open(dropTarget.c_str(), std::ios::out | std::ios::binary);
|
file.open(dropTarget.c_str(), std::ios::out | std::ios::binary);
|
||||||
if (!file.is_open()) {
|
if (!file.is_open()) {
|
||||||
// TODO: file open failed
|
// TODO: file open failed
|
||||||
|
@ -2280,7 +2286,6 @@ CServer::sendFileThread(void* filename)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
char* name = reinterpret_cast<char*>(filename);
|
char* name = reinterpret_cast<char*>(filename);
|
||||||
LOG((CLOG_DEBUG "sendFileChunks: %s", name));
|
|
||||||
CFileChunker::sendFileChunks(name, m_events, this);
|
CFileChunker::sendFileChunks(name, m_events, this);
|
||||||
}
|
}
|
||||||
catch (std::runtime_error error) {
|
catch (std::runtime_error error) {
|
||||||
|
@ -2295,14 +2300,10 @@ void
|
||||||
CServer::dragInfoReceived(UInt32 fileNum, CString content)
|
CServer::dragInfoReceived(UInt32 fileNum, CString content)
|
||||||
{
|
{
|
||||||
CDragInformation::parseDragInfo(m_dragFileList, fileNum, content);
|
CDragInformation::parseDragInfo(m_dragFileList, fileNum, content);
|
||||||
LOG((CLOG_INFO "drag information received"));
|
LOG((CLOG_DEBUG "drag information received"));
|
||||||
LOG((CLOG_INFO "total drag file number: %i", m_dragFileList.size()));
|
LOG((CLOG_DEBUG "total drag file number: %i", m_dragFileList.size()));
|
||||||
|
|
||||||
for(int i = 0; i < m_dragFileList.size(); ++i) {
|
for(int i = 0; i < m_dragFileList.size(); ++i) {
|
||||||
LOG((CLOG_INFO "dragging file %i name: %s", i + 1, m_dragFileList.at(i).c_str()));
|
LOG((CLOG_DEBUG2 "dragging file %i name: %s", i + 1, m_dragFileList.at(i).c_str()));
|
||||||
}
|
|
||||||
|
|
||||||
if (m_dragFileList.size() != 0) {
|
|
||||||
//TODO: fake a dragging operation
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,14 +168,6 @@ CApp::parseArg(const int& argc, const char* const* argv, int& i)
|
||||||
argsBase().m_crypto.setMode("cfb");
|
argsBase().m_crypto.setMode("cfb");
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (isArg(i, argc, argv, NULL, "--filetransfer-src")) {
|
|
||||||
m_fileTransferSrc = argv[++i];
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (isArg(i, argc, argv, NULL, "--filetransfer-des")) {
|
|
||||||
m_fileTransferDes = argv[++i];
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
else {
|
||||||
// option not supported here
|
// option not supported here
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -101,9 +101,6 @@ public:
|
||||||
void setSocketMultiplexer(CSocketMultiplexer* sm) { m_socketMultiplexer = sm; }
|
void setSocketMultiplexer(CSocketMultiplexer* sm) { m_socketMultiplexer = sm; }
|
||||||
CSocketMultiplexer* getSocketMultiplexer() const { return m_socketMultiplexer; }
|
CSocketMultiplexer* getSocketMultiplexer() const { return m_socketMultiplexer; }
|
||||||
|
|
||||||
CString& getFileTransferSrc() { return m_fileTransferSrc; }
|
|
||||||
CString& getFileTransferDes() { return m_fileTransferDes; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleIpcMessage(const CEvent&, void*);
|
void handleIpcMessage(const CEvent&, void*);
|
||||||
|
|
||||||
|
@ -126,8 +123,6 @@ private:
|
||||||
ARCH_APP_UTIL m_appUtil;
|
ARCH_APP_UTIL m_appUtil;
|
||||||
CIpcClient* m_ipcClient;
|
CIpcClient* m_ipcClient;
|
||||||
CSocketMultiplexer* m_socketMultiplexer;
|
CSocketMultiplexer* m_socketMultiplexer;
|
||||||
CString m_fileTransferSrc;
|
|
||||||
CString m_fileTransferDes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BYE "\nTry `%s --help' for more information."
|
#define BYE "\nTry `%s --help' for more information."
|
||||||
|
|
|
@ -468,7 +468,6 @@ CClientApp::startClient()
|
||||||
|
|
||||||
s_client->connect();
|
s_client->connect();
|
||||||
|
|
||||||
s_client->setFileTransferDes(getFileTransferDes());
|
|
||||||
updateStatus();
|
updateStatus();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,7 +375,7 @@ CScreen::isLockedToScreen() const
|
||||||
if (m_screen->isAnyMouseButtonDown(buttonID)) {
|
if (m_screen->isAnyMouseButtonDown(buttonID)) {
|
||||||
LOG((CLOG_DEBUG "locked by mouse buttonID: %d", buttonID));
|
LOG((CLOG_DEBUG "locked by mouse buttonID: %d", buttonID));
|
||||||
if (buttonID == kButtonLeft) {
|
if (buttonID == kButtonLeft) {
|
||||||
// this should fake an esc pressed
|
// TODO: fake esc key down and up
|
||||||
m_screen->fakeMouseButton(buttonID, false);
|
m_screen->fakeMouseButton(buttonID, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -691,7 +691,6 @@ CServer*
|
||||||
CServerApp::openServer(CConfig& config, CPrimaryClient* primaryClient)
|
CServerApp::openServer(CConfig& config, CPrimaryClient* primaryClient)
|
||||||
{
|
{
|
||||||
CServer* server = new CServer(config, primaryClient, s_serverScreen, m_events);
|
CServer* server = new CServer(config, primaryClient, s_serverScreen, m_events);
|
||||||
server->setFileTransferDes(getFileTransferDes());
|
|
||||||
try {
|
try {
|
||||||
m_events->adoptHandler(
|
m_events->adoptHandler(
|
||||||
m_events->forCServer().disconnected(), server,
|
m_events->forCServer().disconnected(), server,
|
||||||
|
|
Loading…
Reference in New Issue