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 <QtGui/QWidget>
25#include <QtCore/QStack>
26#include <QtGui/QStyleOptionViewItem>
27
28#include <ktoggleaction.h>
29#include <kcompletion.h>
30#include <kdirlister.h>
31#include <kfileitem.h>
32#include <kfile.h>
33#include <kfile_export.h>
34
35class QAbstractItemView;
36class QModelIndex;
37class QProgressBar;
38
39class KAction;
40class KActionCollection;
41class KActionMenu;
42class KDirLister;
43class KPreviewWidgetBase;
44class KFilePreviewGenerator;
45
46namespace KIO
47{
48class CopyJob;
49class DeleteJob;
50}
51
52/**
53 * This widget works as a network transparent filebrowser. You specify a URL
54 * to display and this url will be loaded via KDirLister. The user can
55 * browse through directories, highlight and select files, delete or rename
56 * files.
57 *
58 * It supports different views, e.g. a detailed view (see KFileDetailView),
59 * a simple icon view (see KFileIconView), a combination of two views,
60 * separating directories and files ( KCombiView).
61 *
62 * Additionally, a preview view is available (see KFilePreview), which can
63 * show either a simple or detailed view and additionally a preview widget
64 * (see setPreviewWidget()). KImageFilePreview is one implementation
65 * of a preview widget, that displays previews for all supported filetypes
66 * utilizing KIO::PreviewJob.
67 *
68 * Currently, those classes don't support Drag&Drop out of the box -- there
69 * you have to use your own view-classes. You can use some DnD-aware views
70 * from Björn Sahlström <bjorn@kbear.org> until they will be integrated
71 * into this library. See http://devel-home.kde.org/~pfeiffer/DnD-classes.tar.gz
72 *
73 * This widget is the one used in the KFileDialog.
74 *
75 * Basic usage is like this:
76 * \code
77 * KDirOperator *op = new KDirOperator( KUrl( "file:/home/gis" ), this );
78 * // some signals you might be interested in
79 * connect(op, SIGNAL(urlEntered(const KUrl&)),
80 * SLOT(urlEntered(const KUrl&)));
81 * connect(op, SIGNAL(fileHighlighted(const KFileItem &)),
82 * SLOT(fileHighlighted(const KFileItem &)));
83 * connect(op, SIGNAL(fileSelected(const KFileItem &)),
84 * SLOT(fileSelected(const KFileItem &)));
85 * connect(op, SIGNAL(finishedLoading()),
86 * SLOT(slotLoadingFinished()));
87 *
88 * KConfigGroup grp(KGlobal::config(),"Your KDiroperator ConfigGroup" );
89 * op->readConfig( &grp);
90 * op->setView(KFile::Default);
91 * \endcode
92 *
93 * This will create a childwidget of 'this' showing the directory contents
94 * of /home/gis in the default-view. The view is determined by the readConfig()
95 * call, which will read the KDirOperator settings, the user left your program
96 * with (and which you saved with op->writeConfig()).
97 *
98 * @short A widget for displaying files and browsing directories.
99 * @author Stephan Kulow <coolo@kde.org>, Carsten Pfeiffer <pfeiffer@kde.org>
100 */
101class KFILE_EXPORT KDirOperator : public QWidget
102{
103 Q_OBJECT
104
105public:
106 /**
107 * The various action types. These values can be or'd together
108 */
109 enum ActionType
110 {
111 SortActions = 1,
112 ViewActions = 2,
113 NavActions = 4,
114 FileActions = 8,
115 AllActions = 15
116 };
117
118 /**
119 * Constructs the KDirOperator with no initial view. As the views are
120 * configurable, call readConfig() to load the user's configuration
121 * and then setView to explicitly set a view.
122 *
123 * This constructor doesn't start loading the url, setView will do it.
124 */
125 explicit KDirOperator(const KUrl& urlName = KUrl(),
126 QWidget *parent = 0);
127 /**
128 * Destroys the KDirOperator.
129 */
130 virtual ~KDirOperator();
131
132 /**
133 * Enables/disables showing hidden files.
134 */
135 virtual void setShowHiddenFiles(bool s);
136
137 /**
138 * @returns true when hidden files are shown or false otherwise.
139 */
140 bool showHiddenFiles() const;
141
142 /**
143 * Stops loading immediately. You don't need to call this, usually.
144 */
145 void close();
146
147 /**
148 * Sets a filter like "*.cpp *.h *.o". Only files matching that filter
149 * will be shown.
150 *
151 * @see KDirLister::setNameFilter
152 * @see nameFilter
153 */
154 void setNameFilter(const QString& filter);
155
156 /**
157 * @returns the current namefilter.
158 * @see setNameFilter
159 */
160 QString nameFilter() const;
161
162 /**
163 * Sets a list of mimetypes as filter. Only files of those mimetypes
164 * will be shown.
165 *
166 * Example:
167 * \code
168 * QStringList filter;
169 * filter << "text/html" << "image/png" << "inode/directory";
170 * dirOperator->setMimefilter( filter );
171 * \endcode
172 *
173 * Node: Without the mimetype inode/directory, only files would be shown.
174 * Call updateDir() to apply it.
175 *
176 * @see KDirLister::setMimeFilter
177 * @see mimeFilter
178 */
179 void setMimeFilter(const QStringList& mimetypes);
180
181 /**
182 * @returns the current mime filter.
183 */
184 QStringList mimeFilter() const;
185
186 /**
187 * Only show the files in a given set of mimetypes.
188 * This is useful in specialized applications (while file managers, on
189 * the other hand, want to show all mimetypes). Internally uses
190 * KNewFileMenu::setSupportedMimeTypes
191 *
192 * Example:
193 * \code
194 * QStringList mimeTypes;
195 * mimeTypes << "text/html" << "inode/directory";
196 * dirOperator->setNewFileMenuSupportedMimeTypes(mimeTypes);
197 * \endcode
198 *
199 * Note: If the list is empty, all options will be shown. Otherwise,
200 * without the mimetype inode/directory, only file options will be shown.
201 *
202 * @see KNewFileMenu::setSupportedMimeTypes
203 * @see newFileMenuSupportedMimeTypes
204 * @since 4.5
205 */
206 void setNewFileMenuSupportedMimeTypes(const QStringList& mime);
207
208 /**
209 * @returns the current Supported Mimes Types.
210 * @since 4.5
211 */
212 QStringList newFileMenuSupportedMimeTypes() const;
213
214 /**
215 * Clears both the namefilter and mimetype filter, so that all files and
216 * directories will be shown. Call updateDir() to apply it.
217 *
218 * @see setMimeFilter
219 * @see setNameFilter
220 */
221 void clearFilter();
222
223 /**
224 * @returns the current url
225 */
226 KUrl url() const;
227
228 /**
229 * Sets a new url to list.
230 * @param clearforward specifies whether the "forward" history should be cleared.
231 * @param url the URL to set
232 */
233 virtual void setUrl(const KUrl& url, bool clearforward);
234
235 /**
236 * Clears the current selection and attempts to set @p url
237 * the current url file. Note that urls can be relative or
238 * absolute.
239 */
240 void setCurrentItem(const QString& url);
241
242 /**
243 * Clears the current selection and attempts to set @p item
244 * as the current item.
245 */
246 void setCurrentItem(const KFileItem& item);
247
248 /**
249 * Clears the current selection and attempts to set @p urls
250 * the current url files. Note that urls can be relative or
251 * absolute.
252 * @since 4.2
253 */
254 void setCurrentItems(const QStringList& urls);
255
256 /**
257 * Clears the current selection and attempts to set @p items
258 * as the current items.
259 * @since 4.2
260 */
261 void setCurrentItems(const KFileItemList& items);
262
263 /**
264 * Sets a new view to be used for showing and browsing files.
265 * Note: this will read the current url() to fill the view.
266 *
267 * @see KFileTreeView
268 * @see view
269 */
270 virtual void setView(QAbstractItemView *view);
271
272 /**
273 * @returns the currently used view.
274 * @see setView
275 */
276 QAbstractItemView* view() const;
277
278 /**
279 * Sets one of the predefined fileviews.
280 * @see KFile::FileView
281 */
282 virtual void setView(KFile::FileView viewKind);
283
284 /**
285 * Sets the way to sort files and directories.
286 */
287 void setSorting(QDir::SortFlags);
288
289 /**
290 * @returns the current way of sorting files and directories
291 */
292 QDir::SortFlags sorting() const;
293
294 /**
295 * @returns true if we are displaying the root directory of the current url
296 */
297 bool isRoot() const;
298
299 /**
300 * @returns the object listing the directory
301 */
302 KDirLister* dirLister() const;
303
304 /**
305 * @returns the progress widget, that is shown during directory listing.
306 * You can for example reparent() it to put it into a statusbar.
307 */
308 QProgressBar* progressBar() const;
309
310 /**
311 * Sets the listing/selection mode for the views, an OR'ed combination of
312 * @li File
313 * @li Directory
314 * @li Files
315 * @li ExistingOnly
316 * @li LocalOnly
317 *
318 * You cannot mix File and Files of course, as the former means
319 * single-selection mode, the latter multi-selection.
320 */
321 virtual void setMode(KFile::Modes m);
322 /**
323 * @returns the listing/selection mode.
324 */
325 KFile::Modes mode() const;
326
327 /**
328 * Sets a preview-widget to be shown next to the file-view.
329 * The ownership of @p w is transferred to KDirOperator, so don't
330 * delete it yourself!
331 */
332 virtual void setPreviewWidget(KPreviewWidgetBase *w);
333
334 /**
335 * @returns a list of all currently selected items. If there is no view,
336 * or there are no selected items, an empty list is returned.
337 */
338 KFileItemList selectedItems() const;
339
340 /**
341 * @returns true if @p item is currently selected, or false otherwise.
342 */
343 bool isSelected(const KFileItem &item) const;
344
345 /**
346 * @returns the number of directories in the currently listed url.
347 * Returns 0 if there is no view.
348 */
349 int numDirs() const;
350
351 /**
352 * @returns the number of files in the currently listed url.
353 * Returns 0 if there is no view.
354 */
355 int numFiles() const;
356
357 /**
358 * @returns a KCompletion object, containing all filenames and
359 * directories of the current directory/URL.
360 * You can use it to insert it into a KLineEdit or KComboBox
361 * Note: it will only contain files, after prepareCompletionObjects()
362 * has been called. It will be implicitly called from makeCompletion()
363 * or makeDirCompletion()
364 */
365 KCompletion* completionObject() const;
366
367 /**
368 * @returns a KCompletion object, containing only all directories of the
369 * current directory/URL.
370 * You can use it to insert it into a KLineEdit or KComboBox
371 * Note: it will only contain directories, after
372 * prepareCompletionObjects() has been called. It will be implicitly
373 * called from makeCompletion() or makeDirCompletion()
374 */
375 KCompletion* dirCompletionObject() const;
376
377 /**
378 * an accessor to a collection of all available Actions. The actions
379 * are static, they will be there all the time (no need to connect to
380 * the signals KActionCollection::inserted() or removed().
381 *
382 * There are the following actions:
383 *
384 * @li popupMenu : an ActionMenu presenting a popupmenu with all actions
385 * @li up : changes to the parent directory
386 * @li back : goes back to the previous directory
387 * @li forward : goes forward in the history
388 * @li home : changes to the user's home directory
389 * @li reload : reloads the current directory
390 * @li mkdir : opens a dialog box to create a directory
391 * @li delete : deletes the selected files/directories
392 * @li sorting menu : an ActionMenu containing all sort-options
393 * @li by name : sorts by name
394 * @li by size : sorts by size
395 * @li by date : sorts by date
396 * @li by type : sorts by type
397 * @li descending : reverses the sort order
398 * @li view menu : an ActionMenu containing all actions concerning the view
399 * @li short view : shows a simple fileview
400 * @li detailed view : shows a detailed fileview (dates, permissions ,...)
401 * @li show hidden : shows hidden files
402 * @li preview : shows a preview next to the fileview
403 * @li properties : shows a KPropertiesDialog for the selected files
404 *
405 * The short and detailed view are in an exclusive group. The sort-by
406 * actions are in an exclusive group as well. Also the "separate dirs",
407 * "preview" and "single" actions are in an exclusive group.
408 *
409 * You can e.g. use
410 * \code
411 * actionCollection()->action( "up" )->plug( someToolBar );
412 * \endcode
413 * to add a button into a toolbar, which makes the dirOperator change to
414 * its parent directory.
415 *
416 * @returns all available Actions
417 */
418 KActionCollection* actionCollection() const;
419
420 /**
421 * Sets the config object and the to be used group in KDirOperator. This
422 * will be used to store the view's configuration.
423 * If you don't set this, the views cannot save and restore their
424 * configuration.
425 *
426 * Usually you call this right after KDirOperator creation so that the view
427 * instantiation can make use of it already.
428 *
429 * Note that KDirOperator does NOT take ownership of that object (typically
430 * it's KGlobal::config() anyway.
431 *
432 * You must not delete the KConfig or KConfigGroup object (and master config object) before
433 * either deleting the KDirOperator or calling setViewConfig(0); or something like that
434 *
435 * @see viewConfig
436 * @see viewConfigGroup
437 */
438 virtual void setViewConfig(KConfigGroup& configGroup);
439
440 /*
441 * @returns the group set by setViewConfig configuration.
442 */
443 KConfigGroup* viewConfigGroup() const;
444
445 /**
446 * Reads the default settings for a view, i.e. the default KFile::FileView.
447 * Also reads the sorting and whether hidden files should be shown.
448 * Note: the default view will not be set - you have to call
449 * \code
450 * setView( KFile::Default )
451 * \endcode
452 * to apply it.
453 *
454 * @see setView
455 * @see setViewConfig
456 * @see writeConfig
457 */
458 virtual void readConfig(const KConfigGroup& configGroup);
459
460 /**
461 * Saves the current settings like sorting, simple or detailed view.
462 *
463 * @see readConfig
464 * @see setViewConfig
465 */
466 virtual void writeConfig(KConfigGroup& configGroup);
467
468 /**
469 * This toggles between double/single click file and directory selection mode.
470 * When argument is true, files and directories are highlighted with single click and
471 * selected (executed) with double click.
472 *
473 * NOTE: this is not implemented in KDE 4 yet
474 *
475 * The default follows the signle/double click system setting.
476 */
477 void setOnlyDoubleClickSelectsFiles(bool enable);
478
479 /**
480 * @returns whether files (not directories) should only be select()ed by
481 * double-clicks.
482 * @see setOnlyDoubleClickSelectsFiles
483 */
484 bool onlyDoubleClickSelectsFiles() const;
485
486 /**
487 * Creates the given directory/url. If it is a relative path,
488 * it will be completed with the current directory.
489 * If enterDirectory is true, the directory will be entered after a
490 * successful operation. If unsuccessful, a messagebox will be presented
491 * to the user.
492 * @returns true if the directory could be created.
493 */
494 virtual bool mkdir(const QString& directory, bool enterDirectory = true);
495
496 /**
497 * Starts and returns a KIO::DeleteJob to delete the given @p items.
498 *
499 * @param items the list of items to be deleted
500 * @param parent the parent widget used for the confirmation dialog
501 * @param ask specifies whether a confirmation dialog should be shown
502 * @param showProgress passed to the DeleteJob to show a progress dialog
503 */
504 virtual KIO::DeleteJob* del(const KFileItemList& items, QWidget *parent = 0,
505 bool ask = true, bool showProgress = true);
506
507 /**
508 * Clears the forward and backward history.
509 */
510 void clearHistory();
511
512 /**
513 * When going up in the directory hierarchy, KDirOperator can highlight
514 * the directory that was just left.
515 *
516 * I.e. when you go from /home/gis/src to /home/gis, the item "src" will
517 * be made the current item.
518 *
519 * Default is off.
520 */
521 virtual void setEnableDirHighlighting(bool enable);
522
523 /**
524 * @returns whether the last directory will be made the current item
525 * when going up in the directory hierarchy.
526 *
527 * Default is false.
528 */
529 bool dirHighlighting() const;
530
531 /**
532 * @returns true if we are in directory-only mode, that is, no files are
533 * shown.
534 */
535 bool dirOnlyMode() const;
536
537 static bool dirOnlyMode(uint mode);
538
539 /**
540 * Sets up the action menu.
541 * @param whichActions is an value of OR'd ActionTypes that controls which actions to show in the action menu
542 */
543 void setupMenu(int whichActions);
544
545 /**
546 * Reimplemented - allow dropping of files if @p b is true
547 * @param b true if the widget should allow dropping of files
548 */
549 virtual void setAcceptDrops(bool b);
550
551 /**
552 * Sets the options for dropping files.
553 * CURRENTLY NOT IMPLEMENTED
554 */
555 virtual void setDropOptions(int options);
556
557 /**
558 * Starts and returns a KIO::CopyJob to trash the given @p items.
559 *
560 * @param items the list of items to be trashed
561 * @param parent the parent widget used for the confirmation dialog
562 * @param ask specifies whether a confirmation dialog should be shown
563 * @param showProgress passed to the CopyJob to show a progress dialog
564 */
565 virtual KIO::CopyJob* trash(const KFileItemList& items, QWidget *parent,
566 bool ask = true, bool showProgress = true);
567
568 /**
569 * Returns the preview generator for the current view.
570 * @since 4.2
571 */
572 KFilePreviewGenerator *previewGenerator() const;
573
574 /**
575 * Forces the inline previews to be shown or hidden, depending on @p show.
576 *
577 * @param show Whether to show inline previews or not.
578 * @since 4.2
579 */
580 void setInlinePreviewShown(bool show);
581
582 /**
583 * Returns the position where icons are shown relative to the labels
584 * of file items in the icon view.
585 * @since 4.2.3
586 */
587 QStyleOptionViewItem::Position decorationPosition() const;
588
589 /**
590 * Sets the position where icons shall be shown relative to the labels
591 * of file items in the icon view.
592 * @since 4.2.3
593 */
594 void setDecorationPosition(QStyleOptionViewItem::Position position);
595
596 /**
597 * Returns whether the inline previews are shown or not.
598 * @since 4.2
599 */
600 bool isInlinePreviewShown() const;
601
602 /**
603 * Returns the icon zoom.
604 * @since 4.2
605 */
606 int iconsZoom() const;
607
608 /**
609 * If the system is set up to trigger items on single click, if @p isSaving
610 * is true, we will force to double click to accept.
611 * @note this is false by default
612 * @since 4.2
613 */
614 void setIsSaving(bool isSaving);
615
616 /**
617 * Returns whether KDirOperator will force a double click to accept.
618 * @note this is false by default
619 * @since 4.2
620 */
621 bool isSaving() const;
622
623protected:
624 /**
625 * A view factory for creating predefined fileviews. Called internally by setView,
626 * but you can also call it directly. Reimplement this if you depend on self defined fileviews.
627 * @param parent is the QWidget to be set as parent
628 * @param viewKind is the predefined view to be set, note: this can be several ones OR:ed together
629 * @returns the created view
630 * @see KFile::FileView
631 * @see setView
632 */
633 virtual QAbstractItemView* createView(QWidget *parent, KFile::FileView viewKind);
634
635 /**
636 * Sets a custom KDirLister to list directories.
637 * The KDirOperator takes ownership of the given KDirLister.
638 */
639 virtual void setDirLister(KDirLister *lister);
640
641 virtual void resizeEvent(QResizeEvent *event);
642
643 virtual void keyPressEvent(QKeyEvent * event);
644
645 /**
646 * Sets up all the actions. Called from the constructor, you usually
647 * better not call this.
648 */
649 void setupActions();
650
651 /**
652 * Updates the sorting-related actions to comply with the current sorting
653 * @see sorting
654 */
655 void updateSortActions();
656
657 /**
658 * Updates the view-related actions to comply with the current
659 * KFile::FileView
660 */
661 void updateViewActions();
662
663 /**
664 * Sets up the context-menu with all the necessary actions. Called from the
665 * constructor, you usually don't need to call this.
666 */
667 void setupMenu();
668
669 /**
670 * Synchronizes the completion objects with the entries of the
671 * currently listed url.
672 *
673 * Automatically called from makeCompletion() and
674 * makeDirCompletion()
675 */
676 void prepareCompletionObjects();
677
678 /**
679 * Checks if there support from KIO::PreviewJob for the currently
680 * shown files, taking mimeFilter() and nameFilter() into account
681 * Enables/disables the preview-action accordingly.
682 */
683 bool checkPreviewSupport();
684
685 /**
686 * Called upon right-click to activate the popupmenu.
687 */
688 virtual void activatedMenu(const KFileItem &item, const QPoint &pos);
689
690 virtual void changeEvent(QEvent *event);
691
692 virtual bool eventFilter(QObject *watched, QEvent *event);
693
694public Q_SLOTS:
695 /**
696 * Goes one step back in the history and opens that url.
697 */
698 virtual void back();
699
700 /**
701 * Goes one step forward in the history and opens that url.
702 */
703 virtual void forward();
704
705 /**
706 * Enters the home directory.
707 */
708 virtual void home();
709
710 /**
711 * Goes one directory up from the current url.
712 */
713 virtual void cdUp();
714
715 /**
716 * to update the view after changing the settings
717 */
718 void updateDir();
719
720 /**
721 * Re-reads the current url.
722 */
723 virtual void rereadDir();
724
725 /**
726 * Opens a dialog to create a new directory.
727 */
728 virtual void mkdir();
729
730 /**
731 * Deletes the currently selected files/directories.
732 */
733 virtual void deleteSelected();
734
735 /**
736 * Enables/disables actions that are selection dependent. Call this e.g.
737 * when you are about to show a popup menu using some of KDirOperators
738 * actions.
739 */
740 void updateSelectionDependentActions();
741
742 /**
743 * Tries to complete the given string (only completes files).
744 */
745 QString makeCompletion(const QString&);
746
747 /**
748 * Tries to complete the given string (only completes directores).
749 */
750 QString makeDirCompletion(const QString&);
751
752 /**
753 * Trashes the currently selected files/directories.
754 *
755 * This function used to take activation reason and keyboard modifiers,
756 * in order to call deleteSelected() if the user wanted to delete.
757 * Instead, call deleteSelected().
758 *
759 * FIXME KAction Port: link deleteSelected() up correctly
760 */
761 virtual void trashSelected();
762
763 /**
764 * Notifies that the icons size should change. @p value is an int ranged from 0 to 100.
765 * 100 means KIconLoader::SizeEnormous.
766 * @since 4.2
767 */
768 void setIconsZoom(int value);
769
770protected Q_SLOTS:
771 /**
772 * Restores the normal cursor after showing the busy-cursor. Also hides
773 * the progressbar.
774 */
775 void resetCursor();
776
777 /**
778 * Called after setUrl() to load the directory, update the history,
779 * etc.
780 */
781 void pathChanged();
782
783 /**
784 * Enters the directory specified by the given @p item.
785 */
786 virtual void selectDir(const KFileItem &item);
787
788 /**
789 * Emits fileSelected( item )
790 */
791 void selectFile(const KFileItem &item);
792
793 /**
794 * Emits fileHighlighted(item)
795 */
796 void highlightFile(const KFileItem &item);
797
798 /**
799 * Changes sorting to sort by name
800 */
801 void sortByName();
802
803 /**
804 * Changes sorting to sort by size
805 */
806 void sortBySize();
807
808 /**
809 * Changes sorting to sort by date
810 */
811 void sortByDate();
812
813 /**
814 * Changes sorting to sort by date
815 */
816 void sortByType();
817
818 /**
819 * Changes sorting to reverse sorting
820 */
821 void sortReversed();
822
823 /**
824 * Toggles showing directories first / having them sorted like files.
825 */
826 void toggleDirsFirst();
827
828 /**
829 * Toggles case sensitive / case insensitive sorting
830 */
831 void toggleIgnoreCase();
832
833 /**
834 * Tries to make the given @p match as current item in the view and emits
835 * completion( match )
836 */
837 void slotCompletionMatch(const QString &match);
838
839Q_SIGNALS:
840 void urlEntered(const KUrl&);
841 void updateInformation(int files, int dirs);
842 void completion(const QString&);
843 void finishedLoading();
844
845 /**
846 * Emitted whenever the current fileview is changed, either by an explicit
847 * call to setView() or by the user selecting a different view thru
848 * the GUI.
849 */
850 void viewChanged(QAbstractItemView *newView);
851
852 /**
853 * Emitted when a file is highlighted or generally the selection changes in
854 * multiselection mode. In the latter case, @p item is 0L. You can access
855 * the selected items with selectedItems().
856 */
857 void fileHighlighted(const KFileItem &item);
858 void dirActivated(const KFileItem &item);
859 void fileSelected(const KFileItem &item);
860 /**
861 * Emitted when files are dropped. Dropping files is disabled by
862 * default. You need to enable it with setAcceptDrops()
863 * @param item the item on which the drop occurred or 0.
864 * @param event the drop event itself.
865 * @param urls the urls that where dropped.
866 */
867 void dropped(const KFileItem &item, QDropEvent *event, const KUrl::List &urls);
868
869 /**
870 * Emitted just before the context menu is shown, allows users to
871 * extend the menu with custom actions.
872 *
873 * @param item the file on which the context menu was invoked
874 * @param menu the context menu, pre-populated with the file-management actions
875 * @since 4.2
876 */
877 void contextMenuAboutToShow(const KFileItem& item, QMenu* menu);
878
879 /**
880 * Will notify that the icon size has changed. Since we save the icon size depending
881 * on the view type (list view or a different kind of view), a call to setView() can
882 * trigger this signal to be emitted.
883 * @since 4.2
884 */
885 void currentIconSizeChanged(int size);
886
887private:
888 class Private;
889 Private* const d;
890
891 Q_PRIVATE_SLOT( d, void _k_slotDetailedView() )
892 Q_PRIVATE_SLOT( d, void _k_slotSimpleView() )
893 Q_PRIVATE_SLOT( d, void _k_slotTreeView() )
894 Q_PRIVATE_SLOT( d, void _k_slotDetailedTreeView() )
895 Q_PRIVATE_SLOT( d, void _k_slotToggleHidden(bool) )
896 Q_PRIVATE_SLOT( d, void _k_togglePreview(bool) )
897 Q_PRIVATE_SLOT( d, void _k_toggleInlinePreviews(bool) )
898 Q_PRIVATE_SLOT( d, void _k_slotOpenFileManager() )
899 Q_PRIVATE_SLOT( d, void _k_slotSortByName() )
900 Q_PRIVATE_SLOT( d, void _k_slotSortBySize() )
901 Q_PRIVATE_SLOT( d, void _k_slotSortByDate() )
902 Q_PRIVATE_SLOT( d, void _k_slotSortByType() )
903 Q_PRIVATE_SLOT( d, void _k_slotSortReversed(bool) )
904 Q_PRIVATE_SLOT( d, void _k_slotToggleDirsFirst() )
905 Q_PRIVATE_SLOT( d, void _k_slotToggleIgnoreCase() )
906 Q_PRIVATE_SLOT( d, void _k_slotStarted() )
907 Q_PRIVATE_SLOT( d, void _k_slotProgress(int) )
908 Q_PRIVATE_SLOT( d, void _k_slotShowProgress() )
909 Q_PRIVATE_SLOT( d, void _k_slotIOFinished() )
910 Q_PRIVATE_SLOT( d, void _k_slotCanceled() )
911 Q_PRIVATE_SLOT( d, void _k_slotRedirected(const KUrl&) )
912 Q_PRIVATE_SLOT( d, void _k_slotProperties() )
913 Q_PRIVATE_SLOT( d, void _k_slotActivated(const QModelIndex&) )
914 Q_PRIVATE_SLOT( d, void _k_slotSelectionChanged() )
915 Q_PRIVATE_SLOT( d, void _k_openContextMenu(const QPoint&) )
916 Q_PRIVATE_SLOT( d, void _k_triggerPreview(const QModelIndex&) )
917 Q_PRIVATE_SLOT( d, void _k_showPreview() )
918 Q_PRIVATE_SLOT( d, void _k_slotSplitterMoved(int, int) )
919 Q_PRIVATE_SLOT( d, void _k_assureVisibleSelection() )
920 Q_PRIVATE_SLOT( d, void _k_synchronizeSortingState(int, Qt::SortOrder) )
921 Q_PRIVATE_SLOT( d, void _k_slotChangeDecorationPosition() )
922 Q_PRIVATE_SLOT( d, void _k_slotExpandToUrl(const QModelIndex&) )
923 Q_PRIVATE_SLOT( d, void _k_slotItemsChanged() )
924 Q_PRIVATE_SLOT( d, void _k_slotDirectoryCreated(const KUrl&) )
925};
926
927#endif
928