Configurable drop directory
This commit is contained in:
parent
e66832c1d7
commit
357e0ccc7e
|
@ -176,6 +176,9 @@ App::initApp(int argc, const char** argv)
|
|||
|
||||
if (argsBase().m_enableDragDrop) {
|
||||
LOG((CLOG_INFO "drag and drop enabled"));
|
||||
if (!argsBase().m_dropTarget.empty()) {
|
||||
LOG((CLOG_INFO "drop target: %s", argsBase().m_dropTarget.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
// setup file logging after parsing args
|
||||
|
|
|
@ -167,7 +167,9 @@ private:
|
|||
" --no-tray disable the system tray icon.\n" \
|
||||
" --enable-drag-drop enable file drag & drop.\n" \
|
||||
" --enable-crypto enable the crypto (ssl) plugin.\n" \
|
||||
" --profile-dir <path> use named profile directory instead.\n"
|
||||
" --profile-dir <path> use named profile directory instead.\n" \
|
||||
" --drop-dir <path> use named drop target directory instead.\n"
|
||||
|
||||
#define HELP_COMMON_INFO_2 \
|
||||
" -h, --help display this help and exit.\n" \
|
||||
" --version display version information and exit.\n"
|
||||
|
|
|
@ -257,6 +257,9 @@ ArgParser::parseGenericArgs(int argc, const char* const* argv, int& i)
|
|||
argsBase().m_enableDragDrop = true;
|
||||
}
|
||||
}
|
||||
else if (isArg(i, argc, argv, NULL, "--drop-dir")) {
|
||||
argsBase().m_dropTarget = argv[++i];
|
||||
}
|
||||
else if (isArg(i, argc, argv, NULL, "--enable-crypto")) {
|
||||
argsBase().m_enableCrypto = true;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ m_display(NULL),
|
|||
m_disableTray(false),
|
||||
m_enableIpc(false),
|
||||
m_enableDragDrop(false),
|
||||
m_dropTarget(""),
|
||||
m_shouldExit(false),
|
||||
m_barrierAddress(),
|
||||
m_enableCrypto(false),
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
bool m_disableTray;
|
||||
bool m_enableIpc;
|
||||
bool m_enableDragDrop;
|
||||
String m_dropTarget;
|
||||
#if SYSAPI_WIN32
|
||||
bool m_debugServiceWait;
|
||||
bool m_pauseOnExit;
|
||||
|
|
|
@ -235,6 +235,9 @@ barrier::Screen*
|
|||
ClientApp::openClientScreen()
|
||||
{
|
||||
barrier::Screen* screen = createScreen();
|
||||
if (!argsBase().m_dropTarget.empty()) {
|
||||
screen->setDropTarget(argsBase().m_dropTarget);
|
||||
}
|
||||
screen->setEnableDragDrop(argsBase().m_enableDragDrop);
|
||||
m_events->adoptHandler(m_events->forIScreen().error(),
|
||||
screen->getEventTarget(),
|
||||
|
|
|
@ -197,6 +197,7 @@ public:
|
|||
virtual void fakeDraggingFiles(DragFileList fileList) = 0;
|
||||
virtual const String&
|
||||
getDropTarget() const = 0;
|
||||
virtual void setDropTarget(const String&) = 0;
|
||||
|
||||
protected:
|
||||
//! Handle system event
|
||||
|
|
|
@ -101,6 +101,7 @@ public:
|
|||
virtual void fakeDraggingFiles(DragFileList fileList) { throw std::runtime_error("fakeDraggingFiles not implemented"); }
|
||||
virtual const String&
|
||||
getDropTarget() const { throw std::runtime_error("getDropTarget not implemented"); }
|
||||
virtual void setDropTarget(const String&) { throw std::runtime_error("setDropTarget not implemented"); }
|
||||
|
||||
protected:
|
||||
//! Update mouse buttons
|
||||
|
|
|
@ -466,6 +466,12 @@ Screen::getDropTarget() const
|
|||
return m_screen->getDropTarget();
|
||||
}
|
||||
|
||||
void
|
||||
Screen::setDropTarget(const String& target)
|
||||
{
|
||||
return m_screen->setDropTarget(target);
|
||||
}
|
||||
|
||||
void*
|
||||
Screen::getEventTarget() const
|
||||
{
|
||||
|
|
|
@ -290,6 +290,8 @@ public:
|
|||
|
||||
//! Get the drop target directory
|
||||
const String& getDropTarget() const;
|
||||
//! Set the drop target directory
|
||||
void setDropTarget(const String&);
|
||||
|
||||
//@}
|
||||
|
||||
|
|
|
@ -502,6 +502,9 @@ barrier::Screen*
|
|||
ServerApp::openServerScreen()
|
||||
{
|
||||
barrier::Screen* screen = createScreen();
|
||||
if (!argsBase().m_dropTarget.empty()) {
|
||||
screen->setDropTarget(argsBase().m_dropTarget);
|
||||
}
|
||||
screen->setEnableDragDrop(argsBase().m_enableDragDrop);
|
||||
m_events->adoptHandler(m_events->forIScreen().error(),
|
||||
screen->getEventTarget(),
|
||||
|
|
|
@ -146,16 +146,6 @@ MSWindowsScreen::MSWindowsScreen(
|
|||
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));
|
||||
|
||||
// SHGetFolderPath is deprecated in vista, but use it for xp support.
|
||||
char desktopPath[MAX_PATH];
|
||||
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, desktopPath))) {
|
||||
m_desktopPath = std::string(desktopPath);
|
||||
LOG((CLOG_DEBUG "using desktop for drop target: %s", m_desktopPath.c_str()));
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_ERR "failed to get desktop path, no drop target available, error=%d", GetLastError()));
|
||||
}
|
||||
|
||||
OleInitialize(0);
|
||||
m_dropWindow = createDropWindow(m_class, "DropWindow");
|
||||
m_dropTarget = new MSWindowsDropTarget();
|
||||
|
@ -1921,9 +1911,27 @@ std::string& MSWindowsScreen::getDraggingFilename()
|
|||
return m_draggingFilename;
|
||||
}
|
||||
|
||||
const std::string& MSWindowsScreen::getDropTarget() const
|
||||
const std::string&
|
||||
MSWindowsScreen::getDropTarget() const
|
||||
{
|
||||
return m_desktopPath;
|
||||
if (m_dropTargetPath.empty()) {
|
||||
// SHGetFolderPath is deprecated in vista, but use it for xp support.
|
||||
char desktopPath[MAX_PATH];
|
||||
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, desktopPath))) {
|
||||
m_dropTargetPath = std::string(desktopPath);
|
||||
LOG((CLOG_DEBUG "using desktop for drop target: %s", m_dropTargetPath.c_str()));
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_ERR "failed to get desktop path, no drop target available, error=%d", GetLastError()));
|
||||
}
|
||||
}
|
||||
return m_dropTargetPath;
|
||||
}
|
||||
|
||||
void
|
||||
MSWindowsScreen::setDropTarget(const std::string& target)
|
||||
{
|
||||
m_dropTargetPath = target;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -120,6 +120,7 @@ public:
|
|||
virtual void fakeDraggingFiles(DragFileList fileList);
|
||||
virtual std::string& getDraggingFilename();
|
||||
virtual const std::string& getDropTarget() const;
|
||||
virtual void setDropTarget(const std::string&);
|
||||
|
||||
protected:
|
||||
// IPlatformScreen overrides
|
||||
|
@ -332,7 +333,7 @@ private:
|
|||
|
||||
IEventQueue* m_events;
|
||||
|
||||
std::string m_desktopPath;
|
||||
mutable std::string m_dropTargetPath;
|
||||
|
||||
MSWindowsDropTarget*
|
||||
m_dropTarget;
|
||||
|
|
Loading…
Reference in New Issue