Source Code (Use browser search to find items of interest.)

Class Index

kdelibs'KFileDialog (./kdelibs/kfile/kfiledialog.h:75)

class KFileDialog : public KDialogBase
{
    Q_OBJECT

public:
    /**
      * Construct a KFileDialog
      *
      * @param urlName  The url of the directory to start in. Use QString::null
                        to start in the current working directory, or the last
			directory where a file has been selected.
      * @param filter   A shell glob that specifies which files to display.
      * See @ref setFilter for details on how to use this argument
      * @param acceptURLs If set to false, @ref KFileDialog will just accept
      * files on the local filesystem.
      */
    KFileDialog(const QString& urlName, const QString& filter,
		QWidget *parent, const char *name,
		bool modal);

    /**
     * Clean up.
     */
    ~KFileDialog();

    /**
     * Retrieve the fully qualified filename.
     */
    KURL selectedURL() const;

    /**
     * Retrieve the list a selected URLs
     */
    KURL::List selectedURLs() const;

    /**
     * Retrieve the current directory.
     */
    KURL baseURL() const;

    /**
     * @return Full path in local filesystem. (Local files only)
     */
    QString selectedFile() const;

    /**
     * @returns a list of all selected local files
     */
    QStringList selectedFiles() const;

    /**
     * Set the directory to view.
     *
     * @param name URL to show
     * @param clearforward Indicate whether the forward queue
     * should be cleared.
     */
    void setURL(const KURL &url, bool clearforward = true);

    /**
     * Set the filename to preselect.
     *
     * This takes absolute URLs and relative file names.
     */
    void setSelection(const QString& name);

    /**
     * Set the filter to be used to filter.
     *
     * You can set more
     * filters for the user to select seperated by '\n'. Every
     * filter entry is defined through namefilter|text to diplay.
     * If no | is found in the expression, just the namefilter is
     * shown. Examples:
     *
     * <pre>
     * kfile->setFilter("*.cpp|C++ Source Files\n*.h|Header files");
     * kfile->setFilter("*.cpp");
     * kfile->setFilter("*.cpp|Sources (*.cpp)");
     * </pre>
     *
     * Note: The text to display is not parsed in any way. So, if you
     * want to show the suffix to select by a specific filter, you must
     * repeat it.
     * @see #setFilter
     * @see #filterChanged
     */
    void setFilter(const QString& filter);

    /**
     * @returns the current filter, i.e. entered by the user or one of the
     * predefined set via @ref setFilter().
     * @param @p filter contains the new filter (only the extension part,
     * not the explanation), i.e. "*.cpp" or "*.cpp *.cc".
     * @see #setFilter
     * @see #filterChanged
     */
    QString currentFilter() const;

    /**
     * Add a preview widget and enter the preview mode.
     *
     * In this mode
     * the dialog is split and the right part contains your widget.
     * This widget has to inherit @ref QWidget and it has to implement
     * a slot showPreview(const KURL &); which is called
     * every time the file changes. You may want to look at
     * koffice/lib/kofficecore/koFilterManager.cc for some hints :)
     */
    void setPreviewWidget(const QWidget *w);

    /**
     * This method creates a modal file dialog and returns the selected
     * filename or an empty string if none was chosen.
     *
     * Note that with
     * this method the user must select an existing filename.
     *
     * @param dir This specifies the path the dialog will start in.
     * @param filter This is a space seperated list of shell globs.
     * @param parent The widget the dialog will be centered on initially.
     * @param name The name of the dialog widget.
     */
    static QString getOpenFileName(const QString& dir= QString::null,
				   const QString& filter= QString::null,
				   QWidget *parent= 0,
				   const QString& caption = QString::null);


    /**
     * This method creates a modal file dialog and returns the selected
     * filenames or an empty list if none was chosen.
     *
     * Note that with
     * this method the user must select an existing filename.
     *
     * @param dir This specifies the path the dialog will start in.
     * @param filter This is a space seperated list of shell globs.
     * @param parent The widget the dialog will be centered on initially.
     * @param name The name of the dialog widget.
     */
    static QStringList getOpenFileNames(const QString& dir= QString::null,
					const QString& filter= QString::null,
					QWidget *parent = 0,
					const QString& caption= QString::null);

    /**
     * This method creates a modal file dialog and returns the selected
     * URL or an empty string if none was chosen.
     *
     * Note that with
     * this method the user must select an existing URL.
     *
     * @param url This specifies the path the dialog will start in.
     * @param filter This is a space seperated list of shell globs.
     * @param parent The widget the dialog will be centered on initially.
     * @param name The name of the dialog widget.
     */
    static KURL getOpenURL(const QString& url = QString::null,
			   const QString& filter= QString::null,
			   QWidget *parent= 0,
			   const QString& caption = QString::null);


    /**
     * This method creates a modal file dialog and returns the selected
     * URLs or an empty list if none was chosen.
     *
     * Note that with
     * this method the user must select an existing filename.
     *
     * @param url This specifies the path the dialog will start in.
     * @param filter This is a space seperated list of shell globs.
     * @param parent The widget the dialog will be centered on initially.
     * @param name The name of the dialog widget.
     */
    static KURL::List getOpenURLs(const QString& url= QString::null,
				  const QString& filter= QString::null,
				  QWidget *parent = 0,
				  const QString& caption= QString::null);

    /**
     * Creates a modal file dialog and returns the selected
     * filename or an empty string if none was chosen.
     *
     * Note that with this
     * method the user need not select an existing filename.
     *
     * @param dir This specifies the path the dialog will start in.
     * @param filter This is a space seperated list of shell globs.
     * @param parent The widget the dialog will be centered on initially.
     * @param caption The name of the dialog widget.
     */
    static QString getSaveFileName(const QString& dir= QString::null,
				   const QString& filter= QString::null,
				   QWidget *parent= 0,
				   const QString& caption = QString::null);

    /**
     * Creates a modal file dialog and returns the selected
     * filename or an empty string if none was chosen.
     *
     * Note that with this
     * method the user need not select an existing filename.
     *
     * @param url This specifies the path the dialog will start in.
     * @param filter This is a space seperated list of shell globs.
     * @param parent The widget the dialog will be centered on initially.
     * @param caption The name of the dialog widget.
     */
    static KURL getSaveURL(const QString& url= QString::null,
			   const QString& filter= QString::null,
			   QWidget *parent= 0,
			   const QString& caption = QString::null);
    /**
     * Creates a modal file dialog and returns the selected
     * directory or an empty string if none was chosen.
     *
     * Note that with this
     * method the user need not select an existing directory.
     *
     * @param url The directory the dialog will start in.
     * @param parent The widget the dialog will be centered on initially.
     * @param caption The name of the dialog widget.
     */
    static QString getExistingDirectory(const QString & url = QString::null,
					QWidget * parent = 0,
					const QString& caption= QString::null);

