syncoperation.h 1.51 KB
Newer Older
Lukas Appelhans's avatar
Lukas Appelhans committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/* This file is part of the KDE project

   Copyright (C) 2010 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.
*/

#ifndef SYNCOPERATION_H
#define SYNCOPERATION_H

#include <QObject>
Lukas Appelhans's avatar
Lukas Appelhans committed
15
#include <QUuid>
Lukas Appelhans's avatar
Lukas Appelhans committed
16
#include "apm.h"
Lukas Appelhans's avatar
Lukas Appelhans committed
17
#include <akabeiclient/akabeidatabasehandler.h>
Lukas Appelhans's avatar
Lukas Appelhans committed
18
#include <akabeierror.h>
Lukas Appelhans's avatar
Lukas Appelhans committed
19 20 21 22 23 24 25 26 27

class SyncOperation : public QObject
{
Q_OBJECT
public:
    explicit SyncOperation(QObject* parent = 0);
    virtual ~SyncOperation();
    
    void start(QList<APM::Operation> operations, QMultiHash<APM::Operation, QString> options, QStringList args);
Lukas Appelhans's avatar
Lukas Appelhans committed
28 29 30
    
private slots:
    void searchResult(QUuid,QList<Akabei::Package*>);
Lukas Appelhans's avatar
Lukas Appelhans committed
31
    void listRepo(const QString &repo);
Lukas Appelhans's avatar
Lukas Appelhans committed
32
    void showInformation(QUuid,QList<Akabei::Package*> packages);
Lukas Appelhans's avatar
Lukas Appelhans committed
33
    void showGroup(QUuid,QList<Akabei::Group*>);
Lukas Appelhans's avatar
Lukas Appelhans committed
34 35 36
    void databaseStatusChanged(AkabeiClient::DatabaseHandler::Status);
    void databaseProgressChanged(int);
    void databaseErrorTriggered(int);
37
    void install(QUuid,QList<Akabei::Package*>);
38
    void upgrade(QUuid,QList<Akabei::Package*>);
Lukas Appelhans's avatar
Lukas Appelhans committed
39 40
    
private:
Lukas Appelhans's avatar
Lukas Appelhans committed
41 42
    int m_currentDatabasePos;
    int m_maxDbNameLenght;
Lisa's avatar
Lisa committed
43
    
44
    void updateNextDatabase();
Lisa's avatar
Lisa committed
45
    void nextOperation();
Lukas Appelhans's avatar
Lukas Appelhans committed
46 47 48 49
    
    QList<APM::Operation> m_operations;
    QMultiHash<APM::Operation, QString> m_options;
    QStringList m_args;
Lukas Appelhans's avatar
Lukas Appelhans committed
50
    QUuid queryId;
Lukas Appelhans's avatar
Lukas Appelhans committed
51 52 53
};

#endif // SYNCOPERATION_H