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

KIO

kfiledialog.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 /* This file is part of the KDE libraries
00003     Copyright (C) 1997, 1998 Richard Moore <rich@kde.org>
00004                   1998 Stephan Kulow <coolo@kde.org>
00005                   1998 Daniel Grana <grana@ie.iwi.unibe.ch>
00006                   2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
00007                   2001 Frerich Raabe <raabe@kde.org>
00008                   2007 David Faure <faure@kde.org>
00009 
00010     This library is free software; you can redistribute it and/or
00011     modify it under the terms of the GNU Library General Public
00012     License as published by the Free Software Foundation; either
00013     version 2 of the License, or (at your option) any later version.
00014 
00015     This library is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018     Library General Public License for more details.
00019 
00020     You should have received a copy of the GNU Library General Public License
00021     along with this library; see the file COPYING.LIB.  If not, write to
00022     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00023     Boston, MA 02110-1301, USA.
00024 */
00025 
00026 #ifndef KFILEDIALOG_H
00027 #define KFILEDIALOG_H
00028 
00029 #include <kdialog.h>
00030 #include <kfile.h>
00031 #include <kurl.h>
00032 #include <kmimetype.h>
00033 
00034 class KAbstractFileWidget;
00035 class KFileWidget;
00036 
00037 class KActionCollection;
00038 class KUrlComboBox;
00039 class KFileFilterCombo;
00040 class KPushButton;
00041 class KToolBar;
00042 class KPreviewWidgetBase;
00043 
00044 class KFileDialogPrivate;
00045 
00067 class KIO_EXPORT KFileDialog : public KDialog
00068 {
00069     Q_OBJECT
00070 
00071 public:
00072 
00084     enum OperationMode { Other = 0, Opening, Saving };
00085 
00113     KFileDialog( const KUrl& startDir, const QString& filter,
00114                  QWidget *parent, QWidget* widget = 0 );
00115 
00116 
00120     ~KFileDialog();
00121 
00125     KUrl selectedUrl() const;
00126 
00130     KUrl::List selectedUrls() const;
00131 
00135     KUrl baseUrl() const;
00136 
00141     QString selectedFile() const;
00142 
00146     QStringList selectedFiles() const;
00147 
00155     void setUrl(const KUrl &url, bool clearforward = true);
00156 
00162     void setSelection(const QString& name);
00163 
00181     void setOperationMode( KFileDialog::OperationMode );
00182 
00190     OperationMode operationMode() const;
00191 
00203     void setKeepLocation( bool keep );
00204 
00209     bool keepsLocation() const;
00210 
00245     void setFilter(const QString& filter);
00246 
00254     QString currentFilter() const;
00255 
00264     KMimeType::Ptr currentFilterMimeType();
00265 
00277     void setMimeFilter( const QStringList& types,
00278                         const QString& defaultType = QString() );
00279 
00288     QString currentMimeFilter() const;
00289 
00293     void clearFilter();
00294 
00306     void setPreviewWidget(KPreviewWidgetBase *w);
00307 
00314     void setInlinePreviewShown(bool show);
00315 
00325     void setConfirmOverwrite(bool enable);
00326 
00328     virtual QSize sizeHint() const;
00329 
00355     static QString getOpenFileName( const KUrl& startDir= KUrl(),
00356                                     const QString& filter= QString(),
00357                                     QWidget *parent= 0,
00358                                     const QString& caption = QString() );
00359 
00360 
00367    static QString getOpenFileNameWId( const KUrl& startDir,
00368                                       const QString& filter,
00369                                       WId parent_id, const QString& caption );
00370 
00396     static QStringList getOpenFileNames( const KUrl& startDir= KUrl(),
00397                                          const QString& filter = QString(),
00398                                          QWidget *parent = 0,
00399                                          const QString& caption= QString() );
00400 
00401 
00402 
00428     static KUrl getOpenUrl( const KUrl& startDir = KUrl(),
00429                             const QString& filter = QString(),
00430                             QWidget *parent= 0,
00431                             const QString& caption = QString() );
00432 
00433 
00434 
00460     static KUrl::List getOpenUrls( const KUrl& startDir = KUrl(),
00461                                    const QString& filter = QString(),
00462                                    QWidget *parent = 0,
00463                                    const QString& caption = QString() );
00464 
00465 
00466 
00492     static QString getSaveFileName( const KUrl& startDir = KUrl(),
00493                                     const QString& filter = QString(),
00494                                     QWidget *parent = 0,
00495                                     const QString& caption = QString() );
00496 
00497 
00502     static QString getSaveFileNameWId( const KUrl &startDir, const QString& filter,
00503                                        WId parent_id,
00504                                        const QString& caption );
00505 
00531     static KUrl getSaveUrl( const KUrl& startDir = KUrl(),
00532                             const QString& filter = QString(),
00533                             QWidget *parent = 0,
00534                             const QString& caption = QString() );
00535 
00536 
00556     static QString getExistingDirectory( const KUrl& startDir = KUrl(),
00557                                          QWidget * parent = 0,
00558                                          const QString& caption= QString() );
00559 
00580     static KUrl getExistingDirectoryUrl( const KUrl& startDir = KUrl(),
00581                                          QWidget * parent = 0,
00582                                          const QString& caption= QString() );
00583 
00602     static KUrl getImageOpenUrl( const KUrl& startDir = KUrl(),
00603                                  QWidget *parent = 0,
00604                                  const QString& caption = QString() );
00605 
00627     void setMode( KFile::Modes m );
00628 
00633     KFile::Modes mode() const;
00634 
00642     void setLocationLabel(const QString& text);
00643 
00648     KAbstractFileWidget* fileWidget();
00649 
00662     KToolBar *toolBar() const;
00663 
00668     KPushButton *okButton() const;
00669 
00674     KPushButton *cancelButton() const;
00675 
00680     KUrlComboBox *locationEdit() const;
00681 
00686     KFileFilterCombo *filterWidget() const;
00687 
00691     KActionCollection *actionCollection() const;
00692 
00705     static KUrl getStartUrl( const KUrl& startDir, QString& recentDirClass );
00706 
00711     static void setStartDir( const KUrl& directory );
00712 
00713 #ifdef Q_WS_WIN
00714 public Q_SLOTS:
00715     int exec();
00716 #endif
00717 
00718 Q_SIGNALS:
00726     void fileSelected(const QString&);
00727 
00731     void fileHighlighted(const QString&);
00732 
00741     void selectionChanged();
00742 
00753     void filterChanged( const QString& filter );
00754 
00755 protected:
00759     virtual void keyPressEvent( QKeyEvent *e );
00760 
00764     virtual void hideEvent( QHideEvent *event );
00765 
00766 protected Q_SLOTS:
00767     virtual void slotOk();
00768     virtual void accept();
00769     virtual void slotCancel();
00770 
00771 private:
00772     Q_DISABLE_COPY(KFileDialog)
00773 
00774     KFileDialogPrivate * const d;
00775 };
00776 
00777 #endif

KIO

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal