• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kio/kfile
 

kio/kfile

  • kio
  • kfile
kdiroperator.h
1 // -*- c++ -*-
2 /* This file is part of the KDE libraries
3  Copyright (C) 1999 Stephan Kulow <coolo@kde.org>
4  2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 #ifndef KDIROPERATOR_H_
22 #define KDIROPERATOR_H_
23 
24 #include <tqwidget.h>
25 #include <tqptrstack.h>
26 
27 #include <kaction.h>
28 #include <kcompletion.h>
29 #include <kdirlister.h>
30 #include <kfileview.h>
31 #include <kfileitem.h>
32 #include <kfile.h>
33 
34 class TQPopupMenu;
35 class TQTimer;
36 
37 class KAction;
38 class KDirLister;
39 class KToggleAction;
40 class KActionSeparator;
41 class KActionMenu;
42 class TQWidgetStack;
43 class KProgress;
44 namespace KIO {
45  class CopyJob;
46  class DeleteJob;
47 }
48 
97 class KIO_EXPORT KDirOperator : public TQWidget
98 {
99  Q_OBJECT
100 
101  public:
106  enum ActionTypes { SortActions = 1,
107  ViewActions = 2,
108  NavActions = 4,
109  FileActions = 8,
110  AllActions = 15 };
118  KDirOperator(const KURL& urlName = KURL(),
119  TQWidget *parent = 0, const char* name = 0);
123  virtual ~KDirOperator();
124 
128  // ### KDE4: make virtual
129  void setShowHiddenFiles ( bool s ) { showHiddenAction->setChecked( s ); }
130 
134  bool showHiddenFiles () const { return showHiddenAction->isChecked(); }
135 
139  void close();
141  virtual bool close( bool alsoDelete ) { return TQWidget::close( alsoDelete ); }
142 
150  void setNameFilter(const TQString& filter);
151 
156  const TQString& nameFilter() const { return dir->nameFilter(); }
157 
175  void setMimeFilter( const TQStringList& mimetypes );
176 
180  TQStringList mimeFilter() const { return dir->mimeFilters(); }
181 
189  void clearFilter();
190 
194  KURL url() const;
195 
201  // ### KDE4: make virtual
202  void setURL(const KURL& url, bool clearforward);
203 
208  void setCurrentItem( const TQString& filename );
209 
220  // ### KDE4: make virtual
221  void setView(KFileView *view);
222 
227  KFileView * view() const { return m_fileView; }
228 
233  TQWidget * viewWidget() const { return m_fileView ? m_fileView->widget() : 0L; }
234 
239  // ### KDE4: make virtual
240  void setView(KFile::FileView view);
241 
245  void setSorting( TQDir::SortSpec );
246 
250  TQDir::SortSpec sorting() const { return mySorting; }
251 
255  bool isRoot() const { return url().path() == TQChar('/'); }
256 
260  KDirLister *dirLister() const { return dir; }
261 
266  KProgress * progressBar() const;
267 
279  // ### KDE4: make virtual
280  void setMode( KFile::Mode m );
284  KFile::Mode mode() const;
285 
291  // ### KDE4: make virtual
292  void setPreviewWidget(const TQWidget *w);
293 
298  const KFileItemList * selectedItems() const {
299  return ( m_fileView ? m_fileView->selectedItems() : 0L );
300  }
301 
305  inline bool isSelected( const KFileItem *item ) const {
306  return ( m_fileView ? m_fileView->isSelected( item ) : false );
307  }
308 
313  int numDirs() const;
314 
319  int numFiles() const;
320 
329  KCompletion * completionObject() const {
330  return const_cast<KCompletion *>( &myCompletion );
331  }
332 
341  KCompletion *dirCompletionObject() const {
342  return const_cast<KCompletion *>( &myDirCompletion );
343  }
344 
390  KActionCollection * actionCollection() const { return myActionCollection; }
391 
409  // ### KDE4: make virtual
410  void setViewConfig( KConfig *config, const TQString& group );
411 
419  KConfig *viewConfig();
420 
428  TQString viewConfigGroup() const;
429 
443  virtual void readConfig( KConfig *, const TQString& group = TQString::null );
444 
451  virtual void writeConfig( KConfig *, const TQString& group = TQString::null );
452 
453 
464  void setOnlyDoubleClickSelectsFiles( bool enable );
465 
471  bool onlyDoubleClickSelectsFiles() const;
472 
481  // ### KDE4: make virtual and turn TQString into KURL
482  bool mkdir( const TQString& directory, bool enterDirectory = true );
483 
491  // ### KDE4: make virtual
492  KIO::DeleteJob * del( const KFileItemList& items,
493  bool ask = true, bool showProgress = true );
494 
504  // ### KDE4: make virtual
505  KIO::DeleteJob * del( const KFileItemList& items, TQWidget *parent,
506  bool ask = true, bool showProgress = true );
507 
511  void clearHistory();
512 
523  // ### KDE4: make virtual
524  void setEnableDirHighlighting( bool enable );
525 
532  bool dirHighlighting() const;
533 
538  bool dirOnlyMode() const { return dirOnlyMode( myMode ); }
539 
540  static bool dirOnlyMode( uint mode ) {
541  return ( (mode & KFile::Directory) &&
542  (mode & (KFile::File | KFile::Files)) == 0 );
543  }
544 
549  void setupMenu(int whichActions);
550 
555  virtual void setAcceptDrops(bool b);
556 
562  // ### KDE4: make virtual
563  void setDropOptions(int options);
564 
574  // ### KDE4: make virtual
575  KIO::CopyJob * trash( const KFileItemList& items, TQWidget *parent,
576  bool ask = true, bool showProgress = true );
577 
578 protected:
593  virtual KFileView* createView( TQWidget* parent, KFile::FileView view );
597  // ### KDE4: make virtual
598  void setDirLister( KDirLister *lister );
599 
600  virtual void resizeEvent( TQResizeEvent * );
601 
606  void setupActions();
607 
612  void updateSortActions();
613 
618  void updateViewActions();
619 
625  void setupMenu();
626 
634  void prepareCompletionObjects();
635 
641  bool checkPreviewSupport();
642 
643 public slots:
647  // ### KDE4: make virtual
648  void back();
649 
653  // ### KDE4: make virtual
654  void forward();
655 
659  // ### KDE4: make virtual
660  void home();
661 
665  // ### KDE4: make virtual
666  void cdUp();
667 
671  void updateDir();
672 
676  // ### KDE4: make virtual
677  void rereadDir();
678 
682  // ### KDE4: make virtual
683  void mkdir();
684 
688  // ### KDE4: make virtual
689  void deleteSelected();
690 
696  void updateSelectionDependentActions();
697 
701  TQString makeCompletion(const TQString&);
702 
706  TQString makeDirCompletion(const TQString&);
707 
712  // ### KDE4: make virtual
713  void trashSelected(KAction::ActivationReason, TQt::ButtonState);
714 
715 protected slots:
720  void resetCursor();
721 
726  void pathChanged();
727 
732  void insertNewFiles(const KFileItemList &newone);
733 
738  void itemDeleted(KFileItem *);
739 
743  // ### KDE4: make virtual
744  void selectDir(const KFileItem *item );
745 
749  void selectFile(const KFileItem *item);
750 
754  void highlightFile(const KFileItem* i) { emit fileHighlighted( i ); }
755 
759  virtual void activatedMenu( const KFileItem *, const TQPoint& pos );
760 
764  void sortByName() { byNameAction->setChecked( true ); }
765 
769  void sortBySize() { bySizeAction->setChecked( true ); }
770 
774  void sortByDate() { byDateAction->setChecked( true ); }
775 
779  void sortReversed() { reverseAction->setChecked( !reverseAction->isChecked() ); }
780 
784  void toggleDirsFirst() { dirsFirstAction->setChecked( !dirsFirstAction->isChecked() ); }
785 
789  void toggleIgnoreCase() { caseInsensitiveAction->setChecked( !caseInsensitiveAction->isChecked() ); }
790 
795  void slotCompletionMatch(const TQString& match);
796 
797 signals:
798  void urlEntered(const KURL& );
799  void updateInformation(int files, int dirs);
800  void completion(const TQString&);
801  void finishedLoading();
802 
808  void viewChanged( KFileView * newView );
809 
815  void fileHighlighted( const KFileItem *item );
816  void dirActivated( const KFileItem *item );
817  void fileSelected( const KFileItem *item );
826  void dropped(const KFileItem *item, TQDropEvent*event, const KURL::List&urls);
827 private:
831  TQPtrStack<KURL> backStack;
832 
836  TQPtrStack<KURL> forwardStack;
837 
838  KDirLister *dir;
839  KURL currUrl;
840 
841  KCompletion myCompletion;
842  KCompletion myDirCompletion;
843  bool myCompleteListDirty;
844  TQDir::SortSpec mySorting;
845 
850  bool checkPreviewInternal() const;
851 
856  void checkPath(const TQString& txt, bool takeFiles = false);
857 
858  void connectView(KFileView *);
859 
860  bool openURL( const KURL& url, bool keep = false, bool reload = false );
861 
862  KFileView *m_fileView;
863  KFileItemList pendingMimeTypes;
864 
865  // the enum KFile::FileView as an int
866  int m_viewKind;
867  int defaultView;
868 
869  KFile::Mode myMode;
870  KProgress *progress;
871 
872  const TQWidget *myPreview; // temporary pointer for the preview widget
873 
874  // actions for the popupmenus
875  // ### clean up all those -- we have them all in the actionMenu!
876  KActionMenu *actionMenu;
877 
878  KAction *backAction;
879  KAction *forwardAction;
880  KAction *homeAction;
881  KAction *upAction;
882  KAction *reloadAction;
883  KActionSeparator *actionSeparator;
884  KAction *mkdirAction;
885 
886  KActionMenu *sortActionMenu;
887  KRadioAction *byNameAction;
888  KRadioAction *byDateAction;
889  KRadioAction *bySizeAction;
890  KToggleAction *reverseAction;
891  KToggleAction *dirsFirstAction;
892  KToggleAction *caseInsensitiveAction;
893 
894  KActionMenu *viewActionMenu;
895  KRadioAction *shortAction;
896  KRadioAction *detailedAction;
897  KToggleAction *showHiddenAction;
898  KToggleAction *separateDirsAction;
899 
900  KActionCollection *myActionCollection;
901  KActionCollection *viewActionCollection;
902 
903 private slots:
907  void slotDetailedView();
908  void slotSimpleView();
909  void slotToggleHidden( bool );
910 
911  void slotSeparateDirs();
912  void slotDefaultPreview();
913  void togglePreview( bool );
914 
915  void slotSortByName();
916  void slotSortBySize();
917  void slotSortByDate();
918  void slotSortReversed();
919  void slotToggleDirsFirst();
920  void slotToggleIgnoreCase();
921 
922  void slotStarted();
923  void slotProgress( int );
924  void slotShowProgress();
925  void slotIOFinished();
926  void slotCanceled();
927  void slotRedirected( const KURL& );
928 
929  void slotViewActionAdded( KAction * );
930  void slotViewActionRemoved( KAction * );
931  void slotViewSortingChanged( TQDir::SortSpec );
932 
933  void slotClearView();
934  void slotRefreshItems( const KFileItemList& items );
935 
936  void slotProperties();
937 
938  void insertViewDependentActions();
939 
940 private:
941  static bool isReadable( const KURL& url );
942 
943 protected:
944  virtual void virtual_hook( int id, void* data );
945 private:
946  class KDirOperatorPrivate;
947  KDirOperatorPrivate *d;
948 };
949 
950 #endif

kio/kfile

Skip menu "kio/kfile"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kio/kfile

Skip menu "kio/kfile"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kio/kfile by doxygen 1.8.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |