-rw-r--r-- | libopie/ofileselector.h | 100 |
1 files changed, 78 insertions, 22 deletions
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h index a90219f..73674e2 100644 --- a/libopie/ofileselector.h +++ b/libopie/ofileselector.h | |||
@@ -39,5 +39,8 @@ | |||
39 | #include <qpixmap.h> | 39 | #include <qpixmap.h> |
40 | #include <qstringlist.h> | 40 | #include <qstringlist.h> |
41 | #include <qmap.h> | ||
42 | #include <qvaluelist.h> | ||
41 | 43 | ||
44 | #include <qpe/applnk.h> | ||
42 | #include <qlistview.h> | 45 | #include <qlistview.h> |
43 | /** This is OPIEs FileDialog Widget. You can use it | 46 | /** This is OPIEs FileDialog Widget. You can use it |
@@ -60,10 +63,10 @@ class QHBoxLayout; | |||
60 | class QVBoxLayout; | 63 | class QVBoxLayout; |
61 | class QPopupMenu; | 64 | class QPopupMenu; |
62 | 65 | class QFileInfo; | |
63 | 66 | // | |
64 | class OFileSelectorItem : public QListViewItem { | 67 | class OFileSelectorItem : public QListViewItem { |
65 | public: | 68 | public: |
66 | OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, | 69 | OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, |
67 | const QString &date, const QString &size, | 70 | const QString &date, const QString &size, const QString &mDir, |
68 | bool isDir=false ): QListViewItem(view) { | 71 | bool isDir=false ): QListViewItem(view) { |
69 | setPixmap(0, pixmap ); | 72 | setPixmap(0, pixmap ); |
@@ -71,6 +74,11 @@ class OFileSelectorItem : public QListViewItem { | |||
71 | setText(2, size ); | 74 | setText(2, size ); |
72 | setText(3, date ); | 75 | setText(3, date ); |
76 | //setText(4, mDir ); | ||
77 | m_dir = mDir; | ||
73 | dir = isDir; | 78 | dir = isDir; |
74 | } | 79 | } |
80 | QString directory()const{ | ||
81 | return m_dir; | ||
82 | } | ||
75 | bool isDir()const{ | 83 | bool isDir()const{ |
76 | return dir; | 84 | return dir; |
@@ -79,6 +87,24 @@ class OFileSelectorItem : public QListViewItem { | |||
79 | return text(1 ); | 87 | return text(1 ); |
80 | } | 88 | } |
89 | QString key(int id, bool )const { | ||
90 | QString ke; | ||
91 | if( id == 0 || id == 1 ){ // name | ||
92 | if( dir ){ | ||
93 | ke.append("0" ); | ||
94 | ke.append( text(1) ); | ||
95 | }else{ | ||
96 | ke.append("1" ); | ||
97 | ke.append( text(1) ); | ||
98 | } | ||
99 | }else if( id == 2 ){ // size | ||
100 | return text(2); | ||
101 | }else if( id == 3 ){ // date | ||
102 | return text(3); | ||
103 | } | ||
104 | return ke; | ||
105 | }; | ||
81 | private: | 106 | private: |
82 | bool dir:1; | 107 | bool dir:1; |
108 | QString m_dir; | ||
83 | }; | 109 | }; |
84 | 110 | ||
@@ -91,33 +117,59 @@ class OFileSelector : public QWidget { | |||
91 | OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, const QString &fileName = QString::null, const QStringList mimetypes = QStringList() ); | 117 | OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, const QString &fileName = QString::null, const QStringList mimetypes = QStringList() ); |
92 | 118 | ||
93 | bool showToolbar() const { return m_shTool; }; | 119 | bool isToolbarVisible() const { return m_shTool; }; |
94 | bool showPermissionBar() const { return m_shPerm; }; | 120 | bool isPermissionBarVisible() const { return m_shPerm; }; |
95 | bool showLineEdit()const { return m_shLne; }; | 121 | bool isLineEditVisible()const { return m_shLne; }; |
96 | bool showChooser( )const { return m_shChooser; }; | 122 | bool isChooserVisible( )const { return m_shChooser; }; |
97 | bool showYesCancel()const { return m_shYesNo; }; | 123 | bool isYesCancelVisible()const { return m_shYesNo; }; |
98 | void setShowYesCancel( bool show ); | 124 | void setYesCancelVisible( bool show ); |
99 | void setShowToolbar( bool show ); | 125 | void setToolbarVisible( bool show ); |
100 | void setShowPermissionBar( bool show ); | 126 | void setPermissionBarVisible( bool show ); |
101 | void setShowLineEdit(bool show) ; | 127 | void setLineEditVisible(bool show) ; |
102 | void setShowChooser( bool chooser ); | 128 | void setChooserVisible( bool chooser ); |
129 | |||
103 | QCheckBox* permissionCheckbox(); | 130 | QCheckBox* permissionCheckbox(); |
104 | bool setPermission() const; | 131 | bool setPermission() const; |
105 | void setPermissionChecked( bool check ); | 132 | void setPermissionChecked( bool check ); |
133 | |||
106 | void setMode( int ); | 134 | void setMode( int ); |
107 | void setShowDirs(bool dir ) { }; | 135 | |
108 | bool showDirs() {bool turn; return turn; } | 136 | bool showDirs()const { return m_dir; } |
137 | void setShowDirs(bool ); | ||
138 | |||
139 | const QListView* listview() { return m_View; }; | ||
140 | |||
141 | bool isCaseSensetive()const { return m_case; } | ||
142 | void setCaseSensetive(bool caSe ); | ||
143 | |||
144 | bool showFiles()const { return m_files; }; | ||
145 | void setShowFiles(bool ); | ||
146 | |||
147 | |||
148 | |||
109 | int mode()const { return m_mode; }; | 149 | int mode()const { return m_mode; }; |
110 | int selector()const { return m_selector; }; | 150 | int selector()const { return m_selector; }; |
111 | void setSelector( int ); | 151 | void setSelector( int ); |
112 | QString selectedName( ); | 152 | |
153 | |||
113 | void setPopupMenu( const QPopupMenu * ); | 154 | void setPopupMenu( const QPopupMenu * ); |
114 | 155 | ||
115 | const DocLnk* selectedDocument()const; | ||
116 | void updateLay(); | 156 | void updateLay(); |
117 | 157 | ||
118 | void reparse(); // re reads the dir | 158 | void reparse(); // re reads the dir |
119 | QString directory(); | 159 | |
160 | QString selectedName( )const; | ||
161 | QStringList selectedNames()const; | ||
162 | |||
163 | QString selectedPath() const; | ||
164 | QStringList selectedPaths() const; | ||
165 | |||
166 | QString directory()const; | ||
120 | int fileCount(); | 167 | int fileCount(); |
121 | 168 | ||
169 | /* the user needs to delete it */ | ||
170 | DocLnk selectedDocument()const; | ||
171 | /* the user needs to delete it */ | ||
172 | QValueList<DocLnk> selectedDocuments(); | ||
173 | |||
122 | signals: | 174 | signals: |
123 | void fileSelected( const DocLnk & ); | 175 | void fileSelected( const DocLnk & ); |
@@ -165,4 +217,7 @@ class OFileSelector : public QWidget { | |||
165 | bool m_boCheckPerm:1; | 217 | bool m_boCheckPerm:1; |
166 | bool m_autoMime:1; | 218 | bool m_autoMime:1; |
219 | bool m_case:1; | ||
220 | bool m_dir:1; | ||
221 | bool m_files:1; | ||
167 | 222 | ||
168 | protected: | 223 | protected: |
@@ -170,7 +225,7 @@ class OFileSelector : public QWidget { | |||
170 | private: | 225 | private: |
171 | // implementation todo | 226 | // implementation todo |
172 | virtual void addFile(const QString &path, const QString &name, bool symlink = FALSE ) {}; | 227 | virtual void addFile(const QString &mime, QFileInfo *info, bool symlink = FALSE ); |
173 | virtual void addDir( const QString &path, const QString &dir , bool symlink = FALSE ){}; | 228 | virtual void addDir( const QString &mime, QFileInfo *info , bool symlink = FALSE ); |
174 | virtual void addSymlink(const QString &path, const QString &name, bool broken = FALSE ){}; | 229 | virtual void addSymlink(const QString &mime, QFileInfo *info, bool broken = FALSE ){}; |
175 | void delItems(); | 230 | void delItems(); |
176 | void initializeName(); | 231 | void initializeName(); |
@@ -178,9 +233,10 @@ class OFileSelector : public QWidget { | |||
178 | void initializeChooser(); | 233 | void initializeChooser(); |
179 | void initializeListView(); | 234 | void initializeListView(); |
235 | void initPics(); | ||
180 | bool compliesMime(const QString &path, const QString &mime); | 236 | bool compliesMime(const QString &path, const QString &mime); |
181 | 237 | ||
182 | class OFileSelectorPrivate; | 238 | class OFileSelectorPrivate; |
183 | OFileSelectorPrivate *d; | 239 | OFileSelectorPrivate *d; |
184 | 240 | static QMap<QString,QPixmap> *m_pixmaps; | |
185 | }; | 241 | }; |
186 | 242 | ||