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 #ifndef OFILESELECTOR_PRIVATE_H
00030 #define OFILESELECTOR_PRIVATE_H
00031
00032
00033 #include <qpe/applnk.h>
00034 #include <qpe/fileselector.h>
00035
00036
00037 #include <qmap.h>
00038 #include <qstringlist.h>
00039 #include <qwidget.h>
00040 #include <qlistview.h>
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 typedef QMap<QString, QStringList> MimeTypes;
00054
00055
00056 class QFileInfo;
00057 class QToolButton;
00058
00059 namespace Opie{
00060 namespace Ui{
00061 class OFileSelector;
00062 namespace Internal {
00063
00064 class OFileViewInterface
00065 {
00066 public:
00067 OFileViewInterface( OFileSelector* selector );
00068 virtual ~OFileViewInterface();
00069 virtual QString selectedName()const = 0;
00070 virtual QString selectedPath()const = 0;
00071 virtual QString directory()const = 0;
00072 virtual void reread() = 0;
00073 virtual int fileCount()const = 0;
00074 virtual DocLnk selectedDocument()const;
00075 virtual QWidget* widget( QWidget* parent) = 0;
00076 virtual void activate( const QString& );
00077 QString name()const;
00078 bool allItem( const QString& )const;
00079 protected:
00080 OFileSelector* selector()const;
00081 void setName( const QString& );
00082 bool showNew()const;
00083 bool showClose()const;
00084 MimeTypes mimeTypes()const;
00085 QStringList currentMimeType()const;
00086 QString startDirectory()const;
00087 protected:
00088 void ok();
00089 void cancel();
00090 void closeMe();
00091 void fileSelected( const QString& );
00092 void fileSelected( const DocLnk& );
00093 void setCurrentFileName( const QString& );
00094 QString currentFileName()const;
00095
00096 private:
00097 QString m_name;
00098 OFileSelector* m_selector;
00099 };
00100
00101
00102
00103 class ODocumentFileView : public OFileViewInterface
00104 {
00105 public:
00106 ODocumentFileView( OFileSelector* selector );
00107 ~ODocumentFileView();
00108
00109 QString selectedName() const;
00110 QString selectedPath() const;
00111
00112 QString directory() const;
00113 void reread();
00114 int fileCount()const;
00115 DocLnk selectedDocument()const;
00116
00117 QWidget* widget( QWidget* parent );
00118
00119 private:
00120 mutable FileSelector* m_selector;
00121
00122 };
00123
00124
00125 class OFileSelectorItem : public QListViewItem
00126 {
00127 public:
00128 OFileSelectorItem( QListView* view, const QPixmap& pixmap,
00129 const QString& path, const QString& date,
00130 const QString& size, const QString& mDir,
00131 bool isLocked = false, bool isDir = false );
00132 ~OFileSelectorItem();
00133 bool isLocked()const;
00134 bool isDir()const;
00135 QString directory()const;
00136 QString path()const;
00137 QString key(int id, bool )const;
00138
00139 private:
00140 QString m_dir;
00141 bool m_isDir : 1;
00142 bool m_locked : 1;
00143 };
00144
00145 class OFileViewFileListView : public QWidget
00146 {
00147 Q_OBJECT
00148 public:
00149 OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector );
00150 ~OFileViewFileListView();
00151
00152 OFileSelectorItem* currentItem()const;
00153 void reread( bool all = false );
00154 int fileCount()const;
00155 QString currentDir()const;
00156 protected:
00157 bool eventFilter (QObject *o, QEvent *e);
00158 private slots:
00159 void slotNew();
00160 void cdUP();
00161 void cdHome();
00162 void cdDoc();
00163 void changeDir( const QString& );
00164 void slotCurrentChanged( QListViewItem* );
00165 void slotClicked(int, QListViewItem*, const QPoint&, int );
00166 void slotFSActivated(int);
00167 void slotFSpressed();
00168
00169 protected:
00170 OFileSelector* selector();
00171
00172 private:
00173 QMap<QString, QString> m_dev;
00174 bool m_all : 1;
00175 OFileSelector* m_sel;
00176 QPopupMenu* m_fsPop;
00177 bool compliesMime( const QString& );
00178 QStringList m_mimes;
00179 QString m_currentDir;
00180 QToolButton *m_btnNew, *m_btnClose;
00181 QToolButton *m_fsButton;
00182 void connectSlots();
00183 void addFile( QFileInfo* info, bool symlink = FALSE );
00184 void addDir ( QFileInfo* info, bool symlink = FALSE );
00185 void addSymlink( QFileInfo* info, bool = FALSE );
00186
00187
00188 private:
00189 QListView* m_view;
00190 };
00191
00192 }
00193 }
00194 }
00195
00196 #endif