-rw-r--r-- | libopie/ofileselector.h | 77 |
1 files changed, 61 insertions, 16 deletions
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h index 47697b9..f2d5f84 100644 --- a/libopie/ofileselector.h +++ b/libopie/ofileselector.h @@ -1,3 +1,3 @@ /* - This is based on code and idea of + This is based on code and ideas of L. J. Potter ljp@llornkcor.com @@ -9,3 +9,3 @@ .>+-= - _;:, .> :=|. This library is free software; you can + _;:, .> :=|. This library is free software; you can .> <`_, > . <= redistribute it and/or modify it under @@ -15,4 +15,4 @@ ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This library is distributed in the hope that + .%`+i> _;_. + .i_,=:_. -<s. This library is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; @@ -23,6 +23,6 @@ ++= -. .` .: details. - : = ...= . :.=- + : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with - -- :-=` this library; see the file COPYING.LIB. + -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, @@ -45,2 +45,3 @@ #include <qlistview.h> + /** This is OPIEs FileDialog Widget. You can use it @@ -49,3 +50,3 @@ * This is also a complete FileSave and FileLoad widget - * If you look for a Dialog check OFileDialog + * If you look for a Dialog check OFileDialog * @@ -66,4 +67,5 @@ class QFileInfo; class QHBox; -// +// +typedef QMap< QString, QStringList> MimeTypes; @@ -72,12 +74,44 @@ class OFileSelector : public QWidget { public: + /** + * The mode of the file selector + * Either open, save, fileselector or dir browsing mode + * + */ enum Mode {OPEN=1, SAVE=2, FILESELECTOR=4, DIR=8 }; + + /** + * Selector. Either NORMAL for the one shipped with + * libqpe or EXTENDED. for the EXTENDED + * EXTENDED_ALL also shows 'hidden' files + */ enum Selector{NORMAL=0, EXTENDED = 1, EXTENDED_ALL =2 }; + + /** + * This is reserved for futrue views + */ enum View { DIRS = 1, FILES = 2, TREE = 4, ICON = 8 }; - OFileSelector(QWidget *wid, int mode, int selector, + /** + * A c'tor which should be used for advanced mode + * @param wid the parent + * @param mode the Mode of the Selector + * @param selector the current View of the Selector + * @param dirName in which dir to start + * @param fileName a proposed filename + * @param mimetypes A list of mimetypes \ + * QString is for a identifier name like "Text files" + * the coresponding QStringList is used for the mimetypes + * if empty it'll fill the list of mimetypes depending + * on the content of the current directory + */ + + OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, const QString &fileName = QString::null, - const QStringList &mimetypes = QStringList() ); + const MimeTypes &mimetypes = MimeTypes() ); + /** + * This is a QPE compatible c'tor + */ OFileSelector(const QString &mimeFilter, QWidget *parent, @@ -132,3 +166,3 @@ class OFileSelector : public QWidget { void setSelector( int ); - + bool showPopup()const { return m_showPopup; }; @@ -177,3 +211,3 @@ class OFileSelector : public QWidget { void updateMimes(); - + protected: @@ -192,3 +226,4 @@ class OFileSelector : public QWidget { QString m_name; - QStringList m_mimetypes; +// QStringList m_mimetypes; + QMap<QString, QStringList> m_mimetypes; @@ -234,4 +269,14 @@ class OFileSelector : public QWidget { void initPics(); - bool compliesMime(const QString &path, const QString &mime); - + bool compliesMime(const QString &path, + const QString &mime); + bool compliesMime(const QString& mime ); + /** + * Updates the QComboBox with the current mimetypes + */ + void updateMimeCheck(); + + /** + * Returns the current mimetype + */ + QString currentMimeType()const; class OFileSelectorPrivate; @@ -239,3 +284,3 @@ class OFileSelector : public QWidget { static QMap<QString,QPixmap> *m_pixmaps; - + private slots: |