summaryrefslogtreecommitdiffstats
path: root/quanta/treeviews/projecttreeview.h
blob: dafa3a2f755f1e6cfb9a277e2d2bb40596305009 (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
/***************************************************************************
                          projecttreeview.h  -  description
                             -------------------
    begin                : Tue Mar 14 2000
    copyright            : (C) 2000 by Yacovlev Alexander & Dmitry Poplavsky <pdima@mail.univ.kiev.ua>
                           (C) 2001-2004 Andras Mantia <amantia@kde.org>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 PROJECTTREEVIEW_H
#define PROJECTTREEVIEW_H

//own includes
#include "basetreeview.h"
//#include "projecturl.h"

class FileInfoDlg;
class ProjectList;

class ProjectTreeViewItem : public BaseTreeViewItem {

public:
  ProjectTreeViewItem( KFileTreeViewItem *tqparent, KFileItem* item, KFileTreeBranch *brnch );
  /** makes document root italics */
  void paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align);
};

class ProjectTreeBranch : public BaseTreeBranch {

public:
  ProjectTreeBranch(KFileTreeView *tqparent, const KURL& url,
                    const TQString& name, const TQPixmap& pix,
                    bool showHidden = false, KFileTreeViewItem *branchRoot = 0L);

  /** check for CVS and visible*/
  virtual KFileTreeViewItem* createTreeViewItem(KFileTreeViewItem *tqparent,
                                                KFileItem *fileItem );

  /** only files in list will be shown */
  ProjectList *urlList;
};



class ProjectTreeView : public BaseTreeView  {
  Q_OBJECT
  TQ_OBJECT

public:
  /**
   *  since this class is a singleton you must use this function to access it
   *
   *  the parameters are only used at the first call to create the class
   *
   */
  static ProjectTreeView* const ref(TQWidget *tqparent = 0L, const char *name = 0L)
  {
    static ProjectTreeView *m_ref;
    if (!m_ref) m_ref = new ProjectTreeView(tqparent, name);
    return m_ref;
  }

  virtual ~ProjectTreeView();
  bool isDocumentFolder(const KURL &url);
  ProjectTreeBranch* rootBranch() {return m_projectDir;}
  void plugCVSMenu();

public slots: // Public slots
  void slotOpen();
  void slotLoadToolbar();
  void slotReloadTree(ProjectList *a_fileList, bool buildNewtree, const TQStringList &folderToOpen);
  /** Sets new project information */
  void slotNewProjectLoaded(const TQString &, const KURL &, const KURL &);
  void slotPopulateFinished(KFileTreeViewItem* );
  /** makes the url visible in the tree */
  void slotViewActivated(const KURL&);
  /** fills the list with the url's of the open folder  */
  void slotGetTreetqStatus(TQStringList *folderToOpen)
  {
    m_projectDir->addOpenFolder(folderToOpen);
  }



protected slots:
  void slotMenu(KListView *listView, TQListViewItem *item, const TQPoint &point);
  void slotRenameItem(TQListViewItem* kvtvi, const TQString & newText, int col);
  virtual void slotCreateFolder();
  virtual void slotCreateFile();

signals: // Signals
  void removeFromProject( const KURL& );
  /** No descriptions */
  void rescanProjectDir();
  /** No descriptions */
  void showProjectOptions();
  void insertToProject(const KURL&);
  void uploadSingleURL(const KURL&, const TQString&, bool, bool);
  void loadToolbarFile(const KURL&);
  void uploadProject();
  void changeFileDescription(const KURL& url, const TQString& desc);
  void changeUploadtqStatus(const KURL& url, int status);
  void changeDocumentFoldertqStatus(const KURL& url, bool status);
  void reloadProject();

private:
  /** The constructor is privat because we use singleton patter.
   *  If you need the class use ProjectTreeView::ref() for
   *  construction and reference
   */
  ProjectTreeView(TQWidget *tqparent, const char *name);

  ProjectTreeBranch *m_projectDir;
  KPopupMenu *m_fileMenu;
  KPopupMenu *m_folderMenu;
  KPopupMenu *m_projectMenu;
  KURL m_documentRootURL;
  ProjectTreeViewItem *m_documentRootItem;
  KURL::List m_documentFolderList;
  KPopupMenu *m_uploadStatusMenu;
  ProjectList *m_projectFiles;
  int m_menuClose;                ///< remembers the menu entry

  int m_openInQuantaId;  ///< remembers the menu entry
  int m_setDocumentRootId;
  int m_alwaysUploadId;
  int m_neverUploadId;
  int m_confirmUploadId;

protected:
  /**
  creates a branch and adds this branch to the treeview
  @param url the root of the branch
  @return the new branch
  */
  virtual KFileTreeBranch* newBranch(const KURL& url);
  /**
  called when the description of an item was changed,
  @param item the treeview item
  @param newDesc the new description of item
  */
  void itemDescChanged(KFileTreeViewItem* item, const TQString& newDesc);
  /**
  adds the Quanta fileinfopage to the properties dialog
  overwritten to enable the file description
  @param propDlg the dialog where to add the page
  @return pointer to to just added page
  */
  virtual FileInfoDlg* addFileInfoPage(KPropertiesDialog *propDlg);

private slots: // Private slots
  /** No descriptions */
  void slotUploadProject();
  /** Bring up the project options dialog */
  void slotOptions();
  /** No descriptions */
  void slotRescan();
  void slotRemoveFromProject(int askForRemove = 1);
  void slotUploadSingleURL();
  void slotQuickUploadURL();
  void slotAlwaysUpload();
  void slotNeverUpload();
  void slotConfirmUpload();
  void slotUploadMenuAboutToShow();
  void slotChangeDocumentFoldertqStatus();
};

#endif