• Skip to content
  • Skip to link menu
KDE 4.7 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     
00121     KFileDialog( const KUrl& startDir, const QString& filter,
00122                  QWidget *parent, QWidget* widget = 0 );
00123 
00124 
00128     ~KFileDialog();
00129 
00133     KUrl selectedUrl() const;
00134 
00138     KUrl::List selectedUrls() const;
00139 
00143     KUrl baseUrl() const;
00144 
00149     QString selectedFile() const;
00150 
00154     QStringList selectedFiles() const;
00155 
00163     void setUrl(const KUrl &url, bool clearforward = true);
00164 
00170     void setSelection(const QString& name);
00171 
00189     void setOperationMode( KFileDialog::OperationMode );
00190 
00198     OperationMode operationMode() const;
00199 
00211     void setKeepLocation( bool keep );
00212 
00217     bool keepsLocation() const;
00218 
00266     void setFilter(const QString& filter);
00267 
00275     QString currentFilter() const;
00276 
00285     KMimeType::Ptr currentFilterMimeType();
00286 
00298     void setMimeFilter( const QStringList& types,
00299                         const QString& defaultType = QString() );
00300 
00309     QString currentMimeFilter() const;
00310 
00314     void clearFilter();
00315 
00327     void setPreviewWidget(KPreviewWidgetBase *w);
00328 
00335     void setInlinePreviewShown(bool show);
00336 
00346     void setConfirmOverwrite(bool enable);
00347 
00349     virtual QSize sizeHint() const;
00350 
00370     static QString getOpenFileName( const KUrl& startDir= KUrl(),
00371                                     const QString& filter= QString(),
00372                                     QWidget *parent= 0,
00373                                     const QString& caption = QString() );
00374 
00375 
00382    static QString getOpenFileNameWId( const KUrl& startDir,
00383                                       const QString& filter,
00384                                       WId parent_id, const QString& caption );
00385 
00405     static QStringList getOpenFileNames( const KUrl& startDir= KUrl(),
00406                                          const QString& filter = QString(),
00407                                          QWidget *parent = 0,
00408                                          const QString& caption= QString() );
00409 
00410 
00411 
00431     static KUrl getOpenUrl( const KUrl& startDir = KUrl(),
00432                             const QString& filter = QString(),
00433                             QWidget *parent= 0,
00434                             const QString& caption = QString() );
00435 
00436 
00437 
00457     static KUrl::List getOpenUrls( const KUrl& startDir = KUrl(),
00458                                    const QString& filter = QString(),
00459                                    QWidget *parent = 0,
00460                                    const QString& caption = QString() );
00461 
00462 
00463 
00483     static QString getSaveFileName( const KUrl& startDir = KUrl(),
00484                                     const QString& filter = QString(),
00485                                     QWidget *parent = 0,
00486                                     const QString& caption = QString() );
00487 
00510     static QString getSaveFileName( const KUrl& startDir,
00511                                     const QString& filter,
00512                                     QWidget *parent,
00513                                     const QString& caption,
00514                                     Options options );
00515 
00516 
00521     static QString getSaveFileNameWId( const KUrl &startDir, const QString& filter,
00522                                        WId parent_id,
00523                                        const QString& caption );
00524 
00531     static QString getSaveFileNameWId( const KUrl &startDir, const QString& filter,
00532                                        WId parent_id,
00533                                        const QString& caption,
00534                                        Options options );
00535 
00555     static KUrl getSaveUrl( const KUrl& startDir = KUrl(),
00556                             const QString& filter = QString(),
00557                             QWidget *parent = 0,
00558                             const QString& caption = QString() );
00559 
00582     static KUrl getSaveUrl( const KUrl& startDir,
00583                             const QString& filter,
00584                             QWidget *parent,
00585                             const QString& caption,
00586                             Options options );
00587 
00588 
00602     static QString getExistingDirectory( const KUrl& startDir = KUrl(),
00603                                          QWidget * parent = 0,
00604                                          const QString& caption= QString() );
00605 
00620     static KUrl getExistingDirectoryUrl( const KUrl& startDir = KUrl(),
00621                                          QWidget * parent = 0,
00622                                          const QString& caption= QString() );
00623 
00636     static KUrl getImageOpenUrl( const KUrl& startDir = KUrl(),
00637                                  QWidget *parent = 0,
00638                                  const QString& caption = QString() );
00639 
00661     void setMode( KFile::Modes m );
00662 
00667     KFile::Modes mode() const;
00668 
00676     void setLocationLabel(const QString& text);
00677 
00682     KAbstractFileWidget* fileWidget();
00683 
00696     KToolBar *toolBar() const;
00697 
00702     KPushButton *okButton() const;
00703 
00708     KPushButton *cancelButton() const;
00709 
00714     KUrlComboBox *locationEdit() const;
00715 
00720     KFileFilterCombo *filterWidget() const;
00721 
00725     KActionCollection *actionCollection() const;
00726 
00744     static KUrl getStartUrl( const KUrl& startDir, QString& recentDirClass );
00745 
00750     static void setStartDir( const KUrl& directory );
00751 
00752 #ifdef Q_WS_WIN
00753 public Q_SLOTS:
00754     int exec();
00755 #endif
00756 
00757 Q_SIGNALS:
00767     void fileSelected(const KUrl&);
00771     QT_MOC_COMPAT void fileSelected(const QString&); // TODO KDE5: remove
00772 
00778     void fileHighlighted(const KUrl&);
00782     QT_MOC_COMPAT void fileHighlighted(const QString&); // TODO KDE5: remove
00783 
00792     void selectionChanged();
00793 
00804     void filterChanged( const QString& filter );
00805 
00806 protected:
00810     virtual void keyPressEvent( QKeyEvent *e );
00811 
00815     virtual void hideEvent( QHideEvent *event );
00816 
00817 protected Q_SLOTS:
00818     virtual void slotOk();
00819     virtual void accept();
00820     virtual void slotCancel();
00821 
00822 private:
00823     Q_DISABLE_COPY(KFileDialog)
00824 
00825     KFileDialogPrivate * const d;
00826 };
00827 
00828 #endif

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

Skip menu "kdelibs"
  • 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
Generated for kdelibs by doxygen 1.7.5
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