kfiledialog.h
// -*- c++ -*-
/* This file is part of the KDE libraries
Copyright (C) 1997, 1998 Richard Moore <rich@kde.org>
1998 Stephan Kulow <coolo@kde.org>
1998 Daniel Grana <grana@ie.iwi.unibe.ch>
2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
2001 Frerich Raabe <raabe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __KFILEDIALOG_H__
#define __KFILEDIALOG_H__
#include <qstring.h>
#include <kdialogbase.h>
#include <kfile.h>
#include <kurl.h>
#include <kmimetype.h>
#include <kio/jobclasses.h>
class QCheckBox;
class QHBoxLayout;
class QGridLayout;
class QLabel;
class QPopupMenu;
class QVBoxLayout;
class KActionCollection;
class KDirOperator;
class KURLBar;
class KURLComboBox;
class KFileFilterCombo;
class KFileView;
class KFileItem;
class KPushButton;
class KToolBar;
class KPreviewWidgetBase;
struct KFileDialogPrivate;
class KIO_EXPORT KFileDialog : public KDialogBase
{
Q_OBJECT
public:
enum OperationMode { Other = 0, Opening, Saving };
KFileDialog(const QString& startDir, const QString& filter,
QWidget *parent, const char *name,
bool modal);
KFileDialog(const QString& startDir, const QString& filter,
QWidget *parent, const char *name,
bool modal, QWidget* widget);
~KFileDialog();
KURL selectedURL() const;
KURL::List selectedURLs() const;
KURL baseURL() const;
QString selectedFile() const;
QStringList selectedFiles() const;
void setURL(const KURL &url, bool clearforward = true);
void setSelection(const QString& name);
void setOperationMode( KFileDialog::OperationMode );
OperationMode operationMode() const;
void setKeepLocation( bool keep );
bool keepsLocation() const;
void setFilter(const QString& filter);
QString currentFilter() const;
void setFilterMimeType(const QString &label, const KMimeType::List &types, const KMimeType::Ptr &defaultType) KDE_DEPRECATED;
KMimeType::Ptr currentFilterMimeType();
void setMimeFilter( const QStringList& types,
const QString& defaultType = QString::null );
QString currentMimeFilter() const;
void clearFilter();
void setPreviewWidget(const QWidget *w) KDE_DEPRECATED;
void setPreviewWidget(const KPreviewWidgetBase *w);
static QString getOpenFileName(const QString& startDir= QString::null,
const QString& filter= QString::null,
QWidget *parent= 0,
const QString& caption = QString::null);
static QString getOpenFileNameWId(const QString& startDir,
const QString& filter,
WId parent_id, const QString& caption);
static QStringList getOpenFileNames(const QString& startDir= QString::null,
const QString& filter= QString::null,
QWidget *parent = 0,
const QString& caption= QString::null);
static KURL getOpenURL(const QString& startDir = QString::null,
const QString& filter= QString::null,
QWidget *parent= 0,
const QString& caption = QString::null);
static KURL::List getOpenURLs(const QString& startDir= QString::null,
const QString& filter= QString::null,
QWidget *parent = 0,
const QString& caption= QString::null);
static QString getSaveFileName(const QString& startDir= QString::null,
const QString& filter= QString::null,
QWidget *parent= 0,
const QString& caption = QString::null);
static QString getSaveFileNameWId(const QString& dir, const QString& filter,
WId parent_id,
const QString& caption);
static KURL getSaveURL(const QString& startDir= QString::null,
const QString& filter= QString::null,
QWidget *parent= 0,
const QString& caption = QString::null);
static QString getExistingDirectory(const QString & startDir = QString::null,
QWidget * parent = 0,
const QString& caption= QString::null);
static KURL getExistingURL(const QString & startDir = QString::null,
QWidget * parent = 0,
const QString& caption= QString::null);
static KURL getImageOpenURL( const QString& startDir = QString::null,
QWidget *parent = 0,
const QString& caption = QString::null );
virtual void show();
void setMode( KFile::Mode m );
void setMode( unsigned int m );
KFile::Mode mode() const;
void setLocationLabel(const QString& text);
KToolBar *toolBar() const { return toolbar; }
KPushButton *okButton() const;
KPushButton *cancelButton() const;
KURLBar *speedBar();
KActionCollection *actionCollection() const;
int pathComboIndex();
static KURL getStartURL( const QString& startDir, QString& recentDirClass );
static void setStartDir( const KURL& directory );
signals:
void fileSelected(const QString&);
void fileHighlighted(const QString&);
void selectionChanged();
void filterChanged( const QString& filter );
protected:
KToolBar *toolbar;
static KURL *lastDirectory;
KURLComboBox *locationEdit;
KFileFilterCombo *filterWidget;
virtual void keyPressEvent( QKeyEvent *e );
void init(const QString& startDir, const QString& filter, QWidget* widget);
virtual void initGUI();
void multiSelectionChanged();
virtual void readConfig( KConfig *, const QString& group = QString::null );
virtual void writeConfig( KConfig *, const QString& group = QString::null );
virtual void readRecentFiles( KConfig * );
virtual void saveRecentFiles( KConfig * );
KURL::List tokenize(const QString& line) const;
KURL getCompleteURL(const QString&);
QString currentFilterExtension();
void updateAutoSelectExtension();
protected slots:
void urlEntered( const KURL& );
void enterURL( const KURL& url );
void enterURL( const QString& url );
void locationActivated( const QString& url );
// ### remove in KDE4
void toolbarCallback(int);
// ### remove in KDE4
void pathComboChanged( const QString& );
// ### remove in KDE4
void dirCompletion( const QString& );
void slotFilterChanged();
void fileHighlighted(const KFileItem *i);
void fileSelected(const KFileItem *i);
void slotStatResult(KIO::Job* job);
void slotLoadingFinished();
void fileCompletion( const QString& );
void toggleSpeedbar( bool );
void toggleBookmarks(bool show);
virtual void updateStatusLine(int dirs, int files);
virtual void slotOk();
virtual void accept();
virtual void slotCancel();
void slotAutoSelectExtClicked();
void addToRecentDocuments();
void initSpeedbar();
private slots:
void slotLocationChanged( const QString& text );
private:
KFileDialog(const KFileDialog&);
KFileDialog operator=(const KFileDialog&);
void setLocationText( const QString& text );
void updateLocationWhatsThis();
void appendExtension(KURL &url);
void updateLocationEditExtension(const QString &);
void updateFilter();
static void initStatic();
void setNonExtSelection();
protected:
KDirOperator *ops;
bool autoDirectoryFollowing;
KURL::List& parseSelectedURLs() const;
protected:
virtual void virtual_hook( int id, void* data );
private:
KFileDialogPrivate *d;
};
#endif
KURLComboBox
This combobox shows a number of recent URLs/directories, as well as some default directories.
Definition: kurlcombobox.h:41
KFileView
This class defines an interface to all file views.
Definition: kfileview.h:98
KFile::Mode
Mode
Modes of operation for the dialog.
Definition: kfile.h:42
KFileDialog
Provides a user (and developer) friendly way to select files and directories.
Definition: kfiledialog.h:77
KDirOperator
This widget works as a network transparent filebrowser.
Definition: kdiroperator.h:97
KURLBar
KURLBar is a widget that displays icons together with a description.
Definition: kurlbar.h:230
KFileDialog::toolBar
KToolBar * toolBar() const
Returns a pointer to the toolbar.
Definition: kfiledialog.h:722
KFileDialog::OperationMode
OperationMode
Defines some default behavior of the filedialog.
Definition: kfiledialog.h:94
KPreviewWidgetBase
Abstract baseclass for all preview widgets which shall be used via KFileDialog::setPreviewWidget(cons...
Definition: kpreviewwidgetbase.h:44

KDE Home | KDE Accessibility Home | Description of Access Keys