    /**
     * Show the widget.
     **/
    virtual void show();

    /**
     * Set the mode of the dialog.
     * The mode is defined as (in kfile.h):
     * <pre>    enum Mode {
     *                      File         = 1,
     *                      Directory    = 2,
     *                      Files        = 4,
     *                      ExistingOnly = 8,
     *                      LocalOnly    = 16
     *                    };
     * </pre>
     * You can OR the values, e.g.
     * <pre>
     * KFile::Mode mode = static_cast<KFile::Mode>( KFile::Files |
     *                                              KFile::ExistingOnly |
     *						    KFile::LocalOnly );
     * setMode( mode );
     * </pre>
     * You need an explicit cast, which looks a little ugly, but is unavoidable
     * without using (even uglier) #defines
     * @see #mode
     */
    void setMode( KFile::Mode m );

    /**
     * Retrieve the mode of the filedialog.
     * @see #setMode
     */
    KFile::Mode mode() const;

    /**
     * sets the text to be displayed in front of the
     * selection. The default is "Location".
     * Most useful if you want to make clear what
     * the location is used for.
     */
    void setLocationLabel(const QString& text);

    /**
     * @returns a pointer to the toolbar. You can use this to insert custom
     * items into it, e.g.:
     * <pre>yourAction = new KAction( i18n("Your Action"), 0,
     *                                this, SLOT( yourSlot() ),
     *                                this, "action name" );
     *      yourAction->plug( kfileDialog->toolBar() );
     */
    KToolBar *toolBar() const { return toolbar; }


signals:
    /**
      * Emitted when the user selects a file.
      */
    void fileSelected(const QString&);

    /**
      * Emitted when the user highlights a file.
      */
    void fileHighlighted(const QString&);

    /**
      * Emitted when the allowable history operations change.
      */
    void historyUpdate(bool, bool);

    /**
     * Emitted when the filter changed, i.e. the user entered an own filter
     * or chose one of the predefined set via @ref setFilter().
     * @param @p filter contains the new filter (only the extension part,
     * not the explanation), i.e. "*.cpp" or "*.cpp *.cc".
     * @see #setFilter
     * @see #currentFilter
     */
    void filterChanged( const QString& filter );

protected:
    KToolBar *toolbar;

    static KURL *lastDirectory;

    QPopupMenu *bookmarksMenu;
    KFileComboBox *locationEdit;

    KFileFilter *filterWidget;

    KFileBookmarkManager *bookmarks;
    QStringList history;

    /**
     * adds a entry of the current directory. If disableUpdating is set
     * to true, it will care about clever updating
     **/
    void addDirEntry(KFileViewItem *entry, bool disableUpdating);

    /**
      * rebuild geometry managment.
      *
      */
    virtual void initGUI();

    /**
      * takes action on the new location. If it's a directory, change
      * into it, if it's a file, correct the name, etc.
      * @param takeFiles if set to true, if will close the dialog, if
      * txt is a file name
      */
    void checkPath(const QString& txt, bool takeFiles = false);

    /**
     * called when an item is highlighted/selected in multiselection mode.
     * handles setting the locationEdit.
     */
    void multiSelectionChanged(const KFileViewItem *);

    /**
     * Reads configuration and applies it (size, recent directories, ...)
     */
    virtual void readConfig( KConfig *, const QString& group = QString::null );

    /**
     * Saves the current configuration
     */
    virtual void saveConfig( KConfig *, const QString& group = QString::null );

    /**
     * Reads the recent used files and inserts them into the location combobox
     */
    virtual void readRecentFiles( KConfig * );

    /**
     * Saves the entries from the location combobox.
     */
    virtual void saveRecentFiles( KConfig * );


protected slots:
    void urlEntered( const KURL& );
    void pathComboActivated( const KURL& url );
    void pathComboReturnPressed( const QString& url );
    void locationActivated( const QString& url );
    void toolbarCallback(int);
    void toolbarPressedCallback(int);
    void slotFilterChanged();
    void pathComboChanged( const QString& );
    void fileHighlighted(const KFileViewItem *i);
    void fileSelected(const KFileViewItem *i);
    void slotStatResult(KIO::Job* job);
    void slotLoadingFinished();

    void dirCompletion( const QString& );
    void fileCompletion( const QString& );

    virtual void updateStatusLine(int dirs, int files);
    virtual void slotOk();
    virtual void accept();


    /**
      * Add the current location to the global bookmarks list
      */
    void addToBookmarks();
    void bookmarksChanged();
    void fillBookmarkMenu( KFileBookmark *parent, QPopupMenu *menu, int &id );

private:

    // cleanup the static variables
    static void cleanup();
    KFileDialog(const KFileDialog&);
    KFileDialog operator=(const KFileDialog&);


protected:
    KFileDialogPrivate *d;
    KDirOperator *ops;
    bool autoDirectoryFollowing;

    KURL::List& parseSelectedURLs() const;

};



kdelibs'KFileDialog::KFileDialog() (./kdelibs/kfile/kfiledialog.cpp:129)

