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

KIO

  • 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
35class KAbstractFileWidget;
36class KFileWidget;
37
38class KActionCollection;
39class KUrlComboBox;
40class KFileFilterCombo;
41class KPushButton;
42class KToolBar;
43class KPreviewWidgetBase;
44
45class KFileDialogPrivate;
46
68class KIO_EXPORT KFileDialog : public KDialog
69{
70 Q_OBJECT
71
72public:
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
753public Q_SLOTS:
754 int exec();
755#endif
756
757Q_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
806protected:
810 virtual void keyPressEvent( QKeyEvent *e );
811
815 virtual void hideEvent( QHideEvent *event );
816
817protected Q_SLOTS:
818 virtual void slotOk();
819 virtual void accept();
820 virtual void slotCancel();
821
822private:
823 Q_DISABLE_COPY(KFileDialog)
824
825 KFileDialogPrivate * const d;
826};
827
828#endif
KAbstractFileWidget
Base class for KFileWidget.
Definition: kabstractfilewidget.h:58
KActionCollection
KDialog
KFileDialog
Provides a user (and developer) friendly way to select files and directories.
Definition: kfiledialog.h:69
KFileDialog::filterChanged
void filterChanged(const QString &filter)
Emitted when the filter changed, i.e.
KFileDialog::fileSelected
void fileSelected(const KUrl &)
Emitted when the user selects a file.
KFileDialog::fileHighlighted
void fileHighlighted(const KUrl &)
Emitted when the user highlights a file.
KFileDialog::selectionChanged
void selectionChanged()
Emitted when the user hilights one or more files in multiselection mode.
KFileDialog::OperationMode
OperationMode
Defines some default behavior of the filedialog.
Definition: kfiledialog.h:85
KFileDialog::Opening
@ Opening
Definition: kfiledialog.h:85
KFileDialog::Option
Option
Defines the options to use when calling getSave* functions.
Definition: kfiledialog.h:91
KFileDialog::fileHighlighted
QT_MOC_COMPAT void fileHighlighted(const QString &)
KFileDialog::fileSelected
QT_MOC_COMPAT void fileSelected(const QString &)
KPreviewWidgetBase
Abstract baseclass for all preview widgets which shall be used via KFileDialog::setPreviewWidget(cons...
Definition: kpreviewwidgetbase.h:44
KPushButton
KSharedPtr< KMimeType >
KToolBar
KUrlComboBox
This combobox shows a number of recent URLs/directories, as well as some default directories.
Definition: kurlcombobox.h:48
KUrl::List
KUrl
QWidget
kdialog.h
kfile.h
kmimetype.h
kurl.h
Other
Other
Option
Option
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
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