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

tdeio/tdefile

  • tdeio
  • tdefile
tdediroperator.h
1/* This file is part of the KDE libraries
2 Copyright (C) 1999 Stephan Kulow <coolo@kde.org>
3 2000,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#ifndef TDEDIROPERATOR_H_
21#define TDEDIROPERATOR_H_
22
23#include <tqwidget.h>
24#include <tqptrstack.h>
25
26#include <tdeaction.h>
27#include <kcompletion.h>
28#include <kdirlister.h>
29#include <tdefileview.h>
30#include <tdefileitem.h>
31#include <tdefile.h>
32
33class TQPopupMenu;
34class TQTimer;
35
36class TDEAction;
37class KDirLister;
38class TDEToggleAction;
39class TDEActionSeparator;
40class TDEActionMenu;
41class TQWidgetStack;
42class KProgress;
43namespace TDEIO {
44 class CopyJob;
45 class DeleteJob;
46}
47
96class TDEIO_EXPORT KDirOperator : public TQWidget
97{
98 TQ_OBJECT
99
100 public:
105 enum ActionTypes { SortActions = 1,
106 ViewActions = 2,
107 NavActions = 4,
108 FileActions = 8,
109 AllActions = 15 };
117 KDirOperator(const KURL& urlName = KURL(),
118 TQWidget *parent = 0, const char* name = 0);
122 virtual ~KDirOperator();
123
127 // ### KDE4: make virtual
128 void setShowHiddenFiles ( bool s ) { showHiddenAction->setChecked( s ); }
129
133 bool showHiddenFiles () const { return showHiddenAction->isChecked(); }
134
138 void close();
140 virtual bool close( bool alsoDelete ) { return TQWidget::close( alsoDelete ); }
141
149 void setNameFilter(const TQString& filter);
150
155 const TQString& nameFilter() const { return dir->nameFilter(); }
156
174 void setMimeFilter( const TQStringList& mimetypes );
175
179 TQStringList mimeFilter() const { return dir->mimeFilters(); }
180
188 void clearFilter();
189
193 KURL url() const;
194
200 // ### KDE4: make virtual
201 void setURL(const KURL& url, bool clearforward);
202
207 void setCurrentItem( const TQString& filename );
208
219 // ### KDE4: make virtual
220 void setView(KFileView *view);
221
226 KFileView * view() const { return m_fileView; }
227
232 TQWidget * viewWidget() const { return m_fileView ? m_fileView->widget() : 0L; }
233
238 // ### KDE4: make virtual
239 void setView(KFile::FileView view);
240
244 void setSorting( TQDir::SortSpec );
245
249 TQDir::SortSpec sorting() const { return mySorting; }
250
254 bool isRoot() const { return url().path() == TQChar('/'); }
255
259 KDirLister *dirLister() const { return dir; }
260
265 KProgress * progressBar() const;
266
278 // ### KDE4: make virtual
279 void setMode( KFile::Mode m );
283 KFile::Mode mode() const;
284
290 // ### KDE4: make virtual
291 void setPreviewWidget(const TQWidget *w);
292
297 const KFileItemList * selectedItems() const {
298 return ( m_fileView ? m_fileView->selectedItems() : 0L );
299 }
300
304 inline bool isSelected( const KFileItem *item ) const {
305 return ( m_fileView ? m_fileView->isSelected( item ) : false );
306 }
307
312 int numDirs() const;
313
318 int numFiles() const;
319
328 TDECompletion * completionObject() const {
329 return const_cast<TDECompletion *>( &myCompletion );
330 }
331
340 TDECompletion *dirCompletionObject() const {
341 return const_cast<TDECompletion *>( &myDirCompletion );
342 }
343
389 TDEActionCollection * actionCollection() const { return myActionCollection; }
390
408 // ### KDE4: make virtual
409 void setViewConfig( TDEConfig *config, const TQString& group );
410
418 TDEConfig *viewConfig();
419
427 TQString viewConfigGroup() const;
428
442 virtual void readConfig( TDEConfig *, const TQString& group = TQString::null );
443
450 virtual void writeConfig( TDEConfig *, const TQString& group = TQString::null );
451
452
463 void setOnlyDoubleClickSelectsFiles( bool enable );
464
470 bool onlyDoubleClickSelectsFiles() const;
471
480 // ### KDE4: make virtual and turn TQString into KURL
481 bool mkdir( const TQString& directory, bool enterDirectory = true );
482
490 // ### KDE4: make virtual
491 TDEIO::DeleteJob * del( const KFileItemList& items,
492 bool ask = true, bool showProgress = true );
493
503 // ### KDE4: make virtual
504 TDEIO::DeleteJob * del( const KFileItemList& items, TQWidget *parent,
505 bool ask = true, bool showProgress = true );
506
510 void clearHistory();
511
522 // ### KDE4: make virtual
523 void setEnableDirHighlighting( bool enable );
524
531 bool dirHighlighting() const;
532
537 bool dirOnlyMode() const { return dirOnlyMode( myMode ); }
538
539 static bool dirOnlyMode( uint mode ) {
540 return ( (mode & KFile::Directory) &&
541 (mode & (KFile::File | KFile::Files)) == 0 );
542 }
543
548 void setupMenu(int whichActions);
549
554 virtual void setAcceptDrops(bool b);
555
561 // ### KDE4: make virtual
562 void setDropOptions(int options);
563
573 // ### KDE4: make virtual
574 TDEIO::CopyJob * trash( const KFileItemList& items, TQWidget *parent,
575 bool ask = true, bool showProgress = true );
576
577protected:
592 virtual KFileView* createView( TQWidget* parent, KFile::FileView view );
596 // ### KDE4: make virtual
597 void setDirLister( KDirLister *lister );
598
599 virtual void resizeEvent( TQResizeEvent * );
600
605 void setupActions();
606
611 void updateSortActions();
612
617 void updateViewActions();
618
624 void setupMenu();
625
633 void prepareCompletionObjects();
634
640 bool checkPreviewSupport();
641
642public slots:
646 // ### KDE4: make virtual
647 void back();
648
652 // ### KDE4: make virtual
653 void forward();
654
658 // ### KDE4: make virtual
659 void home();
660
664 // ### KDE4: make virtual
665 void cdUp();
666
670 void updateDir();
671
675 // ### KDE4: make virtual
676 void rereadDir();
677
681 // ### KDE4: make virtual
682 void mkdir();
683
687 // ### KDE4: make virtual
688 void deleteSelected();
689
695 void updateSelectionDependentActions();
696
700 TQString makeCompletion(const TQString&);
701
705 TQString makeDirCompletion(const TQString&);
706
711 // ### KDE4: make virtual
712 void trashSelected(TDEAction::ActivationReason, TQt::ButtonState);
713
714protected slots:
719 void resetCursor();
720
725 void pathChanged();
726
731 void insertNewFiles(const KFileItemList &newone);
732
737 void itemDeleted(KFileItem *);
738
742 // ### KDE4: make virtual
743 void selectDir(const KFileItem *item );
744
748 void selectFile(const KFileItem *item);
749
753 void highlightFile(const KFileItem* i) { emit fileHighlighted( i ); }
754
758 virtual void activatedMenu( const KFileItem *, const TQPoint& pos );
759
763 void sortByName() { byNameAction->setChecked( true ); }
764
768 void sortBySize() { bySizeAction->setChecked( true ); }
769
773 void sortByDate() { byDateAction->setChecked( true ); }
774
778 void sortReversed() { reverseAction->setChecked( !reverseAction->isChecked() ); }
779
783 void toggleDirsFirst() { dirsFirstAction->setChecked( !dirsFirstAction->isChecked() ); }
784
788 void toggleIgnoreCase() { caseInsensitiveAction->setChecked( !caseInsensitiveAction->isChecked() ); }
789
794 void slotCompletionMatch(const TQString& match);
795
796signals:
797 void urlEntered(const KURL& );
798 void updateInformation(int files, int dirs);
799 void completion(const TQString&);
800 void finishedLoading();
801
807 void viewChanged( KFileView * newView );
808
814 void fileHighlighted( const KFileItem *item );
815 void dirActivated( const KFileItem *item );
816 void fileSelected( const KFileItem *item );
825 void dropped(const KFileItem *item, TQDropEvent*event, const KURL::List&urls);
826private:
830 TQPtrStack<KURL> backStack;
831
835 TQPtrStack<KURL> forwardStack;
836
837 KDirLister *dir;
838 KURL currUrl;
839
840 TDECompletion myCompletion;
841 TDECompletion myDirCompletion;
842 bool myCompleteListDirty;
843 TQDir::SortSpec mySorting;
844
849 bool checkPreviewInternal() const;
850
855 void checkPath(const TQString& txt, bool takeFiles = false);
856
857 void connectView(KFileView *);
858
859 bool openURL( const KURL& url, bool keep = false, bool reload = false );
860
861 KFileView *m_fileView;
862 KFileItemList pendingMimeTypes;
863
864 // the enum KFile::FileView as an int
865 int m_viewKind;
866 int defaultView;
867
868 KFile::Mode myMode;
869 KProgress *progress;
870
871 const TQWidget *myPreview; // temporary pointer for the preview widget
872
873 // actions for the popupmenus
874 // ### clean up all those -- we have them all in the actionMenu!
875 TDEActionMenu *actionMenu;
876
877 TDEAction *backAction;
878 TDEAction *forwardAction;
879 TDEAction *homeAction;
880 TDEAction *upAction;
881 TDEAction *reloadAction;
882 TDEActionSeparator *actionSeparator;
883 TDEAction *mkdirAction;
884
885 TDEActionMenu *sortActionMenu;
886 TDERadioAction *byNameAction;
887 TDERadioAction *byDateAction;
888 TDERadioAction *bySizeAction;
889 TDEToggleAction *reverseAction;
890 TDEToggleAction *dirsFirstAction;
891 TDEToggleAction *caseInsensitiveAction;
892
893 TDEActionMenu *viewActionMenu;
894 TDERadioAction *shortAction;
895 TDERadioAction *detailedAction;
896 TDEToggleAction *showHiddenAction;
897 TDEToggleAction *separateDirsAction;
898
899 TDEActionCollection *myActionCollection;
900 TDEActionCollection *viewActionCollection;
901
902private slots:
906 void slotDetailedView();
907 void slotSimpleView();
908 void slotToggleHidden( bool );
909
910 void slotSeparateDirs();
911 void slotDefaultPreview();
912 void togglePreview( bool );
913
914 void slotSortByName();
915 void slotSortBySize();
916 void slotSortByDate();
917 void slotSortReversed();
918 void slotToggleDirsFirst();
919 void slotToggleIgnoreCase();
920
921 void slotStarted();
922 void slotProgress( int );
923 void slotShowProgress();
924 void slotIOFinished();
925 void slotCanceled();
926 void slotRedirected( const KURL& );
927
928 void slotViewActionAdded( TDEAction * );
929 void slotViewActionRemoved( TDEAction * );
930 void slotViewSortingChanged( TQDir::SortSpec );
931
932 void slotClearView();
933 void slotRefreshItems( const KFileItemList& items );
934
935 void slotProperties();
936
937 void insertViewDependentActions();
938
939public:
940 bool eventFilter(TQObject *obj, TQEvent *ev);
941
942private:
943 static bool isReadable( const KURL& url );
944
945protected:
946 virtual void virtual_hook( int id, void* data );
947private:
948 class KDirOperatorPrivate;
949 KDirOperatorPrivate *d;
950};
951
952#endif
KDirOperator
This widget works as a network transparent filebrowser.
Definition: tdediroperator.h:97
KDirOperator::dropped
void dropped(const KFileItem *item, TQDropEvent *event, const KURL::List &urls)
Emitted when files are dropped.
KDirOperator::sortByDate
void sortByDate()
Changes sorting to sort by date.
Definition: tdediroperator.h:773
KDirOperator::selectedItems
const KFileItemList * selectedItems() const
Definition: tdediroperator.h:297
KDirOperator::setShowHiddenFiles
void setShowHiddenFiles(bool s)
Enables/disables showing hidden files.
Definition: tdediroperator.h:128
KDirOperator::sortReversed
void sortReversed()
Changes sorting to reverse sorting.
Definition: tdediroperator.h:778
KDirOperator::ActionTypes
ActionTypes
The various action types.
Definition: tdediroperator.h:105
KDirOperator::dirLister
KDirLister * dirLister() const
Definition: tdediroperator.h:259
KDirOperator::mimeFilter
TQStringList mimeFilter() const
Definition: tdediroperator.h:179
KDirOperator::toggleIgnoreCase
void toggleIgnoreCase()
Toggles case sensitive / case insensitive sorting.
Definition: tdediroperator.h:788
KDirOperator::completionObject
TDECompletion * completionObject() const
Definition: tdediroperator.h:328
KDirOperator::toggleDirsFirst
void toggleDirsFirst()
Toggles showing directories first / having them sorted like files.
Definition: tdediroperator.h:783
KDirOperator::dirCompletionObject
TDECompletion * dirCompletionObject() const
Definition: tdediroperator.h:340
KDirOperator::viewWidget
TQWidget * viewWidget() const
Returns the widget of the current view.
Definition: tdediroperator.h:232
KDirOperator::sortByName
void sortByName()
Changes sorting to sort by name.
Definition: tdediroperator.h:763
KDirOperator::isSelected
bool isSelected(const KFileItem *item) const
Definition: tdediroperator.h:304
KDirOperator::showHiddenFiles
bool showHiddenFiles() const
Definition: tdediroperator.h:133
KDirOperator::actionCollection
TDEActionCollection * actionCollection() const
an accessor to a collection of all available Actions.
Definition: tdediroperator.h:389
KDirOperator::isRoot
bool isRoot() const
Definition: tdediroperator.h:254
KDirOperator::fileHighlighted
void fileHighlighted(const KFileItem *item)
Emitted when a file is highlighted or generally the selection changes in multiselection mode.
KDirOperator::close
virtual bool close(bool alsoDelete)
Reimplemented to avoid "hidden virtual" warnings.
Definition: tdediroperator.h:140
KDirOperator::nameFilter
const TQString & nameFilter() const
Definition: tdediroperator.h:155
KDirOperator::dirOnlyMode
bool dirOnlyMode() const
Definition: tdediroperator.h:537
KDirOperator::sorting
TQDir::SortSpec sorting() const
Definition: tdediroperator.h:249
KDirOperator::view
KFileView * view() const
Definition: tdediroperator.h:226
KDirOperator::sortBySize
void sortBySize()
Changes sorting to sort by size.
Definition: tdediroperator.h:768
KDirOperator::viewChanged
void viewChanged(KFileView *newView)
Emitted whenever the current fileview is changed, either by an explicit call to setView() or by the u...
KDirOperator::highlightFile
void highlightFile(const KFileItem *i)
Emits fileHighlighted( i )
Definition: tdediroperator.h:753
KFileView
This class defines an interface to all file views.
Definition: tdefileview.h:97
KFile::Mode
Mode
Modes of operation for the dialog.
Definition: tdefile.h:42

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.