• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • 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                   2009 David Jarvie <djarvie@kde.org>
00010 
00011     This library is free software; you can redistribute it and/or
00012     modify it under the terms of the GNU Library General Public
00013     License as published by the Free Software Foundation; either
00014     version 2 of the License, or (at your option) any later version.
00015 
00016     This library is distributed in the hope that it will be useful,
00017     but WITHOUT ANY WARRANTY; without even the implied warranty of
00018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019     Library General Public License for more details.
00020 
00021     You should have received a copy of the GNU Library General Public License
00022     along with this library; see the file COPYING.LIB.  If not, write to
00023     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00024     Boston, MA 02110-1301, USA.
00025 */
00026 
00027 #ifndef KFILEDIALOG_H
00028 #define KFILEDIALOG_H
00029 
00030 #include <kdialog.h>
00031 #include <kfile.h>
00032 #include <kurl.h>
00033 #include <kmimetype.h>
00034 
00035 class KAbstractFileWidget;
00036 class KFileWidget;
00037 
00038 class KActionCollection;
00039 class KUrlComboBox;
00040 class KFileFilterCombo;
00041 class KPushButton;
00042 class KToolBar;
00043 class KPreviewWidgetBase;
00044 
00045 class KFileDialogPrivate;
00046 
00068 class KIO_EXPORT KFileDialog : public KDialog
00069 {
00070     Q_OBJECT
00071 
00072 public:
00073 
00085     enum OperationMode { Other = 0, Opening, Saving };
00086 
00091     enum Option {
00092         ConfirmOverwrite  = 0x01,   
00093         ShowInlinePreview = 0x02    
00094     };
00095     Q_DECLARE_FLAGS(Options, Option)
00096 
00097     
00120     KFileDialog( const KUrl& startDir, const QString& filter,
00121                  QWidget *parent, QWidget* widget = 0 );
00122 
00123 
00127     ~KFileDialog();
00128 
00132     KUrl selectedUrl() const;
00133 
00137     KUrl::List selectedUrls() const;
00138 
00142     KUrl baseUrl() const;
00143 
00148     QString selectedFile() const;
00149 
00153     QStringList selectedFiles() const;
00154 
00162     void setUrl(const KUrl &url, bool clearforward = true);
00163 
00169     void setSelection(const QString& name);
00170 
00188     void setOperationMode( KFileDialog::OperationMode );
00189 
00197     OperationMode operationMode() const;
00198 
00210     void setKeepLocation( bool keep );
00211 
00216     bool keepsLocation() const;
00217 
00252     void setFilter(const QString& filter);
00253 
00261     QString currentFilter() const;
00262 
00271     KMimeType::Ptr currentFilterMimeType();
00272 
00284     void setMimeFilter( const QStringList& types,
00285                         const QString& defaultType = QString() );
00286 
00295     QString currentMimeFilter() const;
00296 
00300     void clearFilter();
00301 
00313     void setPreviewWidget(KPreviewWidgetBase *w);
00314 
00321     void setInlinePreviewShown(bool show);
00322 
00332     void setConfirmOverwrite(bool enable);
00333 
00335     virtual QSize sizeHint() const;
00336 
00356     static QString getOpenFileName( const KUrl& startDir= KUrl(),
00357                                     const QString& filter= QString(),
00358                                     QWidget *parent= 0,
00359                                     const QString& caption = QString() );
00360 
00361 
00368    static QString getOpenFileNameWId( const KUrl& startDir,
00369                                       const QString& filter,
00370                                       WId parent_id, const QString& caption );
00371 
00391     static QStringList getOpenFileNames( const KUrl& startDir= KUrl(),
00392                                          const QString& filter = QString(),
00393                                          QWidget *parent = 0,
00394                                          const QString& caption= QString() );
00395 
00396 
00397 
00417     static KUrl getOpenUrl( const KUrl& startDir = KUrl(),
00418                             const QString& filter = QString(),
00419                             QWidget *parent= 0,
00420                             const QString& caption = QString() );
00421 
00422 
00423 
00443     static KUrl::List getOpenUrls( const KUrl& startDir = KUrl(),
00444                                    const QString& filter = QString(),
00445                                    QWidget *parent = 0,
00446                                    const QString& caption = QString() );
00447 
00448 
00449 
00469     static QString getSaveFileName( const KUrl& startDir = KUrl(),
00470                                     const QString& filter = QString(),
00471                                     QWidget *parent = 0,
00472                                     const QString& caption = QString() );
00473 
00496     static QString getSaveFileName( const KUrl& startDir,
00497                                     const QString& filter,
00498                                     QWidget *parent,
00499                                     const QString& caption,
00500                                     Options options );
00501 
00502 
00507     static QString getSaveFileNameWId( const KUrl &startDir, const QString& filter,
00508                                        WId parent_id,
00509                                        const QString& caption );
00510 
00517     static QString getSaveFileNameWId( const KUrl &startDir, const QString& filter,
00518                                        WId parent_id,
00519                                        const QString& caption,
00520                                        Options options );
00521 
00541     static KUrl getSaveUrl( const KUrl& startDir = KUrl(),
00542                             const QString& filter = QString(),
00543                             QWidget *parent = 0,
00544                             const QString& caption = QString() );
00545 
00568     static KUrl getSaveUrl( const KUrl& startDir,
00569                             const QString& filter,
00570                             QWidget *parent,
00571                             const QString& caption,
00572                             Options options );
00573 
00574 
00588     static QString getExistingDirectory( const KUrl& startDir = KUrl(),
00589                                          QWidget * parent = 0,
00590                                          const QString& caption= QString() );
00591 
00606     static KUrl getExistingDirectoryUrl( const KUrl& startDir = KUrl(),
00607                                          QWidget * parent = 0,
00608                                          const QString& caption= QString() );
00609 
00622     static KUrl getImageOpenUrl( const KUrl& startDir = KUrl(),
00623                                  QWidget *parent = 0,
00624                                  const QString& caption = QString() );
00625 
00647     void setMode( KFile::Modes m );
00648 
00653     KFile::Modes mode() const;
00654 
00662     void setLocationLabel(const QString& text);
00663 
00668     KAbstractFileWidget* fileWidget();
00669 
00682     KToolBar *toolBar() const;
00683 
00688     KPushButton *okButton() const;
00689 
00694     KPushButton *cancelButton() const;
00695 
00700     KUrlComboBox *locationEdit() const;
00701 
00706     KFileFilterCombo *filterWidget() const;
00707 
00711     KActionCollection *actionCollection() const;
00712 
00730     static KUrl getStartUrl( const KUrl& startDir, QString& recentDirClass );
00731 
00736     static void setStartDir( const KUrl& directory );
00737 
00738 #ifdef Q_WS_WIN
00739 public Q_SLOTS:
00740     int exec();
00741 #endif
00742 
00743 Q_SIGNALS:
00753     void fileSelected(const KUrl&);
00757     QT_MOC_COMPAT void fileSelected(const QString&); // TODO KDE5: remove
00758 
00764     void fileHighlighted(const KUrl&);
00768     QT_MOC_COMPAT void fileHighlighted(const QString&); // TODO KDE5: remove
00769 
00778     void selectionChanged();
00779 
00790     void filterChanged( const QString& filter );
00791 
00792 protected:
00796     virtual void keyPressEvent( QKeyEvent *e );
00797 
00801     virtual void hideEvent( QHideEvent *event );
00802 
00803 protected Q_SLOTS:
00804     virtual void slotOk();
00805     virtual void accept();
00806     virtual void slotCancel();
00807 
00808 private:
00809     Q_DISABLE_COPY(KFileDialog)
00810 
00811     KFileDialogPrivate * const d;
00812 };
00813 
00814 #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
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
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