• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KIO

  • sources
  • kde-4.14
  • kdelibs
  • kio
  • kfile
kfiledialog.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 /* This file is part of the KDE libraries
3  Copyright (C) 1997, 1998 Richard Moore <rich@kde.org>
4  1998 Stephan Kulow <coolo@kde.org>
5  1998 Daniel Grana <grana@ie.iwi.unibe.ch>
6  2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
7  2001 Frerich Raabe <raabe@kde.org>
8  2007 David Faure <faure@kde.org>
9  2009 David Jarvie <djarvie@kde.org>
10 
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Library General Public
13  License as published by the Free Software Foundation; either
14  version 2 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Library General Public License for more details.
20 
21  You should have received a copy of the GNU Library General Public License
22  along with this library; see the file COPYING.LIB. If not, write to
23  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24  Boston, MA 02110-1301, USA.
25 */
26 
27 #ifndef KFILEDIALOG_H
28 #define KFILEDIALOG_H
29 
30 #include <kdialog.h>
31 #include <kfile.h>
32 #include <kurl.h>
33 #include <kmimetype.h>
34 
35 class KAbstractFileWidget;
36 class KFileWidget;
37 
38 class KActionCollection;
39 class KUrlComboBox;
40 class KFileFilterCombo;
41 class KPushButton;
42 class KToolBar;
43 class KPreviewWidgetBase;
44 
45 class KFileDialogPrivate;
46 
68 class KIO_EXPORT KFileDialog : public KDialog
69 {
70  Q_OBJECT
71 
72 public:
73 
85  enum OperationMode { Other = 0, Opening, Saving };
86 
91  enum Option {
92  ConfirmOverwrite = 0x01,
93  ShowInlinePreview = 0x02
94  };
95  Q_DECLARE_FLAGS(Options, Option)
96 
97 
121  KFileDialog( const KUrl& startDir, const QString& filter,
122  QWidget *parent, QWidget* widget = 0 );
123 
124 
128  ~KFileDialog();
129 
133  KUrl selectedUrl() const;
134 
138  KUrl::List selectedUrls() const;
139 
143  KUrl baseUrl() const;
144 
149  QString selectedFile() const;
150 
154  QStringList selectedFiles() const;
155 
163  void setUrl(const KUrl &url, bool clearforward = true);
164 
170  void setSelection(const QString& name);
171 
189  void setOperationMode( KFileDialog::OperationMode );
190 
198  OperationMode operationMode() const;
199 
211  void setKeepLocation( bool keep );
212 
217  bool keepsLocation() const;
218 
266  void setFilter(const QString& filter);
267 
275  QString currentFilter() const;
276 
285  KMimeType::Ptr currentFilterMimeType();
286 
298  void setMimeFilter( const QStringList& types,
299  const QString& defaultType = QString() );
300 
309  QString currentMimeFilter() const;
310 
314  void clearFilter();
315 
327  void setPreviewWidget(KPreviewWidgetBase *w);
328 
335  void setInlinePreviewShown(bool show);
336 
346  void setConfirmOverwrite(bool enable);
347 
349  virtual QSize sizeHint() const;
350 
370  static QString getOpenFileName( const KUrl& startDir= KUrl(),
371  const QString& filter= QString(),
372  QWidget *parent= 0,
373  const QString& caption = QString() );
374 
375 
382  static QString getOpenFileNameWId( const KUrl& startDir,
383  const QString& filter,
384  WId parent_id, const QString& caption );
385 
405  static QStringList getOpenFileNames( const KUrl& startDir= KUrl(),
406  const QString& filter = QString(),
407  QWidget *parent = 0,
408  const QString& caption= QString() );
409 
410 
411 
431  static KUrl getOpenUrl( const KUrl& startDir = KUrl(),
432  const QString& filter = QString(),
433  QWidget *parent= 0,
434  const QString& caption = QString() );
435 
436 
437 
457  static KUrl::List getOpenUrls( const KUrl& startDir = KUrl(),
458  const QString& filter = QString(),
459  QWidget *parent = 0,
460  const QString& caption = QString() );
461 
462 
463 
483  static QString getSaveFileName( const KUrl& startDir = KUrl(),
484  const QString& filter = QString(),
485  QWidget *parent = 0,
486  const QString& caption = QString() );
487 
510  static QString getSaveFileName( const KUrl& startDir,
511  const QString& filter,
512  QWidget *parent,
513  const QString& caption,
514  Options options );
515 
516 
521  static QString getSaveFileNameWId( const KUrl &startDir, const QString& filter,
522  WId parent_id,
523  const QString& caption );
524 
531  static QString getSaveFileNameWId( const KUrl &startDir, const QString& filter,
532  WId parent_id,
533  const QString& caption,
534  Options options );
535 
555  static KUrl getSaveUrl( const KUrl& startDir = KUrl(),
556  const QString& filter = QString(),
557  QWidget *parent = 0,
558  const QString& caption = QString() );
559 
582  static KUrl getSaveUrl( const KUrl& startDir,
583  const QString& filter,
584  QWidget *parent,
585  const QString& caption,
586  Options options );
587 
588 
602  static QString getExistingDirectory( const KUrl& startDir = KUrl(),
603  QWidget * parent = 0,
604  const QString& caption= QString() );
605 
620  static KUrl getExistingDirectoryUrl( const KUrl& startDir = KUrl(),
621  QWidget * parent = 0,
622  const QString& caption= QString() );
623 
636  static KUrl getImageOpenUrl( const KUrl& startDir = KUrl(),
637  QWidget *parent = 0,
638  const QString& caption = QString() );
639 
661  void setMode( KFile::Modes m );
662 
667  KFile::Modes mode() const;
668 
676  void setLocationLabel(const QString& text);
677 
682  KAbstractFileWidget* fileWidget();
683 
696  KToolBar *toolBar() const;
697 
702  KPushButton *okButton() const;
703 
708  KPushButton *cancelButton() const;
709 
714  KUrlComboBox *locationEdit() const;
715 
720  KFileFilterCombo *filterWidget() const;
721 
725  KActionCollection *actionCollection() const;
726 
744  static KUrl getStartUrl( const KUrl& startDir, QString& recentDirClass );
745 
750  static void setStartDir( const KUrl& directory );
751 
752 #ifdef Q_WS_WIN
753 public Q_SLOTS:
754  int exec();
755 #endif
756 
757 Q_SIGNALS:
767  void fileSelected(const KUrl&);
771  QT_MOC_COMPAT void fileSelected(const QString&); // TODO KDE5: remove
772 
778  void fileHighlighted(const KUrl&);
782  QT_MOC_COMPAT void fileHighlighted(const QString&); // TODO KDE5: remove
783 
792  void selectionChanged();
793 
804  void filterChanged( const QString& filter );
805 
806 protected:
810  virtual void keyPressEvent( QKeyEvent *e );
811 
815  virtual void hideEvent( QHideEvent *event );
816 
817 protected Q_SLOTS:
818  virtual void slotOk();
819  virtual void accept();
820  virtual void slotCancel();
821 
822 private:
823  Q_DISABLE_COPY(KFileDialog)
824 
825  KFileDialogPrivate * const d;
826 };
827 
828 #endif
QHideEvent
kdialog.h
KPushButton
QWidget
KActionCollection
kmimetype.h
kurl.h
kfile.h
KFile
KFile is a class which provides a namespace for some enumerated values associated with the kfile libr...
Definition: kfile.h:31
KMimeType
QDialog::exec
int exec()
KDialog
KUrl
KUrlComboBox
This combobox shows a number of recent URLs/directories, as well as some default directories.
Definition: kurlcombobox.h:47
KFileDialog
Provides a user (and developer) friendly way to select files and directories.
Definition: kfiledialog.h:68
KAbstractFileWidget
Base class for KFileWidget.
Definition: kabstractfilewidget.h:57
QWidget::hideEvent
virtual void hideEvent(QHideEvent *event)
QString
QDialog::accept
virtual void accept()
QStringList
KImageIO::types
QStringList types(Mode mode=Writing)
Returns a list of all KImageIO supported formats.
Definition: kimageio.cpp:82
Other
QSize
KFileDialog::OperationMode
OperationMode
Defines some default behavior of the filedialog.
Definition: kfiledialog.h:85
QDialog::keyPressEvent
virtual void keyPressEvent(QKeyEvent *e)
QKeyEvent
KToolBar
KPreviewWidgetBase
Abstract baseclass for all preview widgets which shall be used via KFileDialog::setPreviewWidget(cons...
Definition: kpreviewwidgetbase.h:43
KFileDialog::Option
Option
Defines the options to use when calling getSave* functions.
Definition: kfiledialog.h:91
Option
Option
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal