You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
313 lines
13 KiB
313 lines
13 KiB
15 years ago
|
/* This file is part of the KDE libraries
|
||
|
Copyright (C) 2003 Joseph Wenninger <jowenn@kde.org>
|
||
|
2003 Andras Mantia <amantia@freemail.hu>
|
||
|
|
||
|
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 __KENCODINGFILEDIALOG_H__
|
||
|
#define __KENCODINGFILEDIALOG_H__
|
||
|
|
||
12 years ago
|
#include <tdefiledialog.h>
|
||
15 years ago
|
|
||
|
struct KEncodingFileDialogPrivate;
|
||
|
|
||
|
/**
|
||
|
* Provides a user (and developer) friendly way to
|
||
|
* select files with support for choosing encoding
|
||
|
*
|
||
|
*
|
||
|
* The dialog has been designed to allow applications to customise it
|
||
14 years ago
|
* by subclassing. It uses geometry management to ensure that subclasses
|
||
|
* can easily add children that will be incorporated into the layout.
|
||
15 years ago
|
*/
|
||
|
|
||
12 years ago
|
class TDEIO_EXPORT KEncodingFileDialog : public KFileDialog
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
class Result {
|
||
|
public:
|
||
14 years ago
|
TQStringList fileNames;
|
||
15 years ago
|
KURL::List URLs;
|
||
14 years ago
|
TQString encoding;
|
||
15 years ago
|
};
|
||
|
|
||
|
/**
|
||
|
* Constructs a file dialog for text files with encoding selection possibility.
|
||
|
*
|
||
|
* @param startDir This can either be
|
||
|
* @li The URL of the directory to start in.
|
||
14 years ago
|
* @li TQString::null to start in the current working
|
||
15 years ago
|
* directory, or the last directory where a file has been
|
||
|
* selected.
|
||
|
* @li ':<keyword>' to start in the directory last used
|
||
|
* by a filedialog in the same application that specified
|
||
|
* the same keyword.
|
||
|
* @li '::<keyword>' to start in the directory last used
|
||
|
* by a filedialog in any application that specified the
|
||
|
* same keyword.
|
||
|
*
|
||
|
* @param encoding The encoding shown in the encoding combo. If it's
|
||
14 years ago
|
* TQString::null, the global default encoding will be shown.
|
||
15 years ago
|
*
|
||
|
* @param filter This is a space separated list of shell globs.
|
||
|
* You can set the text to be displayed for the glob, and
|
||
|
* provide multiple globs. See setFilter() for details on
|
||
|
* how to do this...
|
||
|
*
|
||
|
* @param caption The caption of the dialog
|
||
|
*
|
||
|
* @param type This can either be
|
||
|
* @li Opening (open dialog, the default setting)
|
||
|
* @li Saving
|
||
|
* @param parent The parent widget of this dialog
|
||
|
* @param name The name of this object
|
||
|
* @param modal Whether to create a modal dialog or not
|
||
|
*
|
||
|
* @since 3.2
|
||
|
*/
|
||
14 years ago
|
KEncodingFileDialog (const TQString& startDir = TQString::null,
|
||
|
const TQString& encoding = TQString::null,
|
||
|
const TQString& filter = TQString::null,
|
||
|
const TQString& caption = TQString::null, KFileDialog::OperationMode type = KFileDialog::Opening,
|
||
|
TQWidget *parent= 0, const char *name="", bool modal = true);
|
||
15 years ago
|
/**
|
||
|
* Destructs the file dialog.
|
||
|
*/
|
||
|
~KEncodingFileDialog();
|
||
|
|
||
|
|
||
|
/**
|
||
14 years ago
|
* @returns The selected encoding if the constructor with the encoding parameter was used, otherwise TQString::null.
|
||
15 years ago
|
*/
|
||
14 years ago
|
TQString selectedEncoding() const;
|
||
15 years ago
|
|
||
|
|
||
|
/**
|
||
|
* Creates a modal file dialog and return the selected
|
||
|
* filename or an empty string if none was chosen additionally a chosen
|
||
|
* encoding value is returned.
|
||
|
*
|
||
|
* Note that with
|
||
|
* this method the user must select an existing filename.
|
||
|
*
|
||
|
* @param startDir This can either be
|
||
|
* @li The URL of the directory to start in.
|
||
14 years ago
|
* @li TQString::null to start in the current working
|
||
15 years ago
|
* directory, or the last directory where a file has been
|
||
|
* selected.
|
||
|
* @li ':<keyword>' to start in the directory last used
|
||
|
* by a filedialog in the same application that specified
|
||
|
* the same keyword.
|
||
|
* @li '::<keyword>' to start in the directory last used
|
||
|
* by a filedialog in any application that specified the
|
||
|
* same keyword.
|
||
|
* @param encoding The encoding shown in the encoding combo.
|
||
|
* @param filter This is a space separated list of shell globs.
|
||
|
* You can set the text to be displayed for the glob, and
|
||
|
* provide multiple globs. See setFilter() for details on
|
||
|
* how to do this...
|
||
|
* @param parent The widget the dialog will be centered on initially.
|
||
|
* @param caption The name of the dialog widget.
|
||
|
*/
|
||
14 years ago
|
static Result getOpenFileNameAndEncoding(const TQString& encoding=TQString::null,
|
||
|
const TQString& startDir= TQString::null,
|
||
|
const TQString& filter= TQString::null,
|
||
|
TQWidget *parent= 0,
|
||
|
const TQString& caption = TQString::null);
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Creates a modal file dialog and returns the selected encoding and the selected
|
||
|
* filenames or an empty list if none was chosen.
|
||
|
*
|
||
|
* Note that with
|
||
|
* this method the user must select an existing filename.
|
||
|
*
|
||
|
* @param startDir This can either be
|
||
|
* @li The URL of the directory to start in.
|
||
14 years ago
|
* @li TQString::null to start in the current working
|
||
15 years ago
|
* directory, or the last directory where a file has been
|
||
|
* selected.
|
||
|
* @li ':<keyword>' to start in the directory last used
|
||
|
* by a filedialog in the same application that specified
|
||
|
* the same keyword.
|
||
|
* @li '::<keyword>' to start in the directory last used
|
||
|
* by a filedialog in any application that specified the
|
||
|
* same keyword.
|
||
|
* @param encoding The encoding shown in the encoding combo.
|
||
|
* @param filter This is a space separated list of shell globs.
|
||
|
* You can set the text to be displayed for the glob, and
|
||
|
* provide multiple globs. See setFilter() for details on
|
||
|
* how to do this.
|
||
|
* @param parent The widget the dialog will be centered on initially.
|
||
|
* @param caption The name of the dialog widget.
|
||
|
*/
|
||
14 years ago
|
static Result getOpenFileNamesAndEncoding(const TQString& encoding=TQString::null,
|
||
|
const TQString& startDir= TQString::null,
|
||
|
const TQString& filter= TQString::null,
|
||
|
TQWidget *parent = 0,
|
||
|
const TQString& caption= TQString::null);
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Creates a modal file dialog and returns the selected encoding and
|
||
|
* URL or an empty string if none was chosen.
|
||
|
*
|
||
|
* Note that with
|
||
|
* this method the user must select an existing URL.
|
||
|
*
|
||
|
* @param startDir This can either be
|
||
|
* @li The URL of the directory to start in.
|
||
14 years ago
|
* @li TQString::null to start in the current working
|
||
15 years ago
|
* directory, or the last directory where a file has been
|
||
|
* selected.
|
||
|
* @li ':<keyword>' to start in the directory last used
|
||
|
* by a filedialog in the same application that specified
|
||
|
* the same keyword.
|
||
|
* @li '::<keyword>' to start in the directory last used
|
||
|
* by a filedialog in any application that specified the
|
||
|
* same keyword.
|
||
|
* @param encoding The encoding shown in the encoding combo.
|
||
|
* @param filter This is a space separated list of shell globs.
|
||
|
* You can set the text to be displayed for the glob, and
|
||
|
* provide multiple globs. See setFilter() for details on
|
||
|
* how to do this...
|
||
|
* @param parent The widget the dialog will be centered on initially.
|
||
|
* @param caption The name of the dialog widget.
|
||
|
*/
|
||
14 years ago
|
static Result getOpenURLAndEncoding(const TQString& encoding=TQString::null,
|
||
|
const TQString& startDir = TQString::null,
|
||
|
const TQString& filter= TQString::null,
|
||
|
TQWidget *parent= 0,
|
||
|
const TQString& caption = TQString::null);
|
||
15 years ago
|
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Creates a modal file dialog and returns the selected encoding
|
||
|
* URLs or an empty list if none was chosen.
|
||
|
*
|
||
|
* Note that with
|
||
|
* this method the user must select an existing filename.
|
||
|
*
|
||
|
* @param startDir This can either be
|
||
|
* @li The URL of the directory to start in.
|
||
14 years ago
|
* @li TQString::null to start in the current working
|
||
15 years ago
|
* directory, or the last directory where a file has been
|
||
|
* selected.
|
||
|
* @li ':<keyword>' to start in the directory last used
|
||
|
* by a filedialog in the same application that specified
|
||
|
* the same keyword.
|
||
|
* @li '::<keyword>' to start in the directory last used
|
||
|
* by a filedialog in any application that specified the
|
||
|
* same keyword.
|
||
|
* @param encoding The encoding shown in the encoding combo.
|
||
|
* @param filter This is a space separated list of shell globs.
|
||
|
* You can set the text to be displayed for the glob, and
|
||
|
* provide multiple globs. See setFilter() for details on
|
||
|
* how to do this...
|
||
|
* @param parent The widget the dialog will be centered on initially.
|
||
|
* @param caption The name of the dialog widget.
|
||
|
*/
|
||
14 years ago
|
static Result getOpenURLsAndEncoding(const TQString& encoding=TQString::null,
|
||
|
const TQString& startDir= TQString::null,
|
||
|
const TQString& filter= TQString::null,
|
||
|
TQWidget *parent = 0,
|
||
|
const TQString& caption= TQString::null);
|
||
15 years ago
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Creates a modal file dialog and returns the selected encoding and
|
||
|
* filename or an empty string if none was chosen.
|
||
|
*
|
||
|
* Note that with this
|
||
|
* method the user need not select an existing filename.
|
||
|
*
|
||
|
* @param startDir This can either be
|
||
|
* @li The URL of the directory to start in.
|
||
|
* @li a relative path or a filename determining the
|
||
|
* directory to start in and the file to be selected.
|
||
14 years ago
|
* @li TQString::null to start in the current working
|
||
15 years ago
|
* directory, or the last directory where a file has been
|
||
|
* selected.
|
||
|
* @li ':<keyword>' to start in the directory last used
|
||
|
* by a filedialog in the same application that specified
|
||
|
* the same keyword.
|
||
|
* @li '::<keyword>' to start in the directory last used
|
||
|
* by a filedialog in any application that specified the
|
||
|
* same keyword.
|
||
|
* @param encoding The encoding shown in the encoding combo.
|
||
|
* @param filter This is a space separated list of shell globs.
|
||
|
* You can set the text to be displayed for the glob, and
|
||
|
* provide multiple globs. See setFilter() for details on
|
||
|
* how to do this...
|
||
|
* @param parent The widget the dialog will be centered on initially.
|
||
|
* @param caption The name of the dialog widget.
|
||
|
*/
|
||
14 years ago
|
static Result getSaveFileNameAndEncoding(const TQString& encoding=TQString::null,
|
||
|
const TQString& startDir=TQString::null,
|
||
|
const TQString& filter= TQString::null,
|
||
|
TQWidget *parent= 0,
|
||
|
const TQString& caption = TQString::null);
|
||
15 years ago
|
|
||
|
|
||
|
/**
|
||
|
* Creates a modal file dialog and returns the selected encoding and
|
||
|
* filename or an empty string if none was chosen.
|
||
|
*
|
||
|
* Note that with this
|
||
|
* method the user need not select an existing filename.
|
||
|
*
|
||
|
* @param startDir This can either be
|
||
|
* @li The URL of the directory to start in.
|
||
|
* @li a relative path or a filename determining the
|
||
|
* directory to start in and the file to be selected.
|
||
14 years ago
|
* @li TQString::null to start in the current working
|
||
15 years ago
|
* directory, or the last directory where a file has been
|
||
|
* selected.
|
||
|
* @li ':<keyword>' to start in the directory last used
|
||
|
* by a filedialog in the same application that specified
|
||
|
* the same keyword.
|
||
|
* @li '::<keyword>' to start in the directory last used
|
||
|
* by a filedialog in any application that specified the
|
||
|
* same keyword.
|
||
|
* @param encoding The encoding shown in the encoding combo.
|
||
|
* @param filter This is a space separated list of shell globs.
|
||
|
* You can set the text to be displayed for the glob, and
|
||
|
* provide multiple globs. See setFilter() for details on
|
||
|
* how to do this...
|
||
|
* @param parent The widget the dialog will be centered on initially.
|
||
|
* @param caption The name of the dialog widget.
|
||
|
*/
|
||
14 years ago
|
static Result getSaveURLAndEncoding(const TQString& encoding=TQString::null,
|
||
|
const TQString& startDir= TQString::null,
|
||
|
const TQString& filter= TQString::null,
|
||
|
TQWidget *parent= 0,
|
||
|
const TQString& caption = TQString::null);
|
||
15 years ago
|
|
||
|
|
||
|
|
||
|
protected:
|
||
|
virtual void virtual_hook( int id, void* data );
|
||
|
private:
|
||
|
KEncodingFileDialogPrivate *d;
|
||
|
};
|
||
|
|
||
|
#endif
|