KFileDialog::KFileDialog(const QString& dirName, const QString& filter,
			 QWidget *parent, const char* name, bool modal)
    : KDialogBase( parent, name, modal, QString::null,
		   KDialogBase::Ok | KDialogBase::Cancel,
		   KDialogBase::Ok )
{
    d = new KFileDialogPrivate();
    d->boxLayout = 0;
    d->mainWidget = new QWidget( this, "KFileDialog::mainWidget");
    setMainWidget( d->mainWidget );

    d->completionLock = false;
    d->myStatusLine = 0;

    toolbar= new KToolBar( d->mainWidget, "KFileDialog::toolbar", true);

    KIconLoader::Size size = KIconLoader::Small;
    KURLComboBox *combo = new KURLComboBox( KURLComboBox::Directories, true,
					    toolbar, "path combo" );
    KURL u = QDir::rootDirPath();
    QString text = i18n("Root Directory: %1").arg( u.path() );
    combo->addDefaultURL( u, KMimeType::pixmapForURL( u, 0, size ), text );

    u = QDir::homeDirPath();
    text = i18n("Home Directory: %1").arg( u.path( +1 ) );
    combo->addDefaultURL( u, KMimeType::pixmapForURL( u, 0, size ), text );

    u = KGlobalSettings::desktopPath();
    text = i18n("Desktop: %1").arg( u.path( +1 ) );
    combo->addDefaultURL( u, KMimeType::pixmapForURL( u, 0, size ), text );

    connect( combo, SIGNAL( urlActivated( const KURL&  )),
	     this,  SLOT( pathComboActivated( const KURL& ) ));
    connect( combo, SIGNAL( returnPressed( const QString&  )),
	     this,  SLOT( pathComboReturnPressed( const QString& ) ));
    connect( combo, SIGNAL(textChanged( const QString& )),
	     SLOT( pathComboChanged( const QString& ) ));

    QToolTip::add( combo, i18n("Often used directories") );
    d->pathCombo = combo;

    bookmarksMenu = 0L;

    if (!lastDirectory)
    {
	qAddPostRoutine( cleanup );
	lastDirectory = new KURL();
    }

    if (!dirName.isEmpty())
	*lastDirectory = KCmdLineArgs::makeURL( dirName.latin1() );
    else
	if (lastDirectory->isEmpty())
	    *lastDirectory = QDir::currentDirPath();

    d->url = *lastDirectory;

    ops = new KDirOperator(*lastDirectory, d->mainWidget, "KFileDialog::ops");
    connect(ops, SIGNAL(updateInformation(int, int)),
	    SLOT(updateStatusLine(int, int)));
    connect(ops, SIGNAL(urlEntered(const KURL&)),
	    SLOT(urlEntered(const KURL&)));
    connect(ops, SIGNAL(fileHighlighted(const KFileViewItem *)),
	    SLOT(fileHighlighted(const KFileViewItem *)));
    connect(ops, SIGNAL(fileSelected(const KFileViewItem *)),
	    SLOT(fileSelected(const KFileViewItem *)));
    connect(ops, SIGNAL(finishedLoading()),
	    SLOT(slotLoadingFinished()));
			
    d->pathCombo->setCompletionObject( ops->dirCompletionObject(), false );

    KActionCollection *coll = ops->actionCollection();
    coll->action( "up" )->plug( toolbar );
    coll->action( "back" )->plug( toolbar );
    coll->action( "forward" )->plug( toolbar );
    coll->action( "home" )->plug( toolbar );
    coll->action( "reload" )->plug( toolbar );


    bookmarks= new KFileBookmarkManager();
    CHECK_PTR( bookmarks );
    connect( bookmarks, SIGNAL( changed() ),
	     this, SLOT( bookmarksChanged() ) );

    QString bmFile = locate("data", QString::fromLatin1("kdeui/bookmarks.html"));
    if (!bmFile.isNull())
	bookmarks->read(bmFile);

    toolbar->insertButton(QString::fromLatin1("flag"),
			  (int)HOTLIST_BUTTON, true,
			  i18n("Bookmarks"));

    toolbar->insertButton(QString::fromLatin1("configure"),
			  (int)CONFIGURE_BUTTON, true,
			  i18n("Configure this dialog"));

    connect(toolbar, SIGNAL(clicked(int)),
	    SLOT(toolbarCallback(int)));
    // for the bookmark "menu"
    connect(toolbar, SIGNAL(pressed(int)),
    	    this, SLOT(toolbarPressedCallback(int)));

    toolbar->insertWidget(PATH_COMBO, 0, d->pathCombo);

    toolbar->setItemAutoSized (PATH_COMBO);
    toolbar->setIconSize(KIconLoader::Medium);
    toolbar->setIconText(KToolBar::IconOnly);
    toolbar->setBarPos(KToolBar::Top);
    toolbar->enableMoving(false);
    toolbar->adjustSize();

    locationEdit = new KFileComboBox(true, d->mainWidget, "LocationEdit");
    locationEdit->setInsertionPolicy(QComboBox::NoInsertion);
    locationEdit->setFocus();
    locationEdit->adjustSize();
    locationEdit->setCompletionObject( ops->completionObject(), false );

    connect( locationEdit, SIGNAL( completion( const QString& )),
	     SLOT( fileCompletion( const QString& )));
    connect( locationEdit, SIGNAL( rotateUp() ), 
	     locationEdit, SLOT( iterateUpInList() ));
    connect( locationEdit, SIGNAL( rotateDown() ), 
	     locationEdit, SLOT( iterateDownInList() ));
    
    connect( d->pathCombo, SIGNAL( completion( const QString& )),
	     SLOT( dirCompletion( const QString& )));
    connect( d->pathCombo, SIGNAL( rotateUp() ), 
	     d->pathCombo, SLOT( iterateUpInList() ));
    connect( d->pathCombo, SIGNAL( rotateDown() ), 
	     d->pathCombo, SLOT( iterateDownInList() ));
    
    d->locationLabel = new QLabel(locationEdit, i18n("&Location:"), 
				  d->mainWidget);
    d->locationLabel->adjustSize();
    d->locationLabel->setMinimumSize(d->locationLabel->width(),
				     locationEdit->height());
    locationEdit->setFixedHeight(d->locationLabel->height());

    connect( locationEdit, SIGNAL( returnPressed() ),
    	     SLOT( slotOk()));
    connect(locationEdit, SIGNAL( activated( const QString&  )),
	    this,  SLOT( locationActivated( const QString& ) ));

    d->filterLabel = new QLabel(i18n("&Filter:"), d->mainWidget);
    d->filterLabel->adjustSize();
    d->filterLabel->setMinimumWidth(d->filterLabel->width());

    filterWidget = new KFileFilter(d->mainWidget, "KFileDialog::filterwidget");
    filterWidget->setFilter(filter);
    d->filterLabel->setBuddy(filterWidget);
    filterWidget->adjustSize();
    filterWidget->setMinimumWidth(100);
    filterWidget->setFixedHeight(filterWidget->height());
    connect(filterWidget, SIGNAL(filterChanged()),
	    SLOT(slotFilterChanged()));
    ops->setNameFilter(filterWidget->currentFilter());

    // Get the config object
    KSimpleConfig *kc = new KSimpleConfig(QString::fromLatin1("kdeglobals"),
                                          false);
    QString oldGroup = kc->group();
    kc->setGroup( ConfigGroup );
    d->showStatusLine = kc->readBoolEntry(ConfigShowStatusLine,
					  DefaultShowStatusLine);

    initGUI(); // activate GM

    readRecentFiles( KGlobal::config() );
    //    readRecentFiles( kc );


    adjustSize();
    readConfig( kc, ConfigGroup );
    delete kc;

    // FIXME:
    // set the view _after_ calling setSelection(), otherwise we would read
    // the startdirectory twice. This must be fixed somehow else, tho.
    setSelection(d->url.url());
    ops->setView(KFile::Default);
}


