📄 kfiledialog.h
字号:
QStack<QString> backStack; /** * Contains all URLs you can reach with the forward button. */ QStack<QString> forwardStack; /** * Lock @ref #backStack and @ref #forwardStack . */ bool stackLock; void resizeEvent(QResizeEvent *); /** * Subclasses should reimplement this method to swallow the main * layout. This allows the addition of children that are outside * the existing layout. The function should return the widget that * should be the parent of the main layout. */ virtual QWidget *swallower() { return this; } /** * Subclasses, that want another view should override this * function to provide another file view. * It will be used to display files. **/ virtual KFileInfoContents *initFileList( QWidget *parent ) = 0; /** * Overload this function, if you want the filter shown/unshown */ virtual bool getShowFilter() = 0; /** * adds a entry of the current directory. If disableUpdating is set * to true, it will care about clever updating **/ void addDirEntry(KFileInfo *entry, bool disableUpdating); /** * rebuild geometry managment. * */ void initGUI(); /** * Makes a new directory in current directory after asking user * for a name */ void mkdir(); /** * 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 char *txt, bool takeFiles = false); /** * this functions must be called by the constructor of a derived * class. **/ void init();protected slots: void pathChanged(); void comboActivated(int); void toolbarCallback(int); void toolbarPressedCallback(int); void dirActivated(KFileInfo*); void fileActivated(KFileInfo*); void fileHighlighted(KFileInfo*); void updateHistory(bool, bool); void filterChanged(); void locationChanged(const char*); void setHiddenToggle(bool); void slotDirEntry(KFileInfo *); void slotFinished(); void slotKfmError(int, const char *); void insertNewFiles(const KFileInfoList *newone); void completion(); virtual void updateStatusLine(); virtual void okPressed(); /** * You should override this method if you change the user interface of * this dialog in a subclass in order to invoke your updated user help. */ virtual void help(); /** * Add the current location to the global bookmarks list */ void addToBookmarks(); void bookmarksChanged(); void fillBookmarkMenu( KFileBookmark *parent, QPopupMenu *menu, int &id );private: // // the father of the widget. By default itself, but // to make it customable, this can be overriden by // overriding swallower() // QWidget *wrapper; // flag for perfomance hype ;) bool repaint_files; // for the handling of the cursor bool finished; // indicates, if the file selector accepts just existing // files or not. If set to true, it will check for local // files, if they exist bool acceptOnlyExisting; // now following all kind of widgets, that I need to rebuild // the geometry managment QVBoxLayout *boxLayout; QGridLayout *lafBox; QHBoxLayout *btngroup; QPushButton *bOk, *bCancel, *bHelp; QLabel *locationLabel, *filterLabel; QString filterString;};/** * The KDirDialog widget provides a user (and developer) friendly way to * select directories. It is a specalised KFileDialog. * * You will usually want to use one of the two static methods * KFileDialog::getDirectory. * * Being a subclass of KFileKFileBaseDialog, it can therefore be easily * customised. * * @short A directory selection dialog * */class KDirDialog : public KFileBaseDialog{public: KDirDialog(const char *url, QWidget *parent, const char *name);protected: virtual KFileInfoContents *initFileList( QWidget *parent ); virtual bool getShowFilter() { return false; } virtual void updateStatusLine();};class KFileDialog : public KFileBaseDialog{public: KFileDialog(const char *dirName, const char *filter= 0, QWidget *parent= 0, const char *name= 0, bool modal = false, bool acceptURLs = true); /** * 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 char *dir= 0, const char *filter= 0, QWidget *parent= 0, const char *name= 0); /** * 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 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 name The name of the dialog widget. */ static QString getSaveFileName(const char *dir= 0, const char *filter= 0, QWidget *parent= 0, const char *name= 0); /** * This function is similar to getOpenFileName() but allows the * user to select a local file or a remote file. */ static QString getOpenFileURL(const char *url= 0, const char *filter= 0, QWidget *parent= 0, const char *name= 0); /** * This function is similar to getSaveFileName() but allows the * user to select a local file or a remote file. */ static QString getSaveFileURL(const char *url= 0, const char *filter= 0, QWidget *parent= 0, const char *name= 0);protected: virtual KFileInfoContents *initFileList( QWidget *parent); virtual bool getShowFilter();};typedef bool (*PreviewHandler)( const KFileInfo *, const QString fileName, QString &, QPixmap & );/** * Preview modules are of one of these types, which means their preview is either * text or an pixmap (image). */enum PreviewType { PreviewText = 0x001, PreviewPixmap = 0x002 };/** * The KFilePreviewDialog widget provides a user (and developer) friendly way to * select files while showing a preview. * * You will usually want to use one of the static methods * KFilePreviewDialog::get[Open|Save][Name|URL](...) which are the same * as the KFileDialog ones. * * Being a subclass of KFileKFileBaseDialog, it can therefore be easily * customised. * * @short A file selection dialog with preview * */class KFilePreviewDialog : public KFileBaseDialog{public: KFilePreviewDialog(const char *dirName, const char *filter= 0, QWidget *parent= 0, const char *name= 0, bool modal = false, bool acceptURLs = true); ~KFilePreviewDialog() {} static QString getOpenFileName(const char *dir= 0, const char *filter= 0, QWidget *parent= 0, const char *name= 0); static QString getSaveFileName(const char *dir= 0, const char *filter= 0, QWidget *parent= 0, const char *name= 0); static QString getOpenFileURL(const char *url= 0, const char *filter= 0, QWidget *parent= 0, const char *name= 0); static QString getSaveFileURL(const char *url= 0, const char *filter= 0, QWidget *parent= 0, const char *name= 0); /** * This is a static method which allow a user to define a new preview dialog module. * * @param format This identifies the module e.g. "JPG" or "PNG". * @param readPreview This is the function which generates the preview * @param type This is the type of the preview module * @see PreviewType */ static void registerPreviewModule( const char * format, PreviewHandler readPreview, PreviewType type);protected: virtual KFileInfoContents *initFileList( QWidget *parent ); virtual bool getShowFilter();};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -