summaryrefslogtreecommitdiff
path: root/libopie/ofileselector.h
authorzecke <zecke>2002-06-26 18:01:53 (UTC)
committer zecke <zecke>2002-06-26 18:01:53 (UTC)
commit76f87a51800511fe108edbcd14d4dd40ead6f391 (patch) (side-by-side diff)
tree1d1b3cf7c3bbd98d294cac738b3bfa277964b32d /libopie/ofileselector.h
parent125dc1fe52d7a3c8be1b955c79d729cc935c8b6d (diff)
downloadopie-76f87a51800511fe108edbcd14d4dd40ead6f391.zip
opie-76f87a51800511fe108edbcd14d4dd40ead6f391.tar.gz
opie-76f87a51800511fe108edbcd14d4dd40ead6f391.tar.bz2
Improve mimetype handling
API is now fixed 2 Bugs outstanding though
Diffstat (limited to 'libopie/ofileselector.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.h77
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,31 +1,31 @@
/*
- This is based on code and idea of
+ This is based on code and ideas of
L. J. Potter ljp@llornkcor.com
Thanks a lot
               =. This file is part of the OPIE Project
             .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
           .>+-=
- _;:,     .>    :=|. This library is free software; you can
+ _;:,     .>    :=|. This library is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : 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;
    : ..    .:,     . . . 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.
+    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
@@ -42,13 +42,14 @@
#include <qvaluelist.h>
#include <qpe/applnk.h>
#include <qlistview.h>
+
/** This is OPIEs FileDialog Widget. You can use it
* as a dropin replacement of the fileselector and
* or use any of the new features.
* 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
*
*/
class DocLnk;
class QCheckBox;
@@ -63,24 +64,57 @@ class QHBoxLayout;
class QVBoxLayout;
class QPopupMenu;
class QFileInfo;
class QHBox;
-//
+//
+typedef QMap< QString, QStringList> MimeTypes;
class OFileSelector : public QWidget {
Q_OBJECT
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,
const char *name, bool newVisible = TRUE,
bool closeVisible = FALSE );
@@ -129,9 +163,9 @@ class OFileSelector : public QWidget {
int mode()const { return m_mode; };
int selector()const { return m_selector; };
void setSelector( int );
-
+
bool showPopup()const { return m_showPopup; };
void setShowPopup( bool pop ) { m_showPopup = pop; };
void setPopupMenu( QPopupMenu * );
@@ -174,9 +208,9 @@ class OFileSelector : public QWidget {
private:
void init();
void updateMimes();
-
+
protected:
private:
int m_mode, m_selector;
@@ -189,9 +223,10 @@ class OFileSelector : public QWidget {
QVBoxLayout *m_pseudoLayout;
QString m_currentDir;
QString m_name;
- QStringList m_mimetypes;
+// QStringList m_mimetypes;
+ QMap<QString, QStringList> m_mimetypes;
FileSelector *m_select;
QWidgetStack *m_stack;
QVBoxLayout *m_lay;
@@ -231,14 +266,24 @@ class OFileSelector : public QWidget {
void initializeChooser();
void initializeListView();
void initializePerm();
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;
OFileSelectorPrivate *d;
static QMap<QString,QPixmap> *m_pixmaps;
-
+
private slots:
void slotFileSelected(const QString & ); // not really meant to be a slot
void slotFileBridgeSelected( const DocLnk & );
virtual void slotSelectionChanged();