kdelibs'KFileDialog::setLocationLabel() (./kdelibs/kfile/kfiledialog.cpp:311)

void KFileDialog::setLocationLabel(const QString& text)
{
    d->locationLabel->setText(text);
}


kdelibs'KFileDialog::cleanup() (./kdelibs/kfile/kfiledialog.cpp:316)

void KFileDialog::cleanup() {
    delete lastDirectory;
    lastDirectory = 0;
}


kdelibs'KFileDialog::setFilter() (./kdelibs/kfile/kfiledialog.cpp:321)

void KFileDialog::setFilter(const QString& filter)
{
    filterWidget->setFilter(filter);
    ops->setNameFilter(filterWidget->currentFilter());
}


kdelibs'KFileDialog::currentFilter() (./kdelibs/kfile/kfiledialog.cpp:327)

QString KFileDialog::currentFilter() const
{
    return filterWidget->currentFilter();
}


kdelibs'KFileDialog::setPreviewWidget() (./kdelibs/kfile/kfiledialog.cpp:332)

void KFileDialog::setPreviewWidget(const QWidget *w) {
    ops->setPreviewWidget(w);
}


// FIXME: check for "existing" flag here?

kdelibs'KFileDialog::slotOk() (./kdelibs/kfile/kfiledialog.cpp:338)

void KFileDialog::slotOk()
{
    kdDebug(kfile_area) << "slotOK\n";

    if ( (mode() & KFile::LocalOnly) == KFile::LocalOnly &&
	 !ops->url().isLocalFile() ) {
	KMessageBox::sorry( d->mainWidget,
			    i18n("You can only select local files."),
			    i18n("Remote files not accepted") );
	return;
    }
	

    if ( (mode() & KFile::Directory) != KFile::Directory )
	if ( locationEdit->currentText().stripWhiteSpace().isEmpty() )
	    return;


    if ( (mode() & KFile::Files) == KFile::Files ) // multiselection mode
	d->url = ops->url();

    else {
	QString url = locationEdit->currentText();
	if ( url.at(1) == QChar('/') ) // absolute path
	    d->url.setPath( url );
	else if ( url.contains('/') ) { // relative path
	    url.prepend( ops->url().url(+1) );
	    d->url = url;
	}
	else {
	    KURL u( ops->url(), url );
	    d->url = u;
	}

	if ( d->url.isMalformed() ) {
	    KMessageBox::sorry( d->mainWidget, i18n("Sorry,\n%1\ndoesn't look like a valid URL\nto me.").arg(d->url.url()), i18n("Invalid URL") );
	}
    }


    // d->url is a correct URL now


    if ( (mode() & KFile::Directory) == KFile::Directory ) {
	kdDebug(kfile_area) << "Directory\n";
	if ( QFileInfo(d->url.path()).isDir() ) { // FIXME QFileInfo == local!
	    locationEdit->insertItem( d->url.url(+1), 1 );
	    accept();
	}
	else // FIXME: !exists() -> create dir
	    KMessageBox::error( d->mainWidget,
				i18n("You have to select a directory!"),
				i18n("Not a directory") );
	return;
    }

    KIO::StatJob *job = 0L;
    d->statJobs.clear();


    if ( (mode() & KFile::Files) == KFile::Files ) {
	kdDebug(kfile_area) << "Files\n";
	d->filenames = locationEdit->currentText();
	KURL::List list = parseSelectedURLs();
	KURL::List::ConstIterator it = list.begin();
	for ( ; it != list.end(); ++it ) {
	    job = KIO::stat( *it );
	    d->statJobs.append( job );
	    connect( job, SIGNAL( result(KIO::Job *) ),
		     SLOT( slotStatResult( KIO::Job *) ));
	}
	return;
    }

    job = KIO::stat(d->url);
    d->statJobs.append( job );
    connect(job, SIGNAL(result(KIO::Job*)), SLOT(slotStatResult(KIO::Job*)));
}


// FIXME : count all errors and show messagebox when d->statJobs.count() == 0
// in case of an error, we cancel the whole operation (clear d->statJobs and
// don't call accept)

kdelibs'KFileDialog::slotStatResult() (./kdelibs/kfile/kfiledialog.cpp:421)

void KFileDialog::slotStatResult(KIO::Job* job)
{
    kdDebug(kfile_area) << "slotStatResult" << endl;
    KIO::StatJob *sJob = static_cast<KIO::StatJob *>( job );

    if ( !d->statJobs.removeRef( sJob ) )
       return;

    int count = d->statJobs.count();

    // errors mean in general, the location is no directory ;/
    // Can we be sure that it is exististant at all? (pfeiffer)
    if (sJob->error() && count == 0)
       accept();

    KIO::UDSEntry t = sJob->statResult();
    bool isDir = false;
    for (KIO::UDSEntry::ConstIterator it = t.begin();
        it != t.end(); ++it) {
       if ((*it).m_uds == KIO::UDS_FILE_TYPE ) {
           isDir = S_ISDIR( (mode_t)((*it).m_long));
           break;
       }
    }

    // currently, we only stat in File[s] mode, not Directory mode, so a
    // directory means ERROR
    if (isDir) {
	if ( count == 0 )
	    setURL( sJob->url() );
	d->statJobs.clear();
	return;
    }

    kdDebug(kfile_area) << "filename " << sJob->url().url() << endl;
    locationEdit->insertItem( sJob->url().url(), 1 );

    if ( count == 0 )
	accept();
}

	

kdelibs'KFileDialog::accept() (./kdelibs/kfile/kfiledialog.cpp:463)

void KFileDialog::accept()
{
    *lastDirectory = ops->url();
    KSimpleConfig *c = new KSimpleConfig(QString::fromLatin1("kdeglobals"),
                                         false);
    saveConfig( c, ConfigGroup );
    saveRecentFiles( KGlobal::config() );
    delete c;

    KDialogBase::accept();
}



kdelibs'KFileDialog::fileHighlighted() (./kdelibs/kfile/kfiledialog.cpp:476)

