/* This file is part of the Chakra project Copyright (C) 2011 Lukas Appelhans This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. */ #include "apm.h" #include "queryoperation.h" #include "syncoperation.h" #include "removeoperation.h" #include #include #include #include #include #include APM::APM(OperationType type, QList operations, QMultiHash options, QStringList args, QObject * parent) : QObject(parent), m_operationType(type), m_operations(operations), m_options(options), m_args(args) { //QTimer::singleShot(0, AkabeiClient::Backend::instance(), SLOT(initialize())); //QCoreApplication::instance()->quit(); //QTimer::singleShot(0, QCoreApplication::instance(), SLOT(quit())); connect(AkabeiClient::Backend::instance(), SIGNAL(statusChanged(Akabei::Backend::Status)), SLOT(statusChanged(Akabei::Backend::Status))); AkabeiClient::Backend::instance()->initialize(); } APM::~APM() {} void APM::statusChanged(Akabei::Backend::Status status) { if (status == Akabei::Backend::StatusReady) start(); } void APM::start() { switch (m_operationType) { case QueryOperationType: { QueryOperation * query = new QueryOperation(this); query->start(m_operations, m_args); break; } case RemoveOperationType: { RemoveOperation * remove = new RemoveOperation(this); remove->start(m_operations, m_options, m_args); break; } case SyncOperationType: { SyncOperation * sync = new SyncOperation(this); sync->start(m_operations, m_options, m_args); break; } default: break; } } #include "apm.moc"