clientinterface.cpp \
myliststate.cpp \
episodecommand.cpp \
- animecommand.cpp
+ animecommand.cpp \
+ mylistexportcommand.cpp
HEADERS += client.h \
anidbudpclient_global.h \
clientinterface.h \
myliststate.h \
episodecommand.h \
- animecommand.h
+ animecommand.h \
+ mylistexportcommand.h
CONV_HEADERS += include/AniDBUdpClient/Client \
include/AniDBUdpClient/AbstractCommand \
include/AniDBUdpClient/FileCommand \
include/AniDBUdpClient/VoteCommand \
include/AniDBUdpClient/UptimeCommand \
+ include/AniDBUdpClient/MyListExportCommand \
include/AniDBUdpClient/File \
include/AniDBUdpClient/Hash \
include/AniDBUdpClient/ClientSentCommandsModel \
--- /dev/null
+#include "../../mylistexportcommand.h"
\ No newline at end of file
--- /dev/null
+#include "mylistexportcommand.h"
+
+namespace AniDBUdpClient {
+
+MyListExportCommand::MyListExportCommand(QString templateName)
+ : m_templateName(templateName)
+{
+}
+
+MyListExportCommand::MyListExportCommand(bool )
+{
+}
+
+bool MyListExportCommand::waitForResult() const
+{
+ return true;
+}
+
+Command MyListExportCommand::rawCommand() const
+{
+ Command command;
+ command.first = "MYLISTEXPORT";
+ if (m_templateName.isEmpty())
+ command.second["cancel"] = 1;
+ else
+ command.second["template"] = m_templateName;
+
+ return command;
+}
+
+void MyListExportReply::setRawReply(ReplyCode replyCode, const QString &reply)
+{
+ AbstractReply::setRawReply(replyCode, reply);
+
+ switch (replyCode)
+ {
+ case EXPORT_QUEUED:
+ case EXPORT_CANCELLED:
+ signalReplyReady(true);
+ break;
+ case EXPORT_NO_SUCH_TEMPLATE:
+ case EXPORT_ALREADY_IN_QUEUE:
+ case EXPORT_NO_EXPORT_QUEUED_OR_IS_PROCESSING:
+ default:
+ signalReplyReady(false);
+ break;
+ }
+}
+
+// ==
+
+} // namespace AniDBUdpClient
--- /dev/null
+#ifndef MYLISTEXPORTCOMMAND_H
+#define MYLISTEXPORTCOMMAND_H
+
+#include "abstractcommand.h"
+
+namespace AniDBUdpClient {
+
+class ANIDBUDPCLIENTSHARED_EXPORT MyListExportReply;
+
+class MyListExportCommand : public AbstractCommand
+{
+public:
+ typedef MyListExportReply ReplyType;
+ // Empty templateName is equivalent to canceling.
+ explicit MyListExportCommand(QString templateName);
+ explicit MyListExportCommand(bool cancel);
+
+ bool waitForResult() const;
+ Command rawCommand() const;
+
+private:
+ QString m_templateName;
+};
+
+class ANIDBUDPCLIENTSHARED_EXPORT MyListExportReply : public AbstractReply
+{
+ Q_OBJECT
+ REPLY_DEFINITION_HELPER(MyListExport)
+public:
+ void setRawReply(ReplyCode replyCode, const QString &reply);
+};
+
+} // namespace AniDBUdpClient
+
+#endif // MYLISTEXPORTCOMMAND_H