void KFileDialog::fileHighlighted(const KFileViewItem *i)
{
    if (i->isDir())
        return;

    d->url = i->url();
    if ( (ops->mode() & KFile::Files) == KFile::Files )
	multiSelectionChanged( i );
    else
	if ( !d->completionLock ) {
	    locationEdit->setCurrentItem( 0 );
	    locationEdit->setEditText( i->name() );
	}
    emit fileHighlighted(d->url.url());
}


kdelibs'KFileDialog::fileSelected() (./kdelibs/kfile/kfiledialog.cpp:492)

void KFileDialog::fileSelected(const KFileViewItem *i)
{
    if (i->isDir())
        return;
    d->url = i->url();
    if ( (ops->mode() & KFile::Files) == KFile::Files )
	multiSelectionChanged( i );
    else {
	locationEdit->setCurrentItem( 0 );
	locationEdit->setEditText( i->name() );
    }

    emit fileSelected(d->url.url());
}


// I know it's slow to always iterate thru the whole filelist
// (ops->selectedItems()), but what can we do?

kdelibs'KFileDialog::multiSelectionChanged() (./kdelibs/kfile/kfiledialog.cpp:510)

void KFileDialog::multiSelectionChanged(const KFileViewItem *)
{
    if ( d->completionLock ) // FIXME: completion with multiselection?
	return;

    KFileViewItem *item;
    const KFileViewItemList *list = ops->selectedItems();
    if ( !list ) {
	locationEdit->clearEdit();
	return;
    }

    static QString begin = QString::fromLatin1(" \"");
    KFileViewItemListIterator it ( *list );
    QString text;
    while ( (item = it.current()) ) {
	text.append( begin ).append( item->name() ).append( '\"' );
	++it;
    }
    locationEdit->setCurrentItem( 0 );
    locationEdit->setEditText( text.stripWhiteSpace() );
}



kdelibs'KFileDialog::initGUI() (./kdelibs/kfile/kfiledialog.cpp:534)

void KFileDialog::initGUI()
{
    if (d->boxLayout)
	delete d->boxLayout; // deletes all sub layouts

    d->boxLayout = new QVBoxLayout( d->mainWidget, 0, 2);
    d->boxLayout->addWidget(toolbar, AlignTop);
    d->boxLayout->addWidget(ops, 4);
    d->boxLayout->addSpacing(3);

    d->lafBox= new QGridLayout(2, 2, 7);
    d->boxLayout->addLayout(d->lafBox, 0);
    d->lafBox->addWidget(d->locationLabel, 0, 0);
    d->lafBox->addWidget(locationEdit, 0, 1);

    d->lafBox->addWidget(d->filterLabel, 1, 0);
    d->lafBox->addWidget(filterWidget, 1, 1);

    d->lafBox->setColStretch(0, 1);
    d->lafBox->setColStretch(1, 4);
    d->lafBox->setColStretch(2, 1);

    delete d->myStatusLine;
    d->myStatusLine = 0L;

    // Add the status line
    if ( d->showStatusLine ) {
	d->myStatusLine = new QLabel( d->mainWidget, "StatusBar" );
	updateStatusLine(ops->numDirs(), ops->numFiles());
        d->myStatusLine->adjustSize();
	d->myStatusLine->setFrameStyle( QFrame::Panel | QFrame::Sunken );
	d->myStatusLine->setAlignment( AlignHCenter | AlignVCenter );
	d->myStatusLine->setMinimumSize( d->myStatusLine->sizeHint() );
	d->boxLayout->addWidget( d->myStatusLine, 0 );
	d->myStatusLine->show();
    }

    d->boxLayout->addSpacing(3);
}


kdelibs'KFileDialog::~KFileDialog() (./kdelibs/kfile/kfiledialog.cpp:574)

KFileDialog::~KFileDialog()
{
    hide();
    delete bookmarks;
    delete d->boxLayout; // we can't delete a widget being managed by a layout,
    d->boxLayout = 0;    // so we delete the layout before (Qt bug to be fixed)
    delete ops;
    delete d;
}


kdelibs'KFileDialog::slotFilterChanged() (./kdelibs/kfile/kfiledialog.cpp:584)

void KFileDialog::slotFilterChanged() // SLOT
{
    ops->setNameFilter(filterWidget->currentFilter());
    emit filterChanged(filterWidget->currentFilter());
}



kdelibs'KFileDialog::pathComboChanged() (./kdelibs/kfile/kfiledialog.cpp:591)

void KFileDialog::pathComboChanged( const QString& txt )
{
    if ( d->completionLock )
	return;

    QString text = txt;
    QString newText = text.left(d->pathCombo->cursorPosition() -1);
    if ( text.at( 0 ) == '/' )
	text.prepend(QString::fromLatin1("file:"));

    KURL url( text );

    // don't mess with malformed urls or remote urls without directory or host
    if ( url.isMalformed() ||
	 ( text.find(QString::fromLatin1("file:/")) != 0 &&
	   ( url.directory().isNull() || url.host().isNull()) ) ) {
        d->completionHack = newText;
        return;
    }

    // the user is backspacing -> don't annoy him with completions
    if ( autoDirectoryFollowing && d->completionHack.find( newText ) == 0 ) {
        // but we can follow the directories, if configured so

	// find out the current directory according to combobox and cd into
	int l = text.length() - 1;
	while (!text.isEmpty() && text[l] != '/')
	    l--;

	KURL newLocation(text.left(l+1));

	if ( !newLocation.isMalformed() && newLocation != ops->url() ) {
	    setURL(text.left(l), true);
	    d->pathCombo->setEditText(text);
	}
    }

    // typing forward, ending with a / -> cd into the directory
    else if ( autoDirectoryFollowing &&
	      text.at(text.length()-1) == '/' && ops->url() != text ) {
	d->selection = QString::null;
        setURL( text, false );
    }

    d->completionHack = newText;
}



kdelibs'KFileDialog::setURL() (./kdelibs/kfile/kfiledialog.cpp:639)

void KFileDialog::setURL(const KURL& url, bool clearforward)
{
    d->selection = QString::null;
    ops->setURL( url, clearforward);
}

// Protected

kdelibs'KFileDialog::urlEntered() (./kdelibs/kfile/kfiledialog.cpp:646)

void KFileDialog::urlEntered(const KURL& url)
{
    QString filename;
    if (!locationEdit->lineEdit()->edited()) 
       filename = locationEdit->currentText();

    d->selection = QString::null;
    if ( d->pathCombo->count() != 0 ) { // little hack
	d->pathCombo->setURL( url );
    }
    const QString urlstr = url.url(1);

    locationEdit->blockSignals( true );
    locationEdit->setCurrentItem( 0 );
    locationEdit->setEditText( filename );

    locationEdit->blockSignals( false );
}


kdelibs'KFileDialog::locationActivated() (./kdelibs/kfile/kfiledialog.cpp:665)

void KFileDialog::locationActivated( const QString& url )
{
    setSelection( url );
}


kdelibs'KFileDialog::pathComboActivated() (./kdelibs/kfile/kfiledialog.cpp:670)

void KFileDialog::pathComboActivated( const KURL& url)
{
    setURL( url );
}


kdelibs'KFileDialog::pathComboReturnPressed() (./kdelibs/kfile/kfiledialog.cpp:675)

void KFileDialog::pathComboReturnPressed( const QString& url )
{
    setURL( url );
}


kdelibs'KFileDialog::addToBookmarks() (./kdelibs/kfile/kfiledialog.cpp:680)

void KFileDialog::addToBookmarks() // SLOT
{
    bookmarks->add(ops->url().url(), ops->url().url());
    bookmarks->write();
}


kdelibs'KFileDialog::bookmarksChanged() (./kdelibs/kfile/kfiledialog.cpp:686)

void KFileDialog::bookmarksChanged() // SLOT
{
    kdDebug() << "bookmarksChanged" << endl;
}


kdelibs'KFileDialog::fillBookmarkMenu() (./kdelibs/kfile/kfiledialog.cpp:691)

void KFileDialog::fillBookmarkMenu( KFileBookmark *parent, QPopupMenu *menu, int &id )
{
    KFileBookmark *bm;

    for ( bm = parent->getChildren().first(); bm != NULL;
	  bm = parent->getChildren().next() )
    {
	if ( bm->getType() == KFileBookmark::URL )
	{
	    menu->insertItem( bm->getText(), id );
	    id++;
	}
	else
	{
	    QPopupMenu *subMenu = new QPopupMenu;
	    menu->insertItem( bm->getText(), subMenu );
	    fillBookmarkMenu( bm, subMenu, id );
	}
    }
}


kdelibs'KFileDialog::toolbarCallback() (./kdelibs/kfile/kfiledialog.cpp:712)

void KFileDialog::toolbarCallback(int i) // SLOT
{
    if (i == CONFIGURE_BUTTON) {
	KFileDialogConfigureDlg conf(this, "filedlgconf");
	if (conf.exec() == QDialog::Accepted) {
	
	    KSimpleConfig *c = new KSimpleConfig(QString::fromLatin1("kdeglobals"),
						 false);
	    c->setGroup( ConfigGroup );
	
	    delete d->boxLayout; // this removes all child layouts too
	    d->boxLayout = 0;
	
	    d->showStatusLine =
		c->readBoolEntry(QString::fromLatin1("ShowStatusLine"), DefaultShowStatusLine);
	    delete c;
	    kdDebug(kfile_area) << "showStatusLine " << d->showStatusLine
				<< endl;

	    initGUI(); // add them back to the layout managment
	}
    }
}




kdelibs'KFileDialog::toolbarPressedCallback() (./kdelibs/kfile/kfiledialog.cpp:738)

void KFileDialog::toolbarPressedCallback(int i)
{
    int id= idStart;
    if (i == HOTLIST_BUTTON) {
	// Build the menu on first use
	if (bookmarksMenu == 0) {
	    bookmarksMenu= new QPopupMenu;
	    bookmarksMenu->insertItem(i18n("Add to bookmarks"), this,
				      SLOT(addToBookmarks()));
	    bookmarksMenu->insertSeparator();
	    fillBookmarkMenu( bookmarks->getRoot(), bookmarksMenu, id );
	}

	QPoint p;
	KToolBarButton *btn= toolbar->getButton(HOTLIST_BUTTON);
	p= btn->mapToGlobal(QPoint(0, btn->height()));
	bookmarksMenu->move(p);

	int choice= bookmarksMenu->exec();
	QEvent ev(QEvent::Leave);
	QMouseEvent mev (QEvent::MouseButtonRelease,
			 QCursor::pos(), LeftButton, LeftButton);
	QApplication::sendEvent(btn, &ev);
	QApplication::sendEvent(btn, &mev);

	if (choice == 0) {
	    // add current to bookmarks
	    addToBookmarks();
	}
	else if (choice > 0) {
	    // Select a bookmark (this will not work if there are submenus)
	    int i= 1;
	    kdDebug(kfile_area) << "Bookmark: choice was " << choice << endl;
	    KFileBookmark *root= bookmarks->getRoot();
	    for (KFileBookmark *b= root->getChildren().first();
		 b != 0; b= root->getChildren().next()) {
		if (i == choice) {
                    kdDebug(kfile_area) << "Bookmark: opening " << b->getURL() << endl;
		    setURL(b->getURL(), true);
		}
		i++;
	    }
	}

	delete bookmarksMenu;
	bookmarksMenu= 0;
    }
}


kdelibs'KFileDialog::setSelection() (./kdelibs/kfile/kfiledialog.cpp:787)

void KFileDialog::setSelection(const QString& url)
{
    kdDebug(kfile_area) << "setSelection " << url << endl;

    if (url.isEmpty()) {
	d->selection = QString::null;
	return;
    }

    KURL u(url);
    if (u.isMalformed()) // perhaps we have a relative path!?
	u = KURL(ops->url(),  url);

    if (u.isMalformed()) { // if it still is
        warning("%s is not a correct argument for setSelection!", debugString(url));
	return;
    }

    if (!u.isLocalFile()) { // no way to detect, if we have a directory!?
	d->url = u;
	return;
    }

    /* we strip the first / from the path to avoid file://usr which means
     *  / on host usr
     */
    KFileViewItem i(QString::fromLatin1("file:"), u.path());
    //    KFileViewItem i(u.path());
    if (i.isDir())
	setURL(u, true);
    else {
	QString filename = u.url();
	int sep = filename.findRev('/');
	if (sep >= 0) { // there is a / in it
	    setURL(filename.left(sep), true);
	    filename = filename.mid(sep+1, filename.length() - sep);
	    kdDebug(kfile_area) << "filename " << filename << endl;
	    d->selection = filename;
	    locationEdit->setCurrentItem( 0 );
	    locationEdit->setEditText( filename );
	}
	d->url = KURL(ops->url(), filename); // FIXME make filename an url
    }
}


