summaryrefslogtreecommitdiffstats
path: root/parts/fileview/vcsfiletreewidgetimpl.h
blob: 00a38b32ddf09d1c4c4b22660d9defab439b59cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/***************************************************************************
 *   Copyright (C) 2003 by Mario Scalas                                    *
 *   mario.scalas@libero.it                                                *
 *                                                                         *
 *   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 VCSFILETREEWIDGETIMPL_H
#define VCSFILETREEWIDGETIMPL_H

#include "filetreeviewwidgetimpl.h"

class KDevVCSFileInfoProvider;
class TDEAction;
class TDEToggleAction;

/**
* @author Mario Scalas
* Provides VCS feedback to the standard features.
*/
class VCSFileTreeWidgetImpl : public FileTreeViewWidgetImpl
{
    Q_OBJECT
  
public:
    VCSFileTreeWidgetImpl( FileTreeWidget *parent, KDevVCSFileInfoProvider *infoProvider );
    virtual ~VCSFileTreeWidgetImpl();

    /*
    * We must avoid a reload operation while we syncing with the repository since this
    * will break our job.
    */
    virtual bool canReloadTree() const;
    /*
    * Add "sync with repository" and "show VCS fields" options to the context menu.
    */
    virtual void fillPopupMenu( TQPopupMenu *popupMenu, TQListViewItem *item ) const;

private slots:
    //! show/hide the header and the additional fields (status and versions)
    void slotToggleShowVCSFields( bool checked );
    //! start a sync operation with the remote repository: this may take a while so we use
    //! the async interface provided by the KDevVCSFileInfoProvider interface
    void slotSyncWithRepository();
    //! when the requested info are ready the infoProvider object will be so kind the
    //! to give them to us in a ready-to-use format: we'll use that info to update all
    //! the items which are childs of the @see filetreeview::FileTreeViewItem stored in
    //! @p callerData.
    void vcsDirStatusReady( const VCSFileInfoMap &modifiedFiles, void *callerData );
    void slotDirectoryExpanded( TQListViewItem* );

private:
    bool showVCSFields() const;

    TDEToggleAction *m_actionToggleShowVCSFields;
    TDEAction *m_actionSyncWithRepository;
    KDevVCSFileInfoProvider *m_vcsInfoProvider;
    //! We use this guard to avoid enabling the "reload tree" action when performing
    //! syncing with remote repositories.
    bool m_isSyncingWithRepository;
    mutable KFileTreeViewItem *m_vcsStatusRequestedItem;
};

#endif