ofileselector.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef OPIE_OFILESELECTOR_FOO_H
00036 #define OPIE_OFILESELECTOR_FOO_H
00037
00038 #include <qlist.h>
00039 #include <qwidget.h>
00040 #include <qmap.h>
00041 #include <qvaluelist.h>
00042 #include <qstringlist.h>
00043
00044 #include <qpe/applnk.h>
00045
00046 typedef QMap<QString, QStringList> MimeTypes;
00047
00048 class OFileViewInterface;
00049 class OFileViewFileListView;
00050 class QLineEdit;
00051 class QComboBox;
00052 class QWidgetStack;
00053 class QHBox;
00054
00055
00067 class OFileSelector : public QWidget {
00068 Q_OBJECT
00069 friend class OFileViewInterface;
00070 friend class OFileViewFileListView;
00071 public:
00078 enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 };
00079
00086 enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 };
00087
00088
00089
00090 OFileSelector(QWidget* parent, int mode, int selector,
00091 const QString& dirName,
00092 const QString& fileName,
00093 const MimeTypes& mimetypes = MimeTypes(),
00094 bool newVisible = FALSE, bool closeVisible = FALSE );
00095
00096 OFileSelector(const QString& mimeFilter, QWidget* parent,
00097 const char* name = 0, bool newVisible = TRUE, bool closeVisible = FALSE );
00098 ~OFileSelector();
00099
00100 const DocLnk* selected();
00101
00102 QString selectedName()const;
00103 QString selectedPath()const;
00104 QString directory()const;
00105
00106 DocLnk selectedDocument()const;
00107
00108 int fileCount()const;
00109 void reread();
00110
00111 int mode()const;
00112 int selector()const;
00113
00118 void setNewVisible( bool b );
00119
00123 void setCloseVisible( bool b );
00124
00128 void setNameVisible( bool b );
00129
00130 signals:
00134 void dirSelected( const QString& );
00135
00140 void fileSelected( const DocLnk& );
00141
00146 void fileSelected( const QString& );
00147
00151 void newSelected( const DocLnk& );
00152
00153 void closeMe();
00154
00159 void ok();
00160 void cancel();
00161
00162
00163 private:
00164 bool showNew()const;
00165 bool showClose()const;
00166 MimeTypes mimeTypes()const;
00167 QStringList currentMimeType()const;
00168
00169 private:
00170
00171 void initUI();
00172
00173 void initMime();
00174
00175 void initViews();
00176
00177 private:
00178 QLineEdit* m_lneEdit;
00179 QComboBox *m_cmbView, *m_cmbMime;
00180 QWidgetStack* m_stack;
00181 OFileViewInterface* currentView()const;
00182 OFileViewInterface* m_current;
00183 bool m_shNew : 1;
00184 bool m_shClose : 1;
00185 MimeTypes m_mimeType;
00186
00187 QMap<QString, OFileViewInterface*> m_views;
00188 QHBox* m_nameBox;
00189 QHBox* m_cmbBox;
00190
00191 QString m_startDir;
00192 int m_mode;
00193 int m_selector;
00194
00195 struct Data;
00196 Data *d;
00197
00198 private slots:
00199 void slotMimeTypeChanged();
00200
00201
00202 void slotDocLnkBridge( const DocLnk& );
00203 void slotFileBridge( const QString& );
00204 void slotViewChange( const QString& );
00205
00206 bool eventFilter (QObject *o, QEvent *e);
00207
00208 };
00209
00210 #endif
This file is part of the documentation for OPIE Version 1.1.