kdelibs'KFileDialog::slotLoadingFinished() (./kdelibs/kfile/kfiledialog.cpp:832)

void KFileDialog::slotLoadingFinished()
{
    if ( !d->selection.isNull() )
	ops->setCurrentItem( d->selection );
}



kdelibs'KFileDialog::dirCompletion() (./kdelibs/kfile/kfiledialog.cpp:839)

void KFileDialog::dirCompletion( const QString& dir ) // SLOT
{
    QString base = ops->url().url();

    // if someone uses completion, he doesn't like the current selection
    d->selection = QString::null;

    QString text = dir;
    if ( text.at( 0 ) == '/' )
	text.prepend( QString::fromLatin1("file:") );

    if ( KURL(text).isMalformed() )
	return; // invalid entry in path combo

    d->completionLock = true;

    if (text.left(base.length()) == base) {
	QString complete =
	    ops->makeDirCompletion( text.right(text.length() - base.length()));

	if (!complete.isNull()) {
	    QString newText = base + complete;
	    d->pathCombo->setEditText( newText );
	    d->url = newText;
	}
    }
    d->completionLock = false;
}



kdelibs'KFileDialog::fileCompletion() (./kdelibs/kfile/kfiledialog.cpp:869)

void KFileDialog::fileCompletion( const QString& file )
{
    d->completionLock = true;
    QString text = ops->makeCompletion( file );
    if ( !text.isEmpty() )
	locationEdit->setCompletion( text );
    d->completionLock = false;
}


kdelibs'KFileDialog::updateStatusLine() (./kdelibs/kfile/kfiledialog.cpp:878)

void KFileDialog::updateStatusLine(int dirs, int files)
{
    if (!d->myStatusLine)
	return;

    QString lStatusText;
    QString lFileText, lDirText;

    if ( dirs == 1 )
	lDirText = i18n("directory");
    else
	lDirText = i18n("directories");

    if ( files == 1 )
        lFileText = i18n("file");
    else
	lFileText = i18n("files");

    if (dirs != 0 && files != 0) {
	lStatusText = i18n("%1 %2 and %3 %4")
	    .arg(dirs).arg( lDirText )
	    .arg(files).arg( lFileText );
    } else if ( dirs == 0 )
	lStatusText = i18n("%1 %2").arg(files).arg( lFileText );
    else
	lStatusText = i18n("%1 %2").arg(dirs).arg( lDirText );

    d->myStatusLine->setText(lStatusText);
}


kdelibs'KFileDialog::getOpenFileName() (./kdelibs/kfile/kfiledialog.cpp:908)

QString KFileDialog::getOpenFileName(const QString& dir, const QString& filter,
				     QWidget *parent, const QString& caption)
{
    KFileDialog dlg(dir, filter, parent, "filedialog", true);

    dlg.setCaption(caption.isNull() ? i18n("Open") : caption);

    dlg.exec();

    QString filename = dlg.selectedFile();
    if (!filename.isEmpty())
        KRecentDocument::add(filename, false);

    return filename;
}


kdelibs'KFileDialog::getOpenFileNames() (./kdelibs/kfile/kfiledialog.cpp:924)

QStringList KFileDialog::getOpenFileNames(const QString& dir,const QString& filter,
				     QWidget *parent, const QString& caption)
{
    KFileDialog dlg(dir, filter, parent, "filedialog", true);

    dlg.setCaption(caption.isNull() ? i18n("Open") : caption);

    dlg.exec();

    QStringList list = dlg.selectedFiles();
    QStringList::Iterator it = list.begin();
    for( ; it != list.end(); ++it )
        KRecentDocument::add( *it, false );

    return list;
}


kdelibs'KFileDialog::getOpenURL() (./kdelibs/kfile/kfiledialog.cpp:941)

KURL KFileDialog::getOpenURL(const QString& dir, const QString& filter,
				QWidget *parent, const QString& caption)
{
    KFileDialog dlg(dir, filter, parent, "filedialog", true);

    dlg.setCaption(caption.isNull() ? i18n("Open") : caption);

    dlg.exec();

    const KURL& url = dlg.selectedURL();
    if (!url.isMalformed())
        KRecentDocument::add(url.url(-1), false);

    return url;
}

KURL::List KFileDialog::getOpenURLs(const QString& dir,
					  const QString& filter,
					  QWidget *parent,
					  const QString& caption)
{
    KFileDialog dlg(dir, filter, parent, "filedialog", true);

    dlg.setCaption(caption.isNull() ? i18n("Open") : caption);

    dlg.exec();

    KURL::List list = dlg.selectedURLs();
    KURL::List::ConstIterator it = list.begin();
    for( ; it != list.end(); ++it ) {
	if ( !(*it).isMalformed() )
	    KRecentDocument::add( (*it).url(-1), false );
    }

    return list;
}


kdelibs'KFileDialog::getExistingDirectory() (./kdelibs/kfile/kfiledialog.cpp:978)

QString KFileDialog::getExistingDirectory(const QString& dir,
					  QWidget *parent,
					  const QString& caption)
{
    KFileDialog dlg(dir, QString::null, parent, "filedialog", true);
    dlg.setMode(KFile::Directory);

    dlg.setCaption(caption.isNull() ? i18n("Select Directory") : caption);
    dlg.exec();

    return dlg.selectedURL().path();
}


kdelibs'KFileDialog::selectedURL() (./kdelibs/kfile/kfiledialog.cpp:991)

KURL KFileDialog::selectedURL() const
{
    if ( result() == QDialog::Accepted )
	return d->url;
    else
	return KURL();
}

KURL::List KFileDialog::selectedURLs() const
{
    KURL::List list;
    if ( result() == QDialog::Accepted ) {
	if ( (ops->mode() & KFile::Files) == KFile::Files )
	    list = parseSelectedURLs();
	else
	    list.append( d->url );
    }
    return list;
}


KURL::List& KFileDialog::parseSelectedURLs() const
{
    if ( d->filenames.isEmpty() )
	return d->urlList;

    d->urlList.clear();
    if ( d->filenames.contains( '/' )) { // assume _one_ absolute filename
	KURL u( d->filenames );
	if ( !u.isMalformed() )
	    d->urlList.append( u );
	else
	    KMessageBox::error( d->mainWidget,
				i18n("The chosen filename(s) don't\nappear to be valid."), i18n("Invalid filename(s)") );
    }

    else {
	QString name;
	QString url = ops->url().url( +1 );
	static QRegExp r( QString::fromLatin1( "\"" ) );
	static QString empty = QString::fromLatin1("");

	QTextStream t( &(d->filenames), IO_ReadOnly );
	while ( !t.eof() ) {
	    t >> name;
	    name.replace( r, empty );
	    name.prepend( url );
	    d->urlList.append( KURL( name ) );
	}
    }
    d->filenames = QString::null; // indicate that we parsed that one

    return d->urlList;
}



