summaryrefslogtreecommitdiffstats
path: root/krusader/Panel/listpanel.h
blob: e809db2a84086b48f98f227d50fc56b35eb4e53f (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
/***************************************************************************
                               listpanel.h
                            -------------------
   begin                : Thu May 4 2000
   copyright            : (C) 2000 by Shie Erlich & Rafi Yanai
   e-mail               : krusader@users.sourceforge.net
   web site             : http://krusader.sourceforge.net
---------------------------------------------------------------------------
 Description
***************************************************************************

 A

    db   dD d8888b. db    db .d8888.  .d8b.  d8888b. d88888b d8888b.
    88 ,8P' 88  `8D 88    88 88'  YP d8' `8b 88  `8D 88'     88  `8D
    88,8P   88oobY' 88    88 `8bo.   88ooo88 88   88 88ooooo 88oobY'
    88`8b   88`8b   88    88   `Y8b. 88~~~88 88   88 88~~~~~ 88`8b
    88 `88. 88 `88. 88b  d88 db   8D 88   88 88  .8D 88.     88 `88.
    YP   YD 88   YD ~Y8888P' `8888Y' YP   YP Y8888D' Y88888P 88   YD

                                                    H e a d e r    F i l e

***************************************************************************
*                                                                         *
*   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 LISTPANEL_H
#define LISTPANEL_H

#include <kpropsdlg.h>
#include <kfileitem.h>
#include <kurl.h>
#include <tqwidget.h>
#include <tqlabel.h>
#include <layout.h>
#include <tqstring.h>
#include <tqpixmap.h>
#include <tqtoolbutton.h>
#include <tqpopupmenu.h>
#include <tqdir.h>
#include <tqpixmapcache.h>
#include <tqiconset.h>
#include <tqptrstack.h>
#include <textbrowser.h>
#include <keditcl.h>
#include <klineedit.h>
#include <tqguardedptr.h>
#include "krview.h"
#include "../Dialogs/krsqueezedtextlabel.h"

// use our version of it, until kde fixes theirs
#include "../MountMan/kdiskfreesp.h"

#define PROP_SYNC_BUTTON_ON               1

class vfs;
class vfile;
class KRdirWatch;
class KrView;
class KURLRequester;
class BookmarksButton;
class KrQuickSearch;
class DirHistoryButton;
class DirHistoryQueue;
class MediaButton;
class PanelPopup;
class SyncBrowseButton;
class KrBookmarkButton;
class KPushButton;
class ListPanelFunc;
class TQHeader;

class ListPanel : public TQWidget {
   friend class ListPanelFunc;
   Q_OBJECT
  TQ_OBJECT
public:
	#define ITEM2VFILE(PANEL_PTR, KRVIEWITEM)		PANEL_PTR->func->files()->vfs_search(KRVIEWITEM->name())
	#define NAME2VFILE(PANEL_PTR, STRING_NAME)	PANEL_PTR->func->files()->vfs_search(STRING_NAME)
   // constructor create the panel, but DOESN'T fill it with data, use start()
   ListPanel( TQString panelType, TQWidget *parent, bool &left, const char *name = 0 );
   ~ListPanel();
   void start( KURL url = KURL(), bool immediate = false );
   
   const TQString & getType() { return panelType; }
   void changeType( const TQString & );
   
   KURL virtualPath() const;
	TQString realPath() const;
   TQString getCurrentName();
   void getSelectedNames( TQStringList* fileNames ) {
      view->getSelectedItems( fileNames );
   }
   void setPanelToolbar();
   bool isLeft() {return _left;}
   void jumpBack();
   void setJumpBack( KURL url );

   int  getProperties();
   void setProperties( int );

public slots:
   void gotStats( const TQString &mountPoint, unsigned long kBSize, unsigned long kBUsed, unsigned long kBAvail); // displays filesystem status
   void popRightClickMenu( const TQPoint& );
   void popEmptyRightClickMenu( const TQPoint & );
   void select( KRQuery query, bool select);
   void select( bool, bool );      // see doc in ListPanel
   void invertSelection();       // see doc in ListPanel
   void compareDirs();
   void slotFocusOnMe(); // give this VFS the focus (the path bar)
   void slotUpdate();			                  // when the vfs finish to update...
   void slotUpdateTotals();
   void slotStartUpdate();                   // internal
   void slotGetStats( const KURL& url );          // get the disk-free stats
   void setFilter( KrViewProperties::FilterSpec f );
   void slotFocusAndCDRoot();
   void slotFocusAndCDHome();
   void slotFocusAndCDup();
   void slotFocusAndCDOther();
	void togglePanelPopup();
	// for signals from vfs' dirwatch
	void slotItemAdded(vfile *vf);
	void slotItemDeleted(const TQString& name);
	void slotItemUpdated(vfile *vf);
	void slotCleared();        
	void panelActive(); // called when the panel becomes active
	void panelInactive(); // called when panel becomes inactive
	

   ///////////////////////// service functions - called internally ////////////////////////
   inline void setOther( ListPanel *panel ) {
      otherPanel = panel;
   }
   void prepareToDelete();                   // internal use only

protected:
   virtual void keyPressEvent( TQKeyEvent *e );
   virtual void showEvent( TQShowEvent * );
   virtual void hideEvent( TQHideEvent * );
   virtual bool eventFilter ( TQObject * watched, TQEvent * e );
   
   void createView();

protected slots:
   void handleDropOnView(TQDropEvent *, TQWidget *destWidget=0); // handles drops on the view only
   void handleDropOnTotals( TQDropEvent * );                   // handles drops on the totals line
   void handleDropOnStatus( TQDropEvent * );                   // handles drops on the status line
   void startDragging( TQStringList, TQPixmap );
	// those handle the in-panel refresh notifications
	void slotJobStarted(KIO::Job* job);
	void inlineRefreshInfoMessage( KIO::Job* job, const TQString &msg );
	void inlineRefreshListResult(KIO::Job* job);
	void inlineRefreshPercent( KIO::Job*, unsigned long );
	void inlineRefreshCancel();

signals:
   void signalStatus( TQString msg );       // emmited when we need to update the status bar
   void cmdLineUpdate( TQString p );	      // emitted when we need to update the command line
   void pathChanged( ListPanel *panel );
   void activePanelChanged( ListPanel *p ); // emitted when the user changes panels
   void finishedDragging();              // currently

public:
   TQString panelType;
   ListPanelFunc	*func;
   KrView *view;
   ListPanel	*otherPanel;
   int colorMask;
   bool compareMode;
   //FilterSpec	   filter;
   KRQuery filterMask;
   TQPixmap currDragPix;
   TQListViewItem *currDragItem;
   KDiskFreeSp* statsAgent;
   KrSqueezedTextLabel *status, *totals;
   KrQuickSearch *quickSearch;
   KURLRequester *origin;
   TQGridLayout *layout;
   TQToolButton *cdRootButton;
   TQToolButton *cdHomeButton;
   TQToolButton *cdUpButton;
   TQToolButton *cdOtherButton;
	TQToolButton *popupBtn;
	TQToolButton *clearOrigin;
	PanelPopup *popup;
   KrBookmarkButton *bookmarksButton;
   DirHistoryQueue* dirHistoryQueue;
   DirHistoryButton* historyButton;
   MediaButton *mediaButton;
   SyncBrowseButton *syncBrowseButton;
	KPushButton *inlineRefreshCancelButton;
	KIO::Job *inlineRefreshJob;
	TQSplitter *splt;
   TQHeader * header;

protected:
   KURL _realPath; // named with _ to keep realPath() compatability
   KURL _jumpBackURL;
   
	
private:
   bool &_left;
	TQValueList<int> popupSizes;
};

#endif