summaryrefslogtreecommitdiffstats
path: root/src/svnfrontend/tdesvnfilelist.h
blob: d1a9f78bb0da31ec6be2b3e9cef3fa6f4afcc402 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
/***************************************************************************
 *   Copyright (C) 2005-2007 by Rajko Albrecht                             *
 *   ral@alwins-world.de                                                   *
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 *   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.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 ***************************************************************************/
#ifndef KDESVNFILELIST_H
#define KDESVNFILELIST_H

#include "itemdisplay.h"
#include "filelistviewitem.h"
#include "src/svnqt/status.hpp"
#include "src/svnqt/client.hpp"

#include <klistview.h>
#include <kurl.h>
#include <ktrader.h>
#include <tqmap.h>
#include <tqptrlist.h>
#include <tqevent.h>

class KAction;
class KActionMenu;
class KActionCollection;
class KDialog;
class KDialogBase;
class KdesvnFileListPrivate;
class SvnActions;

namespace KIO {
    class Job;
}

namespace svn {
    class Revision;
}
/**
@author Rajko Albrecht
*/
class tdesvnfilelist : public KListView,public ItemDisplay
{
    Q_OBJECT
  TQ_OBJECT
    friend class FileListViewItem;
public:
    tdesvnfilelist(KActionCollection*,TQWidget *parent = 0, const char *name = 0);
    virtual ~tdesvnfilelist();

    virtual bool openURL( const KURL &url,bool noReinit=false );
    virtual SvnItem*SelectedOrMain();
    virtual SvnItem*Selected();
    virtual void SelectionList(SvnItemList*target);

    virtual TQWidget*realWidget();

    KActionCollection*filesActions();
    bool refreshItem(FileListViewItem*);

protected:
    const svn::Revision& remoteRevision()const;
    bool m_deletePerfect;
    TQMap<TQString,bool> m_Dirsread;

    KActionCollection* m_filesAction;
    KAction*m_BlameAction,*m_BlameRangeAction,*m_CatAction,*m_MkdirAction;
    KAction*m_InfoAction,*m_commitAction,*m_UpdateHead,*m_UpdateRev;
    KAction*m_AddCurrent,*m_DelCurrent,*m_CheckoutAction,*m_CheckoutCurrentAction,*m_RevertAction;
    KAction*m_changeToRepository,*m_switchRepository,*m_ExportAction,*m_ExportCurrentAction;
    KAction*m_CleanupAction,*m_ResolvedAction,*m_ImportDirsIntoCurrent,*m_RefreshViewAction,*m_MergeRevisionAction;
    KAction*m_RenameAction,*m_CopyAction;
    KAction*m_LockAction,*m_UnlockAction,*m_IgnoreAction;

    SvnActions*m_SvnWrapper;

    /* the parent entry must removed from list before */
    void insertDirs(FileListViewItem * _parent,svn::StatusEntries&);
    bool checkDirs(const TQString&,FileListViewItem * _parent);
    void setupActions();
    svn::Client*svnclient();


    FileListViewItem* singleSelected();
    FileListViewItemList* allSelected();

    template<class T> KDialogBase* createDialog(T**ptr,
        const TQString&_head,
        bool OkCancel=false,
        const char*name="dialog",
        bool showHelp=false
        );

    FileListViewItemList* m_SelectedItems;
    FileListViewItem* findEntryItem(const TQString&,FileListViewItem*startAt=0);

    virtual bool refreshRecursive(FileListViewItem*,bool down=true);
    virtual void updateParents(FileListViewItem*);
    virtual void checkUnversionedDirs( FileListViewItem * _parent );

    /**
     * Overridden virtuals for TQt drag 'n drop (XDND)
     */
    virtual void contentsDragEnterEvent( TQDragEnterEvent* );
    virtual void contentsDragLeaveEvent( TQDragLeaveEvent* );
    virtual void contentsDragMoveEvent( TQDragMoveEvent* );
    virtual void contentsDropEvent( TQDropEvent* );
    virtual bool acceptDrag(TQDropEvent *event)const;
    //virtual void startDrag();
    virtual TQDragObject* dragObject();

    void dispDummy();
    void reinitItems(FileListViewItem*_item = 0);
    KURL::List selectedUrls();

