From 1cf063fdc7c47b6325c61c6531dc4aecc0c5e60f Mon Sep 17 00:00:00 2001 From: Szymon Tomasz Stefanek Date: Fri, 22 Apr 2016 16:33:54 +0200 Subject: Add a 'clear' command to the filetransferwindow module --- .../libkvifiletransferwindow.cpp | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/modules') diff --git a/src/modules/filetransferwindow/libkvifiletransferwindow.cpp b/src/modules/filetransferwindow/libkvifiletransferwindow.cpp index 8e7aa83a4..8bea5bd1a 100644 --- a/src/modules/filetransferwindow/libkvifiletransferwindow.cpp +++ b/src/modules/filetransferwindow/libkvifiletransferwindow.cpp @@ -74,9 +74,40 @@ static bool filetransferwindow_kvs_cmd_open(KviKvsModuleCommandCall * c) return true; } +/* + @doc: filetransferwindow.clear + @type: + command + @title: + filetransferwindow.clear + @short: + Clears the list of transfers + @syntax: + filetransferwindow.clear [-a] + @switches: + !sw: -a | --all + Clears all the transfers, including the running ones! + @description: + Clears the transfers. Without the -a switch only the terminated + transfers are cleared. With -a all the transfers are terminated (including the running ones). +*/ + +static bool filetransferwindow_kvs_cmd_clear(KviKvsModuleCommandCall * c) +{ + + if(c->hasSwitch('a',QString::fromLatin1("all"))) + KviFileTransferManager::instance()->killAllTransfers(); + else + KviFileTransferManager::instance()->killTerminatedTransfers(); + + return true; +} + + static bool filetransferwindow_module_init(KviModule * m) { KVSM_REGISTER_SIMPLE_COMMAND(m,"open",filetransferwindow_kvs_cmd_open); + KVSM_REGISTER_SIMPLE_COMMAND(m,"clear",filetransferwindow_kvs_cmd_clear); return true; } -- cgit v1.3.1-10-gc9f91