• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdefile
 

tdeio/tdefile

  • tdeio
  • tdefile
tdefileview.h
1/* This file is part of the KDE libraries
2 Copyright (C) 1997 Stephan Kulow <coolo@kde.org>
3 Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef TDEFILEVIEW_H
22#define TDEFILEVIEW_H
23
24class TQPoint;
25class TDEActionCollection;
26
27#include <tqwidget.h>
28
29#include "tdefileitem.h"
30#include "tdefile.h"
31
36class TDEIO_EXPORT KFileViewSignaler : public TQObject
37{
38 TQ_OBJECT
39
40public:
45 void activate( const KFileItem *item ) {
46 if ( item->isDir() )
47 emit dirActivated( item );
48 else
49 emit fileSelected( item );
50 }
55 void highlightFile(const KFileItem *i) { emit fileHighlighted(i); }
56
57 void activateMenu( const KFileItem *i, const TQPoint& pos ) {
58 emit activatedMenu( i, pos );
59 }
60
61 void changeSorting( TQDir::SortSpec sorting ) {
62 emit sortingChanged( sorting );
63 }
64
65 void dropURLs(const KFileItem *i, TQDropEvent*e, const KURL::List&urls) {
66 emit dropped(i, e, urls);
67 }
68
69signals:
70 void dirActivated(const KFileItem*);
71
72 void sortingChanged( TQDir::SortSpec );
73
78 void fileHighlighted(const KFileItem*);
79 void fileSelected(const KFileItem*);
80 void activatedMenu( const KFileItem *i, const TQPoint& );
81 void dropped(const KFileItem *, TQDropEvent*, const KURL::List&);
82};
83
97class TDEIO_EXPORT KFileView {
98
99public:
100 KFileView();
101
105 virtual ~KFileView();
106
110 void addItemList(const KFileItemList &list);
111
117 virtual TQWidget *widget() = 0;
118
122 TQWidget *widget() const { return const_cast<KFileView*>(this)->widget(); }
123
127 void setCurrentItem( const TQString &filename );
128
133 virtual void setCurrentItem( const KFileItem *item ) = 0;
134
140 virtual KFileItem *currentFileItem() const = 0;
141
145 virtual void clear();
146
155 virtual void updateView(bool f = true);
156
157 virtual void updateView(const KFileItem*);
158
163 virtual void removeItem(const KFileItem *item);
164
170 virtual void listingCompleted();
171
176 TQDir::SortSpec sorting() const { return m_sorting; }
177
192 virtual void setSorting(TQDir::SortSpec sort);
193
198 bool isReversed() const { return (m_sorting & TQDir::Reversed); }
199
200 void sortReversed();
201
205 uint count() const { return filesNumber + dirsNumber; }
206
210 uint numFiles() const { return filesNumber; }
211
215 uint numDirs() const { return dirsNumber; }
216
217 virtual void setSelectionMode( KFile::SelectionMode sm );
218 virtual KFile::SelectionMode selectionMode() const;
219
220 enum ViewMode {
221 Files = 1,
222 Directories = 2,
223 All = Files | Directories
224 };
225 virtual void setViewMode( ViewMode vm );
226 virtual ViewMode viewMode() const { return view_mode; }
227
233 TQString viewName() const { return m_viewName; }
234
239 void setViewName( const TQString& name ) { m_viewName = name; }
240
241 virtual void setParentView(KFileView *parent);
242
251 virtual void insertItem( KFileItem *i);
252
257 virtual void clearView() = 0;
258
263 virtual void ensureItemVisible( const KFileItem *i ) = 0;
264
269 virtual void clearSelection() = 0;
270
276 virtual void selectAll();
277
282 virtual void invertSelection();
283
288 virtual void setSelected(const KFileItem *, bool enable) = 0;
289
294 virtual bool isSelected( const KFileItem * ) const = 0;
295
299 const KFileItemList * selectedItems() const;
300
304 const KFileItemList * items() const;
305
306 virtual KFileItem * firstFileItem() const = 0;
307 virtual KFileItem * nextItem( const KFileItem * ) const = 0;
308 virtual KFileItem * prevItem( const KFileItem * ) const = 0;
309
320 void setOnlyDoubleClickSelectsFiles( bool enable ) {
321 myOnlyDoubleClickSelectsFiles = enable;
322 }
323
329 bool onlyDoubleClickSelectsFiles() const {
330 return myOnlyDoubleClickSelectsFiles;
331 }
332
337 bool updateNumbers(const KFileItem *i);
338
344 virtual TDEActionCollection * actionCollection() const;
345
346 KFileViewSignaler * signaler() const { return sig; }
347
348 virtual void readConfig( TDEConfig *, const TQString& group = TQString::null );
349 virtual void writeConfig( TDEConfig *, const TQString& group = TQString::null);
350
358 enum DropOptions {
359 AutoOpenDirs = 1
360 };
366 // KDE 4: Make virtual
367 void setDropOptions(int options);
368
374 int dropOptions();
375
389 static TQString sortingKey( const TQString& value, bool isDir, int sortSpec);
390
397 static TQString sortingKey( TDEIO::filesize_t value, bool isDir,int sortSpec);
398
403 static int autoOpenDelay();
404
405protected:
410 KFileViewSignaler *sig;
411
412private:
413 static TQDir::SortSpec defaultSortSpec;
414 TQDir::SortSpec m_sorting;
415 TQString m_viewName;
416
420 uint filesNumber;
421 uint dirsNumber;
422
423 ViewMode view_mode;
424 KFile::SelectionMode selection_mode;
425
426 // never use! It's only guaranteed to contain valid items in the items()
427 // method!
428 mutable KFileItemList m_itemList;
429
430 mutable KFileItemList *m_selectedList;
431 bool myOnlyDoubleClickSelectsFiles;
432
433protected:
434 virtual void virtual_hook( int id, void* data );
435 /* @internal for virtual_hook */
436 enum { VIRTUAL_SET_DROP_OPTIONS = 1 };
437 void setDropOptions_impl(int options);
438private:
439 class KFileViewPrivate;
440 KFileViewPrivate *d;
441};
442
443#endif // TDEFILEINFOLISTWIDGET_H
KFileViewSignaler
internal class to make easier to use signals possible
Definition: tdefileview.h:37
KFileViewSignaler::activate
void activate(const KFileItem *item)
Call this method when an item is selected (depends on single click / double click configuration).
Definition: tdefileview.h:45
KFileViewSignaler::highlightFile
void highlightFile(const KFileItem *i)
emits the highlighted signal for item.
Definition: tdefileview.h:55
KFileViewSignaler::fileHighlighted
void fileHighlighted(const KFileItem *)
the item maybe be 0L, indicating that we're in multiselection mode and the selection has changed.
KFileView
This class defines an interface to all file views.
Definition: tdefileview.h:97
KFileView::clearSelection
virtual void clearSelection()=0
Clears any selection, unhighlights everything.
KFileView::viewName
TQString viewName() const
Definition: tdefileview.h:233
KFileView::onlyDoubleClickSelectsFiles
bool onlyDoubleClickSelectsFiles() const
Definition: tdefileview.h:329
KFileView::numFiles
uint numFiles() const
Definition: tdefileview.h:210
KFileView::setViewName
void setViewName(const TQString &name)
Sets the name of the view, which could be displayed somewhere.
Definition: tdefileview.h:239
KFileView::numDirs
uint numDirs() const
Definition: tdefileview.h:215
KFileView::isReversed
bool isReversed() const
Tells whether the current items are in reversed order (shortcut to sorting() & TQDir::Reversed).
Definition: tdefileview.h:198
KFileView::DropOptions
DropOptions
Various options for drag and drop support.
Definition: tdefileview.h:358
KFileView::setOnlyDoubleClickSelectsFiles
void setOnlyDoubleClickSelectsFiles(bool enable)
This is a KFileDialog specific hack: we want to select directories with single click,...
Definition: tdefileview.h:320
KFileView::sorting
TQDir::SortSpec sorting() const
Returns the sorting order of the internal list.
Definition: tdefileview.h:176
KFileView::currentFileItem
virtual KFileItem * currentFileItem() const =0
KFileView::widget
virtual TQWidget * widget()=0
a pure virtual function to get a TQWidget, that can be added to other widgets.
KFileView::setCurrentItem
virtual void setCurrentItem(const KFileItem *item)=0
Reimplement this to set item the current item in the view, e.g.
KFileView::count
uint count() const
Definition: tdefileview.h:205
KFileView::widget
TQWidget * widget() const
Definition: tdefileview.h:122
KFileView::ensureItemVisible
virtual void ensureItemVisible(const KFileItem *i)=0
pure virtual function, that should be implemented to make item i visible, i.e.
KFileView::setSelected
virtual void setSelected(const KFileItem *, bool enable)=0
Tells the view that it should highlight the item.
KFileView::isSelected
virtual bool isSelected(const KFileItem *) const =0
KFileView::clearView
virtual void clearView()=0
pure virtual function, that should be implemented to clear the view.

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdefile by doxygen 1.9.4
This website is maintained by Timothy Pearson.