00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef FILESELECTOR_H
00021 #define FILESELECTOR_H
00022
00023 #include <qhbox.h>
00024 #include <qvbox.h>
00025 #include <qtoolbutton.h>
00026 #include <qlistview.h>
00027
00028 #include "qpeglobal.h"
00029 #include "filemanager.h"
00030 #include "applnk.h"
00031
00032 class QPopupMenu;
00033 class QPushButton;
00034 class FileSelectorView;
00035
00036 class FileSelectorItem : public QListViewItem
00037 {
00038 public:
00039 FileSelectorItem( QListView *parent, const DocLnk& f );
00040 ~FileSelectorItem();
00041
00042 DocLnk file() const { return fl; }
00043
00044 private:
00045 DocLnk fl;
00046 };
00047
00048 class FileSelectorPrivate;
00049 class FileSelector : public QVBox
00050 {
00051 Q_OBJECT
00052
00053 public:
00054 FileSelector( const QString &mimefilter, QWidget *parent, const char *name=0, bool newVisible = TRUE, bool closeVisible = TRUE );
00055 ~FileSelector();
00056 void setNewVisible( bool b );
00057 void setCloseVisible( bool b ) QPE_DEPRECATED;
00058 void setTypeComboVisible( bool b = TRUE );
00059 void setCategorySelectVisible( bool b = TRUE );
00060 void reread();
00061 int fileCount();
00062 DocLnk selectedDocument() const
00063 {
00064 const DocLnk* rp = ((FileSelector*)this)->selected();
00065 if (!rp) {
00066 DocLnk r;
00067 return r;
00068 }
00069 DocLnk r(*rp);
00070 delete rp;
00071 return r;
00072 }
00073
00074 QValueList<DocLnk> fileList() const
00075 {
00076 ((FileSelector*)this)->fileCount();
00077
00078 QValueList<DocLnk> list;
00079 FileSelectorItem *item = (FileSelectorItem *)((QListView*)view)->firstChild();
00080 while (item) {
00081 list.append(item->file());
00082 item = (FileSelectorItem *)item->nextSibling();
00083 }
00084
00085 return list;
00086 }
00087
00088 signals:
00089 void fileSelected( const DocLnk & );
00090 void newSelected( const DocLnk & );
00091 void closeMe();
00092
00093 private slots:
00094 void createNew();
00095 void fileClicked( int, QListViewItem *, const QPoint &, int );
00096
00097 void filePressed( int, QListViewItem *, const QPoint &, int );
00098 void fileClicked( QListViewItem *);
00099 void typeSelected( const QString &type );
00100 void catSelected( int );
00101 void cardMessage( const QCString &, const QByteArray &);
00102
00103 private:
00104 void updateView();
00105 void updateWhatsThis();
00106
00107 private:
00108
00109 const DocLnk *selected() QPE_DEPRECATED;
00110 FileSelectorView *view;
00111 QString filter;
00112 QToolButton *buttonNew, *buttonClose;
00113 FileSelectorPrivate *d;
00114 };
00115
00116 #endif