updateview.h 2.6 KB
Newer Older
1
/* 
2
 *  Copyright (C) 1999-2002 Bernd Gehrmann
Bernd Gehrmann's avatar
Bernd Gehrmann committed
3
 *                          bernd@mail.berlios.de
4 5 6 7 8 9 10 11 12 13 14
 *
 * This program may be distributed under the terms of the Q Public
 * License as defined by Trolltech AS of Norway and appearing in the
 * file LICENSE.QPL included in the packaging of this file.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */


15 16
#ifndef UPDATEVIEW_H
#define UPDATEVIEW_H
17

18

19 20
#include "listview.h"

21 22
#include <qptrlist.h>

23 24 25 26 27 28 29 30

class UpdateView : public ListView
{
    Q_OBJECT
    
public:

    enum Status { LocallyModified, LocallyAdded, LocallyRemoved,
31 32 33
                  NeedsUpdate, NeedsPatch, NeedsMerge,
                  UpToDate, Conflict,
                  Updated, Patched, Removed,
34
                  NotInCVS, Unknown };
35 36
    enum Filter { NoFilter=0, OnlyDirectories=1, NoUpToDate=2,
                  NoRemoved=4, NoNotInCVS=8 };
37 38 39 40 41 42 43 44 45 46
    enum Action { Add, Remove, Update, UpdateNoAct, Commit };
    
    UpdateView( QWidget *parent=0, const char *name=0 );
    ~UpdateView();

    void setFilter(Filter filter);
    Filter filter() const;
    
    static bool isDirItem(QListViewItem *item);

47 48
    bool hasSingleSelection() const;
    void getSingleSelection(QString *filename, QString *revision=0) const;
49
    /* Returns a list of all marked files and directories */
50
    QStringList multipleSelection() const;
51
    /* Returns a list of all marked files, excluding directories*/
52
    QStringList fileSelection() const;
53

54
    void openDirectory(const QString& dirname);
55 56 57
    void scanRecursive();
    void prepareJob(bool recursive, Action action);

58 59 60 61
    const QColor& conflictColor() const;
    const QColor& localChangeColor() const;
    const QColor& remoteChangeColor() const;

62 63 64 65 66 67 68
signals:
    void contextMenu();
    void fileOpened(QString filename);
    
public slots:
    void unfoldTree();
    void foldTree();
69
    void finishJob(bool normalExit, int exitStatus);
70 71 72 73 74 75 76 77 78 79 80 81 82
    void processUpdateLine(QString line);

protected:
    virtual void keyPressEvent(QKeyEvent *e);
    
private slots:
    void itemExecuted(QListViewItem *item);
    
private:
    void updateItem(const QString &filename, Status status, bool isdir);
    void rememberSelection(bool recursive);
    void syncSelection();
    void markUpdated(bool laststage, bool success);
83 84 85

    void updateColors();

86 87
    Filter filt;
    Action act;
André Wöbbeking's avatar
André Wöbbeking committed
88
    QPtrList<QListViewItem> relevantSelection;
89 90 91 92

    QColor m_conflictColor;
    QColor m_localChangeColor;
    QColor m_remoteChangeColor;
93 94 95 96 97 98 99 100
};

#endif


// Local Variables:
// c-basic-offset: 4
// End: