syncoperation.h 1.82 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"
17
#include "progressbar.h"
Lukas Appelhans's avatar
Lukas Appelhans committed
18
#include <akabeierror.h>
19
#include <akabeiclientdatabasehandler.h>
Lukas Appelhans's avatar
Lukas Appelhans committed
20 21 22

class SyncOperation : public QObject
{
Lisa's avatar
Lisa committed
23
Q_OBJECT
Lukas Appelhans's avatar
Lukas Appelhans committed
24
public:
Lisa's avatar
Lisa committed
25
    explicit SyncOperation(QList<APM::OperationName> operations, QHash<APM::OptionName, QStringList> options, QStringList args, QObject* parent = 0);
Lukas Appelhans's avatar
Lukas Appelhans committed
26
    virtual ~SyncOperation();
27

Lisa's avatar
Lisa committed
28
    void start();
29

Luca Giambonini's avatar
Luca Giambonini committed
30
private Q_SLOTS:
Lisa's avatar
Lisa committed
31
    void searchResult(QUuid,QList<Akabei::Package*>);
Lukas Appelhans's avatar
Lukas Appelhans committed
32
    void listRepo(const QString &repo);
Lisa's avatar
Lisa committed
33 34
    void showInformation(QUuid,QList<Akabei::Package*> packages);
    void showGroup(QUuid,QList<Akabei::Group*>);
Lukas Appelhans's avatar
Lukas Appelhans committed
35 36
    void databaseStatusChanged(AkabeiClient::DatabaseHandler::Status);
    void databaseProgressChanged(int);
37
    void databaseErrorTriggered(const Akabei::Error::List &);
Lisa's avatar
Lisa committed
38
    void install(QUuid,QList<Akabei::Package*>);
39

40 41
    void nextOperation();

Luca Giambonini's avatar
Luca Giambonini committed
42
public Q_SLOTS:
43
    void updateNextDatabase();
Lisa's avatar
Lisa committed
44
    void updateError();
45

Lukas Appelhans's avatar
Lukas Appelhans committed
46
private:
47 48
    QList<AkabeiClient::DatabaseHandler*>::const_iterator currentDatabase;
    QList<AkabeiClient::DatabaseHandler*>::const_iterator lastDatabase;
Lisa's avatar
Lisa committed
49
    int m_maxDbNameLength;
50

51
    void updateSystem();
52
    void updateDatabases();
Lukas Appelhans's avatar
Lukas Appelhans committed
53

Lisa's avatar
Lisa committed
54
    bool isIgnored(Akabei::Package *);
55

Lisa's avatar
Lisa committed
56 57 58
    QList<APM::OperationName> m_operations;
    QHash<APM::OptionName, QStringList> m_options;
    QStringList m_args;
Lukas Appelhans's avatar
Lukas Appelhans committed
59
    QUuid queryId;
60
    ProgressBar m_bar;
Lukas Appelhans's avatar
Lukas Appelhans committed
61
    bool forceDbUpdate;
62

Luca Giambonini's avatar
Luca Giambonini committed
63
Q_SIGNALS:
64
    void syncFinished();
Lukas Appelhans's avatar
Lukas Appelhans committed
65 66 67
};

#endif // SYNCOPERATION_H