kdelibs'KFileDialog::baseURL() (./kdelibs/kfile/kfiledialog.cpp:1047)

KURL KFileDialog::baseURL() const
{
    return ops->url();
}


kdelibs'KFileDialog::selectedFile() (./kdelibs/kfile/kfiledialog.cpp:1052)

QString KFileDialog::selectedFile() const
{
    if ( result() == QDialog::Accepted )
    {
       if (d->url.isLocalFile())
          return d->url.path();
    }
    return QString::null;
}


kdelibs'KFileDialog::selectedFiles() (./kdelibs/kfile/kfiledialog.cpp:1062)

QStringList KFileDialog::selectedFiles() const
{
    QStringList list;

    if ( result() == QDialog::Accepted ) {
	QString name;
	QString url = ops->url().path( +1 );
	// FIXME: check for local files?

	static QRegExp r( QString::fromLatin1( "\"" ) );
	static QString empty = QString::fromLatin1("");
	QTextStream t( &(d->filenames), IO_ReadOnly );
	while ( !t.eof() ) {
	    t >> name;
	    name.replace( r, empty );
	    name.prepend( url );
	    list.append( name );
	}
    }
    return list;
}


kdelibs'KFileDialog::getSaveFileName() (./kdelibs/kfile/kfiledialog.cpp:1084)

QString KFileDialog::getSaveFileName(const QString& dir, const QString& filter,
				     QWidget *parent,
				     const QString& caption)
{
    KFileDialog dlg(dir, filter, parent, "filedialog", true);

    dlg.setCaption(caption.isNull() ? i18n("Save As") : caption);

    dlg.exec();

    QString filename = dlg.selectedFile();
    if (!filename.isEmpty())
        KRecentDocument::add(filename, false);

    return filename;
}


kdelibs'KFileDialog::getSaveURL() (./kdelibs/kfile/kfiledialog.cpp:1101)

KURL KFileDialog::getSaveURL(const QString& dir, const QString& filter,
				     QWidget *parent,
				     const QString& caption)
{
    KFileDialog dlg(dir, filter, parent, "filedialog", true);

    dlg.setCaption(caption.isNull() ? i18n("Save As") : caption);

    dlg.exec();

    KURL url = dlg.selectedURL();
    if (!url.isMalformed())
        KRecentDocument::add(url.url(-1), false);

    return url;
}


kdelibs'KFileDialog::show() (./kdelibs/kfile/kfiledialog.cpp:1118)

void KFileDialog::show()
{
    QDialog::show();
}


kdelibs'KFileDialog::setMode() (./kdelibs/kfile/kfiledialog.cpp:1123)

void KFileDialog::setMode( KFile::Mode m )
{
    ops->setMode(m);
}

KFile::Mode KFileDialog::mode() const
{
    return ops->mode();
}



kdelibs'KFileDialog::readConfig() (./kdelibs/kfile/kfiledialog.cpp:1134)

void KFileDialog::readConfig( KConfig *kc, const QString& group )
{
    if ( !kc )
	return;

    QString oldGroup = kc->group();
    if ( !group.isEmpty() )
	kc->setGroup( group );

    ops->readConfig( kc, group );

    KURLComboBox *combo = d->pathCombo;
    combo->setMaxItems( kc->readNumEntry( RecentURLsNumber,
					  DefaultRecentURLsNumber ) );
    combo->setURLs( kc->readListEntry( RecentURLs ) );
    combo->setURL( ops->url() );
    autoDirectoryFollowing = kc->readBoolEntry( AutoDirectoryFollowing,
						DefaultDirectoryFollowing );


    int w, h;
    QWidget *desk = QApplication::desktop();
    w = QMIN( 530, (int) (desk->width() * 0.5)); // maximum default width = 530
    h = (int) (desk->height() * 0.4);

    w = kc->readNumEntry( DialogWidth.arg( desk->width()), w );
    h = kc->readNumEntry( DialogHeight.arg( desk->height()), h );

    int w1 = minimumSize().width();
    int w2 = toolbar->sizeHint().width() + 10;
    if (w1 < w2)
	setMinimumWidth(w2);

    resize(w, h);
    kc->setGroup( oldGroup );
}


kdelibs'KFileDialog::saveConfig() (./kdelibs/kfile/kfiledialog.cpp:1171)

void KFileDialog::saveConfig( KConfig *kc, const QString& group )
{
    if ( !kc )
	return;

    QString oldGroup = kc->group();
    if ( !group.isEmpty() )
	kc->setGroup( group );

    QWidget *desk = kapp->desktop();
    kc->writeEntry( RecentURLs, d->pathCombo->urls() );
    kc->writeEntry( DialogWidth.arg( desk->width() ), width() );
    kc->writeEntry( DialogHeight.arg( desk->height() ), height() );

    ops->saveConfig( kc, group );
    kc->setGroup( oldGroup );
    kc->sync();
}



kdelibs'KFileDialog::readRecentFiles() (./kdelibs/kfile/kfiledialog.cpp:1191)

void KFileDialog::readRecentFiles( KConfig *kc )
{
    QString oldGroup = kc->group();
    kc->setGroup( ConfigGroup );

#warning Still the KConfig-bug (reparseConfiguration() needed)
    kc->reparseConfiguration();
    locationEdit->setMaxItems( kc->readNumEntry( RecentFilesNumber,
						 DefaultRecentURLsNumber ) );
    locationEdit->setURLs( kc->readListEntry( RecentFiles ) );
    locationEdit->insertItem( QString::null, 0 ); // dummy item without pixmap
    locationEdit->setCurrentItem( 0 );

    kc->setGroup( oldGroup );
}


kdelibs'KFileDialog::saveRecentFiles() (./kdelibs/kfile/kfiledialog.cpp:1207)

void KFileDialog::saveRecentFiles( KConfig *kc )
{
    QString oldGroup = kc->group();
    kc->setGroup( ConfigGroup );

    kc->writeEntry( RecentFiles, locationEdit->urls() );
    kc->sync();

    kc->setGroup( oldGroup );
}


///////////////////