    virtual void contentsMouseMoveEvent( TQMouseEvent *e );
    virtual void contentsMousePressEvent(TQMouseEvent*e);
    virtual void contentsMouseReleaseEvent(TQMouseEvent*e);
    virtual void contentsWheelEvent( TQWheelEvent * e );
    virtual void leaveEvent(TQEvent*e);
    virtual void rescanIconsRec(FileListViewItem*_parent=0,bool checkNewer=false,bool no_update=false);

    KTrader::OfferList offersList(SvnItem*item,bool execOnly=false);

private:
    KdesvnFileListPrivate*m_pList;
    void cleanHighLighter();
    bool validDropEvent(TQDropEvent*event,TQListViewItem*&item);
    void copy_move(bool move);

protected slots:
    virtual void slotSelectBrowsingRevision();
    virtual void slotItemRead(TQListViewItem*);
    virtual void slotContextMenuRequested(TQListViewItem *, const TQPoint &, int);
    virtual void slotSelectionChanged();
    virtual void slotClientException(const TQString&);
    virtual void slotNotifyMessage(const TQString&);
    virtual void slotDirAdded(const TQString&,FileListViewItem*);
    virtual void slotReinitItem(SvnItem*);
    virtual void slotItemDoubleClicked(TQListViewItem*);
    virtual void slotImportIntoCurrent(bool);
    virtual void slotImportDirsIntoCurrent();
    virtual void slotImportIntoDir(const KURL&,const TQString&,bool);

    /* subversion slots */
    virtual void slotChangeToRepository();
    virtual void slotCleanupAction();
    virtual void slotResolved();
    virtual void slotTryResolve();
    virtual void slotMergeRevisions();
    virtual void slotMerge();
    virtual void slotDropped(TQDropEvent *,TQListViewItem*);
    virtual void viewportPaintEvent(TQPaintEvent *);
    virtual void slotRename();
    virtual void slotCopy();
    virtual void slotCat();
    virtual void slotDelete();
    virtual void slotDisplayLastDiff();

    /* callback slots */
    virtual void slotCopyFinished( KIO::Job *);
    virtual void slotDeleteFinished(KIO::Job*);
    virtual void _openURL(const TQString&);
    virtual void _dirwatchTimeout();
    virtual void _propListTimeout();

    /* internal slots */
    virtual void readSupportData();
    virtual void slotUpdateLogCache();

    virtual void enableActions();

signals:
    void sigLogMessage(const TQString&);
    void changeCaption(const TQString&);
    void sigShowPopup(const TQString&,TQWidget**);
    void sigUrlOpend(bool);
    void sigSwitchUrl(const KURL&);
    void sigUrlChanged(const TQString&);
    void sigProplist(const svn::PathPropertiesMapListPtr&,bool,const TQString&);
    void sigListError();
    void sigCachetqStatus(TQ_LONG,TQ_LONG);

public slots:
    virtual void refreshCurrentTree();
    virtual void refreshCurrent(SvnItem*);
    virtual void closeMe();
    virtual void slotMkdir();
    virtual void slotMkBaseDirs();
    virtual void slotSettingsChanged();
    virtual void slotChangeProperties(const svn::PropertiesMap&,const TQValueList<TQString>&,const TQString&);


protected slots:
    virtual void slotLock();
    virtual void slotUnlock();
    virtual void slotIgnore();
    virtual void slotBlame();
    virtual void slotRangeBlame();
    virtual void slotSimpleHeadDiff();
    virtual void slotSimpleBaseDiff();

    virtual void slotDiffRevisions();
    virtual void slotDiffPathes();
    virtual void slotRevisionCat();
    virtual void slotCheckUpdates();
    virtual void slotInfo();
    virtual void slotDirItemCreated(const TQString&);
    virtual void slotDirItemDirty(const TQString&);
    virtual void slotDirItemDeleted(const TQString&);
    virtual void slotRelocate();
    virtual void slotRescanIcons(bool);
    virtual void slotCheckNewItems();
    virtual void slotMakeRangeLog();
    virtual void slotMakeLog();
    virtual void slotMakeTree();
    virtual void slotMakePartTree();
    virtual void slotInternalDrop();
    virtual void slotOpenWith();
    virtual void slotDisplayProperties();

	virtual void slotUnfoldTree();
	virtual void slotFoldTree();

private slots:
    void gotPreview( const KFileItem*, const TQPixmap& );
    void gotPreviewResult();
protected:
    virtual bool uniqueTypeSelected();
    virtual void dispProperties(bool);
};

#endif