• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • 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 
00009     This library is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU Library General Public
00011     License as published by the Free Software Foundation; either
00012     version 2 of the License, or (at your option) any later version.
00013 
00014     This library is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017     Library General Public License for more details.
00018 
00019     You should have received a copy of the GNU Library General Public License
00020     along with this library; see the file COPYING.LIB.  If not, write to
00021     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00022     Boston, MA 02110-1301, USA.
00023 */
00024 
00025 #ifndef __KFILEDIALOG_H__
00026 #define __KFILEDIALOG_H__
00027 
00028 #include <qstring.h>
00029 
00030 #include <kdialogbase.h>
00031 #include <kfile.h>
00032 #include <kurl.h>
00033 #include <kmimetype.h>
00034 #include <kio/jobclasses.h>
00035 
00036 class QCheckBox;
00037 class QHBoxLayout;
00038 class QGridLayout;
00039 class QLabel;
00040 class QPopupMenu;
00041 class QVBoxLayout;
00042 
00043 class KActionCollection;
00044 class KDirOperator;
00045 class KURLBar;
00046 class KURLComboBox;
00047 class KFileFilterCombo;
00048 class KFileView;
00049 class KFileItem;
00050 class KPushButton;
00051 class KToolBar;
00052 class KPreviewWidgetBase;
00053 
00054 struct KFileDialogPrivate;
00055 
00077 class KIO_EXPORT KFileDialog : public KDialogBase
00078 {
00079     Q_OBJECT
00080 
00081 public:
00082 
00094     enum OperationMode { Other = 0, Opening, Saving };
00095 
00119     KFileDialog(const QString& startDir, const QString& filter,
00120         QWidget *parent, const char *name,
00121         bool modal);
00122 
00159     KFileDialog(const QString& startDir, const QString& filter,
00160         QWidget *parent, const char *name,
00161         bool modal, QWidget* widget);
00162 
00163 
00167     ~KFileDialog();
00168 
00172     KURL selectedURL() const;
00173 
00177     KURL::List selectedURLs() const;
00178 
00182     KURL baseURL() const;
00183 
00188     QString selectedFile() const;
00189 
00193     QStringList selectedFiles() const;
00194 
00202     void setURL(const KURL &url, bool clearforward = true);
00203 
00209     void setSelection(const QString& name);
00210 
00228     void setOperationMode( KFileDialog::OperationMode );
00229 
00237     OperationMode operationMode() const;
00238 
00250     void setKeepLocation( bool keep );
00251 
00256     bool keepsLocation() const;
00257 
00292     void setFilter(const QString& filter);
00293 
00301     QString currentFilter() const;
00302 
00313     void setFilterMimeType(const QString &label, const KMimeType::List &types, const KMimeType::Ptr &defaultType) KDE_DEPRECATED;
00314 
00323     KMimeType::Ptr currentFilterMimeType();
00324 
00336     void setMimeFilter( const QStringList& types,
00337                         const QString& defaultType = QString::null );
00338 
00347     QString currentMimeFilter() const;
00348 
00352     void clearFilter();
00353 
00368     void setPreviewWidget(const QWidget *w) KDE_DEPRECATED;
00369 
00381    void setPreviewWidget(const KPreviewWidgetBase *w);
00382 
00408     static QString getOpenFileName(const QString& startDir= QString::null,
00409                    const QString& filter= QString::null,
00410                    QWidget *parent= 0,
00411                    const QString& caption = QString::null);
00412 
00413 
00422    static QString getOpenFileNameWId(const QString& startDir,
00423                                      const QString& filter,
00424                                      WId parent_id, const QString& caption);
00425 
00451     static QStringList getOpenFileNames(const QString& startDir= QString::null,
00452                     const QString& filter= QString::null,
00453                     QWidget *parent = 0,
00454                     const QString& caption= QString::null);
00455 
00456 
00457 
00483     static KURL getOpenURL(const QString& startDir = QString::null,
00484                const QString& filter= QString::null,
00485                QWidget *parent= 0,
00486                const QString& caption = QString::null);
00487 
00488 
00489 
00515     static KURL::List getOpenURLs(const QString& startDir= QString::null,
00516                   const QString& filter= QString::null,
00517                   QWidget *parent = 0,
00518                   const QString& caption= QString::null);
00519 
00520 
00521 
00549     static QString getSaveFileName(const QString& startDir= QString::null,
00550                    const QString& filter= QString::null,
00551                    QWidget *parent= 0,
00552                    const QString& caption = QString::null);
00553            
00554                    
00560     static QString getSaveFileNameWId(const QString& dir, const QString& filter,
00561                                      WId parent_id,
00562                                      const QString& caption);
00563 
00591     static KURL getSaveURL(const QString& startDir= QString::null,
00592                const QString& filter= QString::null,
00593                QWidget *parent= 0,
00594                const QString& caption = QString::null);
00595 
00596 
00615     static QString getExistingDirectory(const QString & startDir = QString::null,
00616                     QWidget * parent = 0,
00617                     const QString& caption= QString::null);
00618 
00641     static KURL getExistingURL(const QString & startDir = QString::null,
00642                                   QWidget * parent = 0,
00643                                   const QString& caption= QString::null);
00662     static KURL getImageOpenURL( const QString& startDir = QString::null,
00663                  QWidget *parent = 0,
00664                  const QString& caption = QString::null );
00665     virtual void show();
00666 
00670     void setMode( KFile::Mode m );
00671 
00693     void setMode( unsigned int m );
00694 
00699     KFile::Mode mode() const;
00700 
00708     void setLocationLabel(const QString& text);
00709 
00722     KToolBar *toolBar() const { return toolbar; }
00723 
00728     KPushButton *okButton() const;
00729 
00734     KPushButton *cancelButton() const;
00735 
00751     KURLBar *speedBar();
00752 
00757     KActionCollection *actionCollection() const;
00758 
00763     int pathComboIndex();
00764 
00777     static KURL getStartURL( const QString& startDir, QString& recentDirClass );
00778 
00783     static void setStartDir( const KURL& directory );
00784 
00785 signals:
00793     void fileSelected(const QString&);
00794 
00798     void fileHighlighted(const QString&);
00799 
00808     void selectionChanged();
00809 
00820     void filterChanged( const QString& filter );
00821 
00822 protected:
00823     KToolBar *toolbar;
00824 
00825     static KURL *lastDirectory;
00826 
00827     KURLComboBox *locationEdit;
00828 
00829     KFileFilterCombo *filterWidget;
00830 
00834     virtual void keyPressEvent( QKeyEvent *e );
00835 
00840     void init(const QString& startDir, const QString& filter, QWidget* widget);
00841 
00846     virtual void initGUI();
00847 
00852     void multiSelectionChanged();
00853 
00857     virtual void readConfig( KConfig *, const QString& group = QString::null );
00858 
00862     virtual void writeConfig( KConfig *, const QString& group = QString::null );
00863 
00867     virtual void readRecentFiles( KConfig * );
00868 
00872     virtual void saveRecentFiles( KConfig * );
00873 
00880     KURL::List tokenize(const QString& line) const;
00881 
00886     KURL getCompleteURL(const QString&);
00887 
00894     QString currentFilterExtension();
00895 
00904     void updateAutoSelectExtension();
00905 
00906 
00907 protected slots:
00908     void urlEntered( const KURL& );
00909     void enterURL( const KURL& url );
00910     void enterURL( const QString& url );
00911     void locationActivated( const QString& url );
00912 
00916     // ### remove in KDE4
00917     void toolbarCallback(int);
00921     // ### remove in KDE4
00922     void pathComboChanged( const QString& );
00926     // ### remove in KDE4
00927     void dirCompletion( const QString& );
00928 
00929     void slotFilterChanged();
00930     void fileHighlighted(const KFileItem *i);
00931     void fileSelected(const KFileItem *i);
00932     void slotStatResult(KIO::Job* job);
00933     void slotLoadingFinished();
00934 
00935     void fileCompletion( const QString& );
00939     void toggleSpeedbar( bool );
00940 
00944     void toggleBookmarks(bool show);
00945 
00949     virtual void updateStatusLine(int dirs, int files);
00950 
00951     virtual void slotOk();
00952     virtual void accept();
00953     virtual void slotCancel();
00954 
00955     void slotAutoSelectExtClicked();
00956     void addToRecentDocuments();
00957     void initSpeedbar();
00958 
00959 private slots:
00960     void slotLocationChanged( const QString& text );
00961 
00962 private:
00963     KFileDialog(const KFileDialog&);
00964     KFileDialog operator=(const KFileDialog&);
00965 
00966     void setLocationText( const QString& text );
00967     void updateLocationWhatsThis();
00968 
00969     void appendExtension(KURL &url);
00970     void updateLocationEditExtension(const QString &);
00971     void updateFilter();
00972 
00973     static void initStatic();
00974 
00975     void setNonExtSelection();
00976 
00977 protected:
00978     KDirOperator *ops;
00979     bool autoDirectoryFollowing;
00980 
00981     KURL::List& parseSelectedURLs() const;
00982 
00983 protected:
00984     virtual void virtual_hook( int id, void* data );
00985 private:
00986     KFileDialogPrivate *d;
00987 };
00988 
00989 #endif

kio

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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
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