• Skip to content
  • Skip to link menu
KDE 4.1 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 
00309     virtual QSize sizeHint() const;
00310 
00336     static QString getOpenFileName( const KUrl& startDir= KUrl(),
00337                                     const QString& filter= QString(),
00338                                     QWidget *parent= 0,
00339                                     const QString& caption = QString() );
00340 
00341 
00348    static QString getOpenFileNameWId( const KUrl& startDir,
00349                                       const QString& filter,
00350                                       WId parent_id, const QString& caption );
00351 
00377     static QStringList getOpenFileNames( const KUrl& startDir= KUrl(),
00378                                          const QString& filter = QString(),
00379                                          QWidget *parent = 0,
00380                                          const QString& caption= QString() );
00381 
00382 
00383 
00409     static KUrl getOpenUrl( const KUrl& startDir = KUrl(),
00410                             const QString& filter = QString(),
00411                             QWidget *parent= 0,
00412                             const QString& caption = QString() );
00413 
00414 
00415 
00441     static KUrl::List getOpenUrls( const KUrl& startDir = KUrl(),
00442                                    const QString& filter = QString(),
00443                                    QWidget *parent = 0,
00444                                    const QString& caption = QString() );
00445 
00446 
00447 
00473     static QString getSaveFileName( const KUrl& startDir = KUrl(),
00474                                     const QString& filter = QString(),
00475                                     QWidget *parent = 0,
00476                                     const QString& caption = QString() );
00477 
00478 
00483     static QString getSaveFileNameWId( const KUrl &startDir, const QString& filter,
00484                                        WId parent_id,
00485                                        const QString& caption );
00486 
00512     static KUrl getSaveUrl( const KUrl& startDir = KUrl(),
00513                             const QString& filter = QString(),
00514                             QWidget *parent = 0,
00515                             const QString& caption = QString() );
00516 
00517 
00537     static QString getExistingDirectory( const KUrl& startDir = KUrl(),
00538                                          QWidget * parent = 0,
00539                                          const QString& caption= QString() );
00540 
00561     static KUrl getExistingDirectoryUrl( const KUrl& startDir = KUrl(),
00562                                          QWidget * parent = 0,
00563                                          const QString& caption= QString() );
00564 
00583     static KUrl getImageOpenUrl( const KUrl& startDir = KUrl(),
00584                                  QWidget *parent = 0,
00585                                  const QString& caption = QString() );
00586 
00608     void setMode( KFile::Modes m );
00609 
00614     KFile::Modes mode() const;
00615 
00623     void setLocationLabel(const QString& text);
00624 
00629     KAbstractFileWidget* fileWidget();
00630 
00643     KToolBar *toolBar() const;
00644 
00649     KPushButton *okButton() const;
00650 
00655     KPushButton *cancelButton() const;
00656 
00661     KUrlComboBox *locationEdit() const;
00662 
00667     KFileFilterCombo *filterWidget() const;
00668 
00672     KActionCollection *actionCollection() const;
00673 
00686     static KUrl getStartUrl( const KUrl& startDir, QString& recentDirClass );
00687 
00692     static void setStartDir( const KUrl& directory );
00693 
00694 #ifdef Q_WS_WIN
00695 public Q_SLOTS:
00696     int exec();
00697 #endif
00698 
00699 Q_SIGNALS:
00707     void fileSelected(const QString&);
00708 
00712     void fileHighlighted(const QString&);
00713 
00722     void selectionChanged();
00723 
00734     void filterChanged( const QString& filter );
00735 
00736 protected:
00740     virtual void keyPressEvent( QKeyEvent *e );
00741 
00745     virtual void hideEvent( QHideEvent *event );
00746 
00747 protected Q_SLOTS:
00748     virtual void slotOk();
00749     virtual void accept();
00750     virtual void slotCancel();
00751 
00752 private:
00753     Q_DISABLE_COPY(KFileDialog)
00754 
00755     KFileDialogPrivate * const d;
00756 };
00757 
00758 #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
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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