Synchronize Command

- Added the stub of the sync command.
This commit is contained in:
Paul Beckingham 2012-10-01 23:16:08 -04:00
parent b3bd522f73
commit becd8f155c
7 changed files with 33 additions and 31 deletions

View file

@ -0,0 +1,11 @@
------ current release ---------------------------
2.3.0 () -
Features
+
Bugs
+
------ old releases ------------------------------

View file

@ -46,7 +46,7 @@ set (commands_SRCS Command.cpp Command.h
CmdStatistics.cpp CmdStatistics.h CmdStatistics.cpp CmdStatistics.h
CmdStop.cpp CmdStop.h CmdStop.cpp CmdStop.h
CmdSummary.cpp CmdSummary.h CmdSummary.cpp CmdSummary.h
CmdSynch.cpp CmdSynch.h CmdSync.cpp CmdSync.h
CmdTags.cpp CmdTags.h CmdTags.cpp CmdTags.h
CmdTimesheet.cpp CmdTimesheet.h CmdTimesheet.cpp CmdTimesheet.h
CmdUDAs.cpp CmdUDAs.h CmdUDAs.cpp CmdUDAs.h

View file

@ -273,10 +273,10 @@ int CmdStatistics::execute (std::string& output)
} }
/* /*
// TODO Re-enable this when 2.1 has taskd support. Until then, it makes no // TODO Re-enable this when 2.3 has taskd support. Until then, it makes no
// sense to include this. // sense to include this.
row = view.addRow (); row = view.addRow ();
view.set (row, 0, STRING_CMD_STATS_LAST_SYNCH); view.set (row, 0, STRING_CMD_STATS_LAST_SYNC);
if (context.tdb2.synch_key._file.exists ()) if (context.tdb2.synch_key._file.exists ())
view.set (row, 1, Date (context.tdb2.synch_key._file.mtime ()).toISO ()); view.set (row, 1, Date (context.tdb2.synch_key._file.mtime ()).toISO ());
else else

View file

@ -31,48 +31,39 @@
#include <Context.h> #include <Context.h>
#include <text.h> #include <text.h>
#include <i18n.h> #include <i18n.h>
#include <CmdSynch.h> #include <CmdSync.h>
extern Context context; extern Context context;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
CmdSynch::CmdSynch () CmdSync::CmdSync ()
{ {
_keyword = "synchronize"; _keyword = "synchronize";
_usage = "task synchronize"; _usage = "task synchronize";
_description = STRING_CMD_SYNCH_USAGE; _description = STRING_CMD_SYNC_USAGE;
_read_only = false; _read_only = false;
_displays_id = true; _displays_id = true;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int CmdSynch::execute (std::string& output) int CmdSync::execute (std::string& output)
{ {
// TODO Tempporary.
std::cout << "\n"
<< "Task Server Synchronization is not implemented in 2.0.0beta3.\n"
<< "\n";
// If no server is set up, quit. // If no server is set up, quit.
std::string connection = context.config.get ("taskd.server"); std::string connection = context.config.get ("taskd.server");
if (connection == "" || if (connection == "" ||
connection.find (':') == std::string::npos) connection.find (':') == std::string::npos)
throw std::string (STRING_CMD_SYNCH_NO_SERVER); throw std::string (STRING_CMD_SYNC_NO_SERVER);
// Obtain credentials. // Obtain credentials.
std::string credentials = context.config.get ("taskd.credentials"); std::string credentials = context.config.get ("taskd.credentials");
// TODO Obtain synch key. // TODO Read backlog.data.
// TODO Send backlog.data in 'sync' request..
// TODO Compose backlog into ticket. // TODO Receive response.
// TODO Request synch. // TODO Apply tasks.
// TODO Truncate backlog.data.
// TODO Receive synch data.
// TODO Extract remote mods.
// TODO Extract new synch key.
// TODO Apply remote mods.
// TODO Store new synch key. // TODO Store new synch key.
// TODO Truncate backlog.
return 1; return 1;
} }

View file

@ -25,17 +25,17 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_CMDSYNCH #ifndef INCLUDED_CMDSYNC
#define INCLUDED_CMDSYNCH #define INCLUDED_CMDSYNC
#define L10N // Localization complete. #define L10N // Localization complete.
#include <string> #include <string>
#include <Command.h> #include <Command.h>
class CmdSynch : public Command class CmdSync : public Command
{ {
public: public:
CmdSynch (); CmdSync ();
int execute (std::string&); int execute (std::string&);
}; };

View file

@ -83,7 +83,7 @@
#include <CmdStatistics.h> #include <CmdStatistics.h>
#include <CmdStop.h> #include <CmdStop.h>
#include <CmdSummary.h> #include <CmdSummary.h>
//#include <CmdSynch.h> #include <CmdSync.h>
#include <CmdTags.h> #include <CmdTags.h>
#include <CmdTimesheet.h> #include <CmdTimesheet.h>
#include <CmdUDAs.h> #include <CmdUDAs.h>
@ -158,7 +158,7 @@ void Command::factory (std::map <std::string, Command*>& all)
c = new CmdStatistics (); all[c->keyword ()] = c; c = new CmdStatistics (); all[c->keyword ()] = c;
c = new CmdStop (); all[c->keyword ()] = c; c = new CmdStop (); all[c->keyword ()] = c;
c = new CmdSummary (); all[c->keyword ()] = c; c = new CmdSummary (); all[c->keyword ()] = c;
// c = new CmdSynch (); all[c->keyword ()] = c; c = new CmdSync (); all[c->keyword ()] = c;
c = new CmdTags (); all[c->keyword ()] = c; c = new CmdTags (); all[c->keyword ()] = c;
c = new CmdTimesheet (); all[c->keyword ()] = c; c = new CmdTimesheet (); all[c->keyword ()] = c;
c = new CmdUDAs (); all[c->keyword ()] = c; c = new CmdUDAs (); all[c->keyword ()] = c;

View file

@ -259,7 +259,7 @@
#define STRING_CMD_STATS_AVG_PEND "Average time pending" #define STRING_CMD_STATS_AVG_PEND "Average time pending"
#define STRING_CMD_STATS_DESC_LEN "Average desc length" #define STRING_CMD_STATS_DESC_LEN "Average desc length"
#define STRING_CMD_STATS_CHARS "{1} characters" #define STRING_CMD_STATS_CHARS "{1} characters"
#define STRING_CMD_STATS_LAST_SYNCH "Last server synchronization" #define STRING_CMD_STATS_LAST_SYNC "Last server synchronization"
#define STRING_CMD_STATS_BLOCKED "Blocked tasks" #define STRING_CMD_STATS_BLOCKED "Blocked tasks"
#define STRING_CMD_STATS_BLOCKING "Blocking tasks" #define STRING_CMD_STATS_BLOCKING "Blocking tasks"
#define STRING_CMD_REPORTS_USAGE "Lists all supported reports" #define STRING_CMD_REPORTS_USAGE "Lists all supported reports"
@ -409,8 +409,8 @@
#define STRING_CMD_SHELL_HELP1 "Enter any task command (such as 'list'), or hit 'Enter'." #define STRING_CMD_SHELL_HELP1 "Enter any task command (such as 'list'), or hit 'Enter'."
#define STRING_CMD_SHELL_HELP2 "There is no need to include the 'task' command itself." #define STRING_CMD_SHELL_HELP2 "There is no need to include the 'task' command itself."
#define STRING_CMD_SHELL_HELP3 "Enter 'quit' (or 'bye', 'exit') to end the session." #define STRING_CMD_SHELL_HELP3 "Enter 'quit' (or 'bye', 'exit') to end the session."
#define STRING_CMD_SYNCH_USAGE "Synchronizes data with the Task Server" #define STRING_CMD_SYNC_USAGE "Synchronizes data with the Task Server"
#define STRING_CMD_SYNCH_NO_SERVER "Task Server is not configured." #define STRING_CMD_SYNC_NO_SERVER "Task Server is not configured."
#define STRING_CMD_DIAG_USAGE "Platform, build and environment details" #define STRING_CMD_DIAG_USAGE "Platform, build and environment details"
#define STRING_CMD_DIAG_PLATFORM "Platform" #define STRING_CMD_DIAG_PLATFORM "Platform"
#define STRING_CMD_DIAG_UNKNOWN "<unknown>" #define STRING_CMD_DIAG_UNKNOWN "<unknown>"