author | dwmw2 <dwmw2> | 2002-05-09 10:33:18 (UTC) |
---|---|---|
committer | dwmw2 <dwmw2> | 2002-05-09 10:33:18 (UTC) |
commit | 388e930a890f11c51dd862f6258c1fc60b396334 (patch) (unidiff) | |
tree | 69f322f31c2b2c3338fdb461924349c106f72f59 | |
parent | 4216d2833503440d25ee40683cd563f379f125a6 (diff) | |
download | opie-388e930a890f11c51dd862f6258c1fc60b396334.zip opie-388e930a890f11c51dd862f6258c1fc60b396334.tar.gz opie-388e930a890f11c51dd862f6258c1fc60b396334.tar.bz2 |
Add missing #include <qpainter.h>
-rw-r--r-- | libopie/ofileselector.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index d780da9..8299b3d 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc | |||
@@ -1,779 +1,780 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include <qcheckbox.h> | 3 | #include <qcheckbox.h> |
4 | #include <qcombobox.h> | 4 | #include <qcombobox.h> |
5 | #include <qheader.h> | 5 | #include <qheader.h> |
6 | #include <qlabel.h> | 6 | #include <qlabel.h> |
7 | #include <qabstractlayout.h> | 7 | #include <qabstractlayout.h> |
8 | #include <qlayout.h> | 8 | #include <qlayout.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qlistview.h> | 10 | #include <qlistview.h> |
11 | #include <qmessagebox.h> | 11 | #include <qmessagebox.h> |
12 | #include <qpainter.h> | ||
12 | #include <qpushbutton.h> | 13 | #include <qpushbutton.h> |
13 | #include <qwidgetstack.h> | 14 | #include <qwidgetstack.h> |
14 | #include <qpopupmenu.h> | 15 | #include <qpopupmenu.h> |
15 | #include <qdir.h> | 16 | #include <qdir.h> |
16 | #include <qfile.h> | 17 | #include <qfile.h> |
17 | #include <qfileinfo.h> | 18 | #include <qfileinfo.h> |
18 | #include <qtimer.h> | 19 | #include <qtimer.h> |
19 | 20 | ||
20 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/applnk.h> | 22 | #include <qpe/applnk.h> |
22 | #include <qpe/fileselector.h> | 23 | #include <qpe/fileselector.h> |
23 | #include <qpe/global.h> | 24 | #include <qpe/global.h> |
24 | #include <qpe/mimetype.h> | 25 | #include <qpe/mimetype.h> |
25 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
26 | #include <qpe/storage.h> | 27 | #include <qpe/storage.h> |
27 | 28 | ||
28 | #include <unistd.h> | 29 | #include <unistd.h> |
29 | #include <stdlib.h> | 30 | #include <stdlib.h> |
30 | #include <sys/stat.h> | 31 | #include <sys/stat.h> |
31 | 32 | ||
32 | #include "ofileselector.h" | 33 | #include "ofileselector.h" |
33 | 34 | ||
34 | 35 | ||
35 | QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; | 36 | QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; |
36 | 37 | ||
37 | namespace { | 38 | namespace { |
38 | int indexByString( const QComboBox *box, const QString &str ){ | 39 | int indexByString( const QComboBox *box, const QString &str ){ |
39 | int index= 0; | 40 | int index= 0; |
40 | for(int i= 0; i < box->count(); i++ ){ | 41 | for(int i= 0; i < box->count(); i++ ){ |
41 | if( str == box->text(i ) ){ | 42 | if( str == box->text(i ) ){ |
42 | index= i; | 43 | index= i; |
43 | break; | 44 | break; |
44 | } | 45 | } |
45 | } | 46 | } |
46 | return index; | 47 | return index; |
47 | } | 48 | } |
48 | class OFileSelectorItem : public QListViewItem { | 49 | class OFileSelectorItem : public QListViewItem { |
49 | public: | 50 | public: |
50 | OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, | 51 | OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, |
51 | const QString &date, const QString &size, const QString &mDir, | 52 | const QString &date, const QString &size, const QString &mDir, |
52 | bool isLocked=false, bool isDir=false ): QListViewItem(view) { | 53 | bool isLocked=false, bool isDir=false ): QListViewItem(view) { |
53 | setPixmap(0, pixmap ); | 54 | setPixmap(0, pixmap ); |
54 | setText(1, path ); | 55 | setText(1, path ); |
55 | setText(2, size ); | 56 | setText(2, size ); |
56 | setText(3, date ); | 57 | setText(3, date ); |
57 | //setText(4, mDir ); | 58 | //setText(4, mDir ); |
58 | m_dir = mDir; | 59 | m_dir = mDir; |
59 | dir = isDir; | 60 | dir = isDir; |
60 | mLocked = isLocked; | 61 | mLocked = isLocked; |
61 | } | 62 | } |
62 | bool isLocked() const{ | 63 | bool isLocked() const{ |
63 | return mLocked; | 64 | return mLocked; |
64 | } | 65 | } |
65 | QString directory()const{ | 66 | QString directory()const{ |
66 | return m_dir; | 67 | return m_dir; |
67 | } | 68 | } |
68 | bool isDir()const{ | 69 | bool isDir()const{ |
69 | return dir; | 70 | return dir; |
70 | } | 71 | } |
71 | QString path()const{ | 72 | QString path()const{ |
72 | return text(1 ); | 73 | return text(1 ); |
73 | } | 74 | } |
74 | QString key(int id, bool )const { | 75 | QString key(int id, bool )const { |
75 | QString ke; | 76 | QString ke; |
76 | if( id == 0 || id == 1 ){ // name | 77 | if( id == 0 || id == 1 ){ // name |
77 | if( dir ){ | 78 | if( dir ){ |
78 | ke.append("0" ); | 79 | ke.append("0" ); |
79 | ke.append( text(1) ); | 80 | ke.append( text(1) ); |
80 | }else{ | 81 | }else{ |
81 | ke.append("1" ); | 82 | ke.append("1" ); |
82 | ke.append( text(1) ); | 83 | ke.append( text(1) ); |
83 | } | 84 | } |
84 | }else if( id == 2 ){ // size | 85 | }else if( id == 2 ){ // size |
85 | return text(2); | 86 | return text(2); |
86 | }else if( id == 3 ){ // date | 87 | }else if( id == 3 ){ // date |
87 | return text(3); | 88 | return text(3); |
88 | } | 89 | } |
89 | return ke; | 90 | return ke; |
90 | }; | 91 | }; |
91 | private: | 92 | private: |
92 | bool mLocked:1; | 93 | bool mLocked:1; |
93 | bool dir:1; | 94 | bool dir:1; |
94 | QString m_dir; | 95 | QString m_dir; |
95 | }; | 96 | }; |
96 | }; | 97 | }; |
97 | 98 | ||
98 | 99 | ||
99 | OFileSelector::OFileSelector( QWidget *wid, int mode, int selector, | 100 | OFileSelector::OFileSelector( QWidget *wid, int mode, int selector, |
100 | const QString &dirName, | 101 | const QString &dirName, |
101 | const QString &fileName, | 102 | const QString &fileName, |
102 | const QStringList &mimeTypes ) | 103 | const QStringList &mimeTypes ) |
103 | : QWidget( wid, "OFileSelector") | 104 | : QWidget( wid, "OFileSelector") |
104 | { | 105 | { |
105 | m_mimetypes = mimeTypes; | 106 | m_mimetypes = mimeTypes; |
106 | initVars(); | 107 | initVars(); |
107 | m_mode = mode; | 108 | m_mode = mode; |
108 | m_selector = selector; | 109 | m_selector = selector; |
109 | m_currentDir = dirName; | 110 | m_currentDir = dirName; |
110 | init(); | 111 | init(); |
111 | QTimer::singleShot(6*1000, this, SLOT( slotTest() ) ); | 112 | QTimer::singleShot(6*1000, this, SLOT( slotTest() ) ); |
112 | } | 113 | } |
113 | 114 | ||
114 | OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent, | 115 | OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent, |
115 | const char *name, bool newVisible = TRUE, | 116 | const char *name, bool newVisible = TRUE, |
116 | bool closeVisible = FALSE ) | 117 | bool closeVisible = FALSE ) |
117 | : QWidget( parent, name ) | 118 | : QWidget( parent, name ) |
118 | { | 119 | { |
119 | m_mimetypes = QStringList::split(";", mimeFilter ); | 120 | m_mimetypes = QStringList::split(";", mimeFilter ); |
120 | initVars(); | 121 | initVars(); |
121 | m_currentDir = QPEApplication::documentDir(); | 122 | m_currentDir = QPEApplication::documentDir(); |
122 | m_mode = OPEN; | 123 | m_mode = OPEN; |
123 | m_selector = NORMAL; | 124 | m_selector = NORMAL; |
124 | m_shClose = closeVisible; | 125 | m_shClose = closeVisible; |
125 | m_shNew = newVisible; | 126 | m_shNew = newVisible; |
126 | m_shLne = false; | 127 | m_shLne = false; |
127 | m_shPerm = false; | 128 | m_shPerm = false; |
128 | m_shYesNo = false; | 129 | m_shYesNo = false; |
129 | init(); | 130 | init(); |
130 | 131 | ||
131 | 132 | ||
132 | } | 133 | } |
133 | 134 | ||
134 | OFileSelector::~OFileSelector() | 135 | OFileSelector::~OFileSelector() |
135 | { | 136 | { |
136 | 137 | ||
137 | } | 138 | } |
138 | 139 | ||
139 | void OFileSelector::setNewVisible( bool visible ) | 140 | void OFileSelector::setNewVisible( bool visible ) |
140 | { | 141 | { |
141 | m_shNew = visible; | 142 | m_shNew = visible; |
142 | if( m_selector == NORMAL ){ | 143 | if( m_selector == NORMAL ){ |
143 | delete m_select; | 144 | delete m_select; |
144 | // we need to initialize but keep the selected mimetype | 145 | // we need to initialize but keep the selected mimetype |
145 | QString mime = m_mimeCheck == 0 ? QString::null : m_mimeCheck->currentText() ; | 146 | QString mime = m_mimeCheck == 0 ? QString::null : m_mimeCheck->currentText() ; |
146 | m_select = new FileSelector( m_autoMime ? mime : m_mimetypes.join(";") , | 147 | m_select = new FileSelector( m_autoMime ? mime : m_mimetypes.join(";") , |
147 | m_stack, "fileselector", | 148 | m_stack, "fileselector", |
148 | m_shNew, m_shClose); | 149 | m_shNew, m_shClose); |
149 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), | 150 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), |
150 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); | 151 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); |
151 | //connect to close me and other signals as well | 152 | //connect to close me and other signals as well |
152 | m_stack->addWidget( m_select, NORMAL ); | 153 | m_stack->addWidget( m_select, NORMAL ); |
153 | }else{ | 154 | }else{ |
154 | m_new->show(); | 155 | m_new->show(); |
155 | } | 156 | } |
156 | } | 157 | } |
157 | void OFileSelector::setCloseVisible( bool visible ) | 158 | void OFileSelector::setCloseVisible( bool visible ) |
158 | { | 159 | { |
159 | m_shClose = visible; | 160 | m_shClose = visible; |
160 | if( m_selector == NORMAL ){ | 161 | if( m_selector == NORMAL ){ |
161 | setNewVisible( m_shNew ); // yeah baby | 162 | setNewVisible( m_shNew ); // yeah baby |
162 | }else{ | 163 | }else{ |
163 | m_close->show(); | 164 | m_close->show(); |
164 | } | 165 | } |
165 | } | 166 | } |
166 | void OFileSelector::reread() | 167 | void OFileSelector::reread() |
167 | { | 168 | { |
168 | if( m_selector == NORMAL ){ | 169 | if( m_selector == NORMAL ){ |
169 | setNewVisible( m_shNew ); // make it a initializeSelector | 170 | setNewVisible( m_shNew ); // make it a initializeSelector |
170 | }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ | 171 | }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ |
171 | reparse(); | 172 | reparse(); |
172 | //}else{ | 173 | //}else{ |
173 | //; | 174 | //; |
174 | } | 175 | } |
175 | } | 176 | } |
176 | 177 | ||
177 | const DocLnk *OFileSelector::selected() | 178 | const DocLnk *OFileSelector::selected() |
178 | { | 179 | { |
179 | if( m_selector == NORMAL ){ | 180 | if( m_selector == NORMAL ){ |
180 | return m_select->selected(); | 181 | return m_select->selected(); |
181 | }else{ | 182 | }else{ |
182 | DocLnk *lnk = new DocLnk(selectedDocument() ); | 183 | DocLnk *lnk = new DocLnk(selectedDocument() ); |
183 | return lnk; | 184 | return lnk; |
184 | } | 185 | } |
185 | } | 186 | } |
186 | 187 | ||
187 | void OFileSelector::setYesCancelVisible( bool show ) | 188 | void OFileSelector::setYesCancelVisible( bool show ) |
188 | { | 189 | { |
189 | initializeYes(); // FIXME if YesCancel is not shown we will initialize it to hide it :( | 190 | initializeYes(); // FIXME if YesCancel is not shown we will initialize it to hide it :( |
190 | m_shYesNo = show; | 191 | m_shYesNo = show; |
191 | if( m_shYesNo ) | 192 | if( m_shYesNo ) |
192 | m_boxOk->show(); | 193 | m_boxOk->show(); |
193 | else | 194 | else |
194 | m_boxOk->hide(); | 195 | m_boxOk->hide(); |
195 | 196 | ||
196 | } | 197 | } |
197 | void OFileSelector::setToolbarVisible( bool show ) | 198 | void OFileSelector::setToolbarVisible( bool show ) |
198 | { | 199 | { |
199 | m_shTool = show; | 200 | m_shTool = show; |
200 | initializeListView(); // FIXME see above waste of memory | 201 | initializeListView(); // FIXME see above waste of memory |
201 | if(!m_shTool ){ | 202 | if(!m_shTool ){ |
202 | m_location->hide(); | 203 | m_location->hide(); |
203 | m_up->hide(); | 204 | m_up->hide(); |
204 | m_homeButton->hide(); | 205 | m_homeButton->hide(); |
205 | m_docButton->hide(); | 206 | m_docButton->hide(); |
206 | }else{ | 207 | }else{ |
207 | m_location->show(); | 208 | m_location->show(); |
208 | m_up->show(); | 209 | m_up->show(); |
209 | m_homeButton->show(); | 210 | m_homeButton->show(); |
210 | m_docButton->show(); | 211 | m_docButton->show(); |
211 | } | 212 | } |
212 | } | 213 | } |
213 | void OFileSelector::setPermissionBarVisible( bool show ) | 214 | void OFileSelector::setPermissionBarVisible( bool show ) |
214 | { | 215 | { |
215 | m_shPerm = show; | 216 | m_shPerm = show; |
216 | initializePerm(); | 217 | initializePerm(); |
217 | if( m_shPerm ) | 218 | if( m_shPerm ) |
218 | m_checkPerm->show(); | 219 | m_checkPerm->show(); |
219 | else | 220 | else |
220 | m_checkPerm->hide(); | 221 | m_checkPerm->hide(); |
221 | } | 222 | } |
222 | void OFileSelector::setLineEditVisible( bool show ) | 223 | void OFileSelector::setLineEditVisible( bool show ) |
223 | { | 224 | { |
224 | if( show ){ | 225 | if( show ){ |
225 | initializeName(); | 226 | initializeName(); |
226 | m_boxName->show(); | 227 | m_boxName->show(); |
227 | }else{ | 228 | }else{ |
228 | if( m_shLne && m_boxName != 0 ){ // check if we showed before this is the way to go | 229 | if( m_shLne && m_boxName != 0 ){ // check if we showed before this is the way to go |
229 | m_boxName->hide(); | 230 | m_boxName->hide(); |
230 | } | 231 | } |
231 | } | 232 | } |
232 | m_shLne = show; | 233 | m_shLne = show; |
233 | } | 234 | } |
234 | 235 | ||
235 | void OFileSelector::setChooserVisible( bool show ) | 236 | void OFileSelector::setChooserVisible( bool show ) |
236 | { | 237 | { |
237 | m_shChooser = show; | 238 | m_shChooser = show; |
238 | initializeChooser(); | 239 | initializeChooser(); |
239 | if( m_shChooser ){ | 240 | if( m_shChooser ){ |
240 | m_boxView->hide(); | 241 | m_boxView->hide(); |
241 | }else{ | 242 | }else{ |
242 | m_boxView->show(); | 243 | m_boxView->show(); |
243 | } | 244 | } |
244 | } | 245 | } |
245 | 246 | ||
246 | QCheckBox* OFileSelector::permissionCheckbox() | 247 | QCheckBox* OFileSelector::permissionCheckbox() |
247 | { | 248 | { |
248 | if( m_selector == NORMAL ) | 249 | if( m_selector == NORMAL ) |
249 | return 0l; | 250 | return 0l; |
250 | else | 251 | else |
251 | return m_checkPerm; | 252 | return m_checkPerm; |
252 | } | 253 | } |
253 | bool OFileSelector::setPermission()const | 254 | bool OFileSelector::setPermission()const |
254 | { | 255 | { |
255 | return m_checkPerm == 0 ? false : m_checkPerm->isChecked(); | 256 | return m_checkPerm == 0 ? false : m_checkPerm->isChecked(); |
256 | } | 257 | } |
257 | void OFileSelector::setPermissionChecked( bool check ) | 258 | void OFileSelector::setPermissionChecked( bool check ) |
258 | { | 259 | { |
259 | if( m_checkPerm ) | 260 | if( m_checkPerm ) |
260 | m_checkPerm->setChecked( check ); | 261 | m_checkPerm->setChecked( check ); |
261 | } | 262 | } |
262 | 263 | ||
263 | void OFileSelector::setMode(int mode) // FIXME do direct raising | 264 | void OFileSelector::setMode(int mode) // FIXME do direct raising |
264 | { | 265 | { |
265 | m_mode = mode; | 266 | m_mode = mode; |
266 | if( m_selector == NORMAL ) | 267 | if( m_selector == NORMAL ) |
267 | return; | 268 | return; |
268 | } | 269 | } |
269 | void OFileSelector::setShowDirs(bool ) | 270 | void OFileSelector::setShowDirs(bool ) |
270 | { | 271 | { |
271 | m_dir = true; | 272 | m_dir = true; |
272 | reparse(); | 273 | reparse(); |
273 | } | 274 | } |
274 | void OFileSelector::setCaseSensetive(bool caSe ) | 275 | void OFileSelector::setCaseSensetive(bool caSe ) |
275 | { | 276 | { |
276 | m_case = caSe; | 277 | m_case = caSe; |
277 | reparse(); | 278 | reparse(); |
278 | } | 279 | } |
279 | void OFileSelector::setShowFiles(bool show ) | 280 | void OFileSelector::setShowFiles(bool show ) |
280 | { | 281 | { |
281 | m_files = show; | 282 | m_files = show; |
282 | reparse(); | 283 | reparse(); |
283 | } | 284 | } |
284 | /// | 285 | /// |
285 | bool OFileSelector::cd(const QString &path ) | 286 | bool OFileSelector::cd(const QString &path ) |
286 | { | 287 | { |
287 | m_currentDir = path; | 288 | m_currentDir = path; |
288 | reparse(); | 289 | reparse(); |
289 | return true; | 290 | return true; |
290 | } | 291 | } |
291 | void OFileSelector::setSelector(int mode ) | 292 | void OFileSelector::setSelector(int mode ) |
292 | { | 293 | { |
293 | QString text; | 294 | QString text; |
294 | switch( mode ){ | 295 | switch( mode ){ |
295 | case NORMAL: | 296 | case NORMAL: |
296 | text = tr("Documents"); | 297 | text = tr("Documents"); |
297 | break; | 298 | break; |
298 | case EXTENDED: | 299 | case EXTENDED: |
299 | text = tr("Files"); | 300 | text = tr("Files"); |
300 | break; | 301 | break; |
301 | case EXTENDED_ALL: | 302 | case EXTENDED_ALL: |
302 | text = tr("All Files"); | 303 | text = tr("All Files"); |
303 | break; | 304 | break; |
304 | } | 305 | } |
305 | slotViewCheck( text ); | 306 | slotViewCheck( text ); |
306 | } | 307 | } |
307 | 308 | ||
308 | void OFileSelector::setPopupMenu(QPopupMenu *popup ) | 309 | void OFileSelector::setPopupMenu(QPopupMenu *popup ) |
309 | { | 310 | { |
310 | m_custom = popup; | 311 | m_custom = popup; |
311 | m_showPopup = true; | 312 | m_showPopup = true; |
312 | } | 313 | } |
313 | 314 | ||
314 | //void OFileSelector::updateL | 315 | //void OFileSelector::updateL |
315 | 316 | ||
316 | QString OFileSelector::selectedName() const | 317 | QString OFileSelector::selectedName() const |
317 | { | 318 | { |
318 | QString name; | 319 | QString name; |
319 | if( m_selector == NORMAL ){ | 320 | if( m_selector == NORMAL ){ |
320 | const DocLnk *lnk = m_select->selected(); | 321 | const DocLnk *lnk = m_select->selected(); |
321 | name = lnk->file(); | 322 | name = lnk->file(); |
322 | delete lnk; | 323 | delete lnk; |
323 | }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ | 324 | }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ |
324 | QListViewItem *item = m_View->currentItem(); | 325 | QListViewItem *item = m_View->currentItem(); |
325 | if( item != 0 ) | 326 | if( item != 0 ) |
326 | name = m_currentDir + "/" + item->text( 1 ); | 327 | name = m_currentDir + "/" + item->text( 1 ); |
327 | }else { // installed view | 328 | }else { // installed view |
328 | ; | 329 | ; |
329 | } | 330 | } |
330 | return name; | 331 | return name; |
331 | } | 332 | } |
332 | QStringList OFileSelector::selectedNames()const | 333 | QStringList OFileSelector::selectedNames()const |
333 | { | 334 | { |
334 | QStringList list; | 335 | QStringList list; |
335 | if( m_selector == NORMAL ){ | 336 | if( m_selector == NORMAL ){ |
336 | list << selectedName(); | 337 | list << selectedName(); |
337 | }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { | 338 | }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { |
338 | list << selectedName(); // FIXME implement multiple Selections | 339 | list << selectedName(); // FIXME implement multiple Selections |
339 | } | 340 | } |
340 | return list; | 341 | return list; |
341 | } | 342 | } |
342 | /** If mode is set to the Dir selection this will return the selected path. | 343 | /** If mode is set to the Dir selection this will return the selected path. |
343 | * | 344 | * |
344 | * | 345 | * |
345 | */ | 346 | */ |
346 | QString OFileSelector::selectedPath()const | 347 | QString OFileSelector::selectedPath()const |
347 | { | 348 | { |
348 | QString path; | 349 | QString path; |
349 | if( m_selector == NORMAL ){ | 350 | if( m_selector == NORMAL ){ |
350 | path = QPEApplication::documentDir(); | 351 | path = QPEApplication::documentDir(); |
351 | }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ | 352 | }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ |
352 | ; | 353 | ; |
353 | } | 354 | } |
354 | return path; | 355 | return path; |
355 | } | 356 | } |
356 | QStringList OFileSelector::selectedPaths() const | 357 | QStringList OFileSelector::selectedPaths() const |
357 | { | 358 | { |
358 | QStringList list; | 359 | QStringList list; |
359 | list << selectedPath(); | 360 | list << selectedPath(); |
360 | return list; | 361 | return list; |
361 | } | 362 | } |
362 | QString OFileSelector::directory()const | 363 | QString OFileSelector::directory()const |
363 | { | 364 | { |
364 | if( m_selector == NORMAL ) | 365 | if( m_selector == NORMAL ) |
365 | return QPEApplication::documentDir(); | 366 | return QPEApplication::documentDir(); |
366 | 367 | ||
367 | return QDir(m_currentDir).absPath(); | 368 | return QDir(m_currentDir).absPath(); |
368 | } | 369 | } |
369 | 370 | ||
370 | int OFileSelector::fileCount() | 371 | int OFileSelector::fileCount() |
371 | { | 372 | { |
372 | int count; | 373 | int count; |
373 | switch( m_selector ){ | 374 | switch( m_selector ){ |
374 | case NORMAL: | 375 | case NORMAL: |
375 | count = m_select->fileCount(); | 376 | count = m_select->fileCount(); |
376 | break; | 377 | break; |
377 | //case CUSTOM: | 378 | //case CUSTOM: |
378 | case EXTENDED: | 379 | case EXTENDED: |
379 | case EXTENDED_ALL: | 380 | case EXTENDED_ALL: |
380 | default: | 381 | default: |
381 | count = m_View->childCount(); | 382 | count = m_View->childCount(); |
382 | break; | 383 | break; |
383 | } | 384 | } |
384 | return count; | 385 | return count; |
385 | } | 386 | } |
386 | DocLnk OFileSelector::selectedDocument() const | 387 | DocLnk OFileSelector::selectedDocument() const |
387 | { | 388 | { |
388 | DocLnk lnk; | 389 | DocLnk lnk; |
389 | switch( m_selector ){ | 390 | switch( m_selector ){ |
390 | case NORMAL:{ | 391 | case NORMAL:{ |
391 | const DocLnk *lnk2 = m_select->selected(); | 392 | const DocLnk *lnk2 = m_select->selected(); |
392 | lnk = DocLnk(*lnk2 ); // copy | 393 | lnk = DocLnk(*lnk2 ); // copy |
393 | delete lnk2; | 394 | delete lnk2; |
394 | break; | 395 | break; |
395 | } | 396 | } |
396 | case EXTENDED: | 397 | case EXTENDED: |
397 | case EXTENDED_ALL: | 398 | case EXTENDED_ALL: |
398 | default: | 399 | default: |
399 | lnk = DocLnk( selectedName() ); // new DocLnk | 400 | lnk = DocLnk( selectedName() ); // new DocLnk |
400 | break; | 401 | break; |
401 | } | 402 | } |
402 | return lnk; | 403 | return lnk; |
403 | } | 404 | } |
404 | QValueList<DocLnk> OFileSelector::selectedDocuments() const | 405 | QValueList<DocLnk> OFileSelector::selectedDocuments() const |
405 | { | 406 | { |
406 | QValueList<DocLnk> docs; | 407 | QValueList<DocLnk> docs; |
407 | docs.append( selectedDocument() ); | 408 | docs.append( selectedDocument() ); |
408 | return docs; | 409 | return docs; |
409 | } | 410 | } |
410 | 411 | ||
411 | 412 | ||
412 | // slots internal | 413 | // slots internal |
413 | 414 | ||
414 | void OFileSelector::slotOk() | 415 | void OFileSelector::slotOk() |
415 | { | 416 | { |
416 | emit ok(); | 417 | emit ok(); |
417 | } | 418 | } |
418 | void OFileSelector::slotCancel() | 419 | void OFileSelector::slotCancel() |
419 | { | 420 | { |
420 | emit cancel(); | 421 | emit cancel(); |
421 | } | 422 | } |
422 | void OFileSelector::slotViewCheck(const QString &sel) | 423 | void OFileSelector::slotViewCheck(const QString &sel) |
423 | { | 424 | { |
424 | if( sel == tr("Documents" ) ){ | 425 | if( sel == tr("Documents" ) ){ |
425 | if( m_select == 0 ){ | 426 | if( m_select == 0 ){ |
426 | // autMime? fix cause now we use All and not the current | 427 | // autMime? fix cause now we use All and not the current |
427 | m_select = new FileSelector(m_autoMime ? QString::null : m_mimetypes.join(";"), | 428 | m_select = new FileSelector(m_autoMime ? QString::null : m_mimetypes.join(";"), |
428 | m_stack, "fileselector", | 429 | m_stack, "fileselector", |
429 | FALSE, FALSE); | 430 | FALSE, FALSE); |
430 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), | 431 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), |
431 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); | 432 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); |
432 | //connect to close me and other signals as well | 433 | //connect to close me and other signals as well |
433 | 434 | ||
434 | m_stack->addWidget( m_select, NORMAL ); | 435 | m_stack->addWidget( m_select, NORMAL ); |
435 | } | 436 | } |
436 | m_stack->raiseWidget( NORMAL ); | 437 | m_stack->raiseWidget( NORMAL ); |
437 | m_selector = NORMAL; | 438 | m_selector = NORMAL; |
438 | }else if( sel == tr("Files") ){ | 439 | }else if( sel == tr("Files") ){ |
439 | m_selector = EXTENDED; | 440 | m_selector = EXTENDED; |
440 | initializeListView(); | 441 | initializeListView(); |
441 | reparse(); | 442 | reparse(); |
442 | m_stack->raiseWidget( EXTENDED ); | 443 | m_stack->raiseWidget( EXTENDED ); |
443 | }else if( sel == tr("All Files") ){ | 444 | }else if( sel == tr("All Files") ){ |
444 | m_selector = EXTENDED_ALL; | 445 | m_selector = EXTENDED_ALL; |
445 | initializeListView(); | 446 | initializeListView(); |
446 | reparse(); | 447 | reparse(); |
447 | m_stack->raiseWidget( EXTENDED ); // same widget other QFileFilter | 448 | m_stack->raiseWidget( EXTENDED ); // same widget other QFileFilter |
448 | } | 449 | } |
449 | } | 450 | } |
450 | void OFileSelector::slotMimeCheck(const QString &mime) | 451 | void OFileSelector::slotMimeCheck(const QString &mime) |
451 | { | 452 | { |
452 | if( m_selector == NORMAL ){ | 453 | if( m_selector == NORMAL ){ |
453 | if( m_autoMime ){ | 454 | if( m_autoMime ){ |
454 | delete m_select; | 455 | delete m_select; |
455 | m_select = new FileSelector( mime == tr("All") ? QString::null : mime, | 456 | m_select = new FileSelector( mime == tr("All") ? QString::null : mime, |
456 | m_stack, "fileselector", | 457 | m_stack, "fileselector", |
457 | FALSE, FALSE); | 458 | FALSE, FALSE); |
458 | 459 | ||
459 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), | 460 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), |
460 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); | 461 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); |
461 | //connect to close me and other signals as well | 462 | //connect to close me and other signals as well |
462 | m_stack->addWidget( m_select, NORMAL ); | 463 | m_stack->addWidget( m_select, NORMAL ); |
463 | m_stack->raiseWidget( NORMAL ); | 464 | m_stack->raiseWidget( NORMAL ); |
464 | updateMimes(); | 465 | updateMimes(); |
465 | m_mimeCheck->clear(); | 466 | m_mimeCheck->clear(); |
466 | m_mimeCheck->insertStringList(m_mimetypes ); | 467 | m_mimeCheck->insertStringList(m_mimetypes ); |
467 | m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); | 468 | m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); |
468 | } | 469 | } |
469 | }else{ // others | 470 | }else{ // others |
470 | qWarning("Mime %s", mime.latin1() ); | 471 | qWarning("Mime %s", mime.latin1() ); |
471 | if(m_shChooser ){ | 472 | if(m_shChooser ){ |
472 | qWarning("Current Text %s", m_mimeCheck->currentText().latin1() ); | 473 | qWarning("Current Text %s", m_mimeCheck->currentText().latin1() ); |
473 | //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); | 474 | //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); |
474 | } | 475 | } |
475 | reparse(); | 476 | reparse(); |
476 | } | 477 | } |
477 | 478 | ||
478 | } | 479 | } |
479 | void OFileSelector::slotLocationActivated(const QString &file) | 480 | void OFileSelector::slotLocationActivated(const QString &file) |
480 | { | 481 | { |
481 | cd(file.left(file.find("<-",0,TRUE))); | 482 | cd(file.left(file.find("<-",0,TRUE))); |
482 | reparse(); | 483 | reparse(); |
483 | } | 484 | } |
484 | void OFileSelector::slotInsertLocationPath(const QString ¤tPath, int count) | 485 | void OFileSelector::slotInsertLocationPath(const QString ¤tPath, int count) |
485 | { | 486 | { |
486 | QStringList pathList; | 487 | QStringList pathList; |
487 | bool underDog = FALSE; | 488 | bool underDog = FALSE; |
488 | for(int i=0;i<count;i++) { | 489 | for(int i=0;i<count;i++) { |
489 | pathList << m_location->text(i); | 490 | pathList << m_location->text(i); |
490 | if( m_location->text(i) == currentPath) | 491 | if( m_location->text(i) == currentPath) |
491 | underDog = TRUE; | 492 | underDog = TRUE; |
492 | } | 493 | } |
493 | if( !underDog) { | 494 | if( !underDog) { |
494 | m_location->clear(); | 495 | m_location->clear(); |
495 | if( currentPath.left(2)=="//") | 496 | if( currentPath.left(2)=="//") |
496 | pathList.append( currentPath.right(currentPath.length()-1) ); | 497 | pathList.append( currentPath.right(currentPath.length()-1) ); |
497 | else | 498 | else |
498 | pathList.append( currentPath ); | 499 | pathList.append( currentPath ); |
499 | m_location->insertStringList( pathList,-1); | 500 | m_location->insertStringList( pathList,-1); |
500 | } | 501 | } |
501 | } | 502 | } |
502 | void OFileSelector::locationComboChanged() | 503 | void OFileSelector::locationComboChanged() |
503 | { | 504 | { |
504 | cd( m_location->lineEdit()->text()); | 505 | cd( m_location->lineEdit()->text()); |
505 | reparse(); | 506 | reparse(); |
506 | } | 507 | } |
507 | void OFileSelector::init() | 508 | void OFileSelector::init() |
508 | { | 509 | { |
509 | m_lay = new QVBoxLayout( this ); | 510 | m_lay = new QVBoxLayout( this ); |
510 | m_lay->setSpacing(0 ); | 511 | m_lay->setSpacing(0 ); |
511 | 512 | ||
512 | m_stack = new QWidgetStack( this ); | 513 | m_stack = new QWidgetStack( this ); |
513 | if( m_selector == NORMAL ){ | 514 | if( m_selector == NORMAL ){ |
514 | m_select = new FileSelector(m_autoMime ? QString::null : m_mimetypes.join(";"), | 515 | m_select = new FileSelector(m_autoMime ? QString::null : m_mimetypes.join(";"), |
515 | m_stack, "fileselector", | 516 | m_stack, "fileselector", |
516 | FALSE, FALSE); | 517 | FALSE, FALSE); |
517 | 518 | ||
518 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), | 519 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), |
519 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); | 520 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); |
520 | //connect to close me and other signals as well | 521 | //connect to close me and other signals as well |
521 | 522 | ||
522 | m_stack->addWidget( m_select, NORMAL ); | 523 | m_stack->addWidget( m_select, NORMAL ); |
523 | m_stack->raiseWidget( NORMAL ); | 524 | m_stack->raiseWidget( NORMAL ); |
524 | }else{ // we're in init so it will be EXTENDED or EXTENDED_ALL | 525 | }else{ // we're in init so it will be EXTENDED or EXTENDED_ALL |
525 | // and initializeListview will take care of those | 526 | // and initializeListview will take care of those |
526 | // toolbar get's generade in initializeListView | 527 | // toolbar get's generade in initializeListView |
527 | initializeListView( ); // will raise the widget as well | 528 | initializeListView( ); // will raise the widget as well |
528 | } | 529 | } |
529 | m_lay->addWidget( m_stack, 100 ); // add to the layout 10 = stretch | 530 | m_lay->addWidget( m_stack, 100 ); // add to the layout 10 = stretch |
530 | 531 | ||
531 | if( m_shLne ) // the LineEdit with the current FileName | 532 | if( m_shLne ) // the LineEdit with the current FileName |
532 | initializeName(); | 533 | initializeName(); |
533 | 534 | ||
534 | if( m_shPerm ) // the Permission QCheckBox | 535 | if( m_shPerm ) // the Permission QCheckBox |
535 | initializePerm(); | 536 | initializePerm(); |
536 | 537 | ||
537 | if( m_shChooser ) // the Chooser for the view and Mimetypes | 538 | if( m_shChooser ) // the Chooser for the view and Mimetypes |
538 | initializeChooser(); | 539 | initializeChooser(); |
539 | 540 | ||
540 | if( m_shYesNo ) // the Yes No button row | 541 | if( m_shYesNo ) // the Yes No button row |
541 | initializeYes( ); | 542 | initializeYes( ); |
542 | } | 543 | } |
543 | void OFileSelector::updateMimes() | 544 | void OFileSelector::updateMimes() |
544 | { | 545 | { |
545 | if( m_autoMime ){ | 546 | if( m_autoMime ){ |
546 | m_mimetypes.clear(); | 547 | m_mimetypes.clear(); |
547 | m_mimetypes.append( tr("All") ); | 548 | m_mimetypes.append( tr("All") ); |
548 | if( m_selector == NORMAL ){ | 549 | if( m_selector == NORMAL ){ |
549 | DocLnkSet set; | 550 | DocLnkSet set; |
550 | Global::findDocuments(&set, QString::null ); | 551 | Global::findDocuments(&set, QString::null ); |
551 | QListIterator<DocLnk> dit( set.children() ); | 552 | QListIterator<DocLnk> dit( set.children() ); |
552 | for( ; dit.current(); ++dit ){ | 553 | for( ; dit.current(); ++dit ){ |
553 | if( !m_mimetypes.contains( (*dit)->type() ) ) | 554 | if( !m_mimetypes.contains( (*dit)->type() ) ) |
554 | m_mimetypes.append( (*dit)->type() ); | 555 | m_mimetypes.append( (*dit)->type() ); |
555 | } | 556 | } |
556 | }// else done in reparse | 557 | }// else done in reparse |
557 | } | 558 | } |
558 | } | 559 | } |
559 | void OFileSelector::initVars() | 560 | void OFileSelector::initVars() |
560 | { | 561 | { |
561 | if( m_mimetypes.isEmpty() ) | 562 | if( m_mimetypes.isEmpty() ) |
562 | m_autoMime = true; | 563 | m_autoMime = true; |
563 | else | 564 | else |
564 | m_autoMime = false; | 565 | m_autoMime = false; |
565 | m_shClose = false; | 566 | m_shClose = false; |
566 | m_shNew = false; | 567 | m_shNew = false; |
567 | m_shTool = true; | 568 | m_shTool = true; |
568 | m_shPerm = false; | 569 | m_shPerm = false; |
569 | m_shLne = true; | 570 | m_shLne = true; |
570 | m_shChooser = true; | 571 | m_shChooser = true; |
571 | m_shYesNo = true; | 572 | m_shYesNo = true; |
572 | m_case = false; | 573 | m_case = false; |
573 | m_dir = true; | 574 | m_dir = true; |
574 | m_files = true; | 575 | m_files = true; |
575 | m_showPopup = false; | 576 | m_showPopup = false; |
576 | if(m_pixmaps == 0 ) // init the pixmaps | 577 | if(m_pixmaps == 0 ) // init the pixmaps |
577 | initPics(); | 578 | initPics(); |
578 | 579 | ||
579 | // pointers | 580 | // pointers |
580 | m_location = 0; | 581 | m_location = 0; |
581 | m_mimeCheck = 0; | 582 | m_mimeCheck = 0; |
582 | m_viewCheck = 0; | 583 | m_viewCheck = 0; |
583 | m_homeButton = 0; | 584 | m_homeButton = 0; |
584 | m_docButton = 0; | 585 | m_docButton = 0; |
585 | m_hideButton = 0; | 586 | m_hideButton = 0; |
586 | m_ok = 0; | 587 | m_ok = 0; |
587 | m_cancel = 0; | 588 | m_cancel = 0; |
588 | m_reread = 0; | 589 | m_reread = 0; |
589 | m_up = 0; | 590 | m_up = 0; |
590 | m_View = 0; | 591 | m_View = 0; |
591 | m_checkPerm = 0; | 592 | m_checkPerm = 0; |
592 | m_pseudo = 0; | 593 | m_pseudo = 0; |
593 | m_pseudoLayout = 0; | 594 | m_pseudoLayout = 0; |
594 | m_select = 0; | 595 | m_select = 0; |
595 | m_stack = 0; | 596 | m_stack = 0; |
596 | m_lay = 0; | 597 | m_lay = 0; |
597 | m_Oselector = 0; | 598 | m_Oselector = 0; |
598 | m_boxToolbar = 0; | 599 | m_boxToolbar = 0; |
599 | m_boxOk = 0; | 600 | m_boxOk = 0; |
600 | m_boxName = 0; | 601 | m_boxName = 0; |
601 | m_boxView = 0; | 602 | m_boxView = 0; |
602 | m_custom = 0; | 603 | m_custom = 0; |
603 | m_edit = 0; | 604 | m_edit = 0; |
604 | m_fnLabel = 0; | 605 | m_fnLabel = 0; |
605 | m_new = 0; | 606 | m_new = 0; |
606 | m_close = 0; | 607 | m_close = 0; |
607 | } | 608 | } |
608 | void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink) | 609 | void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink) |
609 | { | 610 | { |
610 | if(!m_files) | 611 | if(!m_files) |
611 | return; | 612 | return; |
612 | // if( !compliesMime(info->absFilePath(), mime ) ) | 613 | // if( !compliesMime(info->absFilePath(), mime ) ) |
613 | // return; | 614 | // return; |
614 | MimeType type( info->absFilePath() ); | 615 | MimeType type( info->absFilePath() ); |
615 | if( mime != tr("All") && type.id() != mime ) | 616 | if( mime != tr("All") && type.id() != mime ) |
616 | return; | 617 | return; |
617 | QPixmap pix = type.pixmap(); | 618 | QPixmap pix = type.pixmap(); |
618 | QString dir; | 619 | QString dir; |
619 | QString name; | 620 | QString name; |
620 | bool locked; | 621 | bool locked; |
621 | if( pix.isNull() ) | 622 | if( pix.isNull() ) |
622 | pix = Resource::loadPixmap( "UnknownDocument-14"); | 623 | pix = Resource::loadPixmap( "UnknownDocument-14"); |
623 | dir = info->dirPath( true ); | 624 | dir = info->dirPath( true ); |
624 | if( symlink ) | 625 | if( symlink ) |
625 | name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); | 626 | name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); |
626 | else { | 627 | else { |
627 | name = info->fileName(); | 628 | name = info->fileName(); |
628 | if( ( m_mode == OPEN && !info->isReadable() )|| | 629 | if( ( m_mode == OPEN && !info->isReadable() )|| |
629 | ( m_mode == SAVE && !info->isWritable() ) ){ | 630 | ( m_mode == SAVE && !info->isWritable() ) ){ |
630 | 631 | ||
631 | locked = true; pix = Resource::loadPixmap("locked"); | 632 | locked = true; pix = Resource::loadPixmap("locked"); |
632 | } | 633 | } |
633 | } | 634 | } |
634 | new OFileSelectorItem( m_View, pix, name, | 635 | new OFileSelectorItem( m_View, pix, name, |
635 | info->lastModified().toString(), | 636 | info->lastModified().toString(), |
636 | QString::number( info->size() ), | 637 | QString::number( info->size() ), |
637 | dir, locked ); | 638 | dir, locked ); |
638 | } | 639 | } |
639 | void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) | 640 | void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) |
640 | { | 641 | { |
641 | if(!m_dir) | 642 | if(!m_dir) |
642 | return; | 643 | return; |
643 | if( m_selector == EXTENDED_ALL || m_selector == EXTENDED ){ | 644 | if( m_selector == EXTENDED_ALL || m_selector == EXTENDED ){ |
644 | bool locked = false; | 645 | bool locked = false; |
645 | QString name; | 646 | QString name; |
646 | QPixmap pix; | 647 | QPixmap pix; |
647 | if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ | 648 | if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ |
648 | locked = true; | 649 | locked = true; |
649 | if( symlink ) | 650 | if( symlink ) |
650 | pix = (*m_pixmaps)["symlinkedlocked"]; | 651 | pix = (*m_pixmaps)["symlinkedlocked"]; |
651 | else | 652 | else |
652 | pix = Resource::loadPixmap("lockedfolder"); | 653 | pix = Resource::loadPixmap("lockedfolder"); |
653 | }else { // readable | 654 | }else { // readable |
654 | pix = symlink ? (*m_pixmaps)["dirsymlink"] : Resource::loadPixmap("folder") ; | 655 | pix = symlink ? (*m_pixmaps)["dirsymlink"] : Resource::loadPixmap("folder") ; |
655 | } | 656 | } |
656 | name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; | 657 | name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; |
657 | new OFileSelectorItem( m_View, pix, name, | 658 | new OFileSelectorItem( m_View, pix, name, |
658 | info->lastModified().toString(), | 659 | info->lastModified().toString(), |
659 | QString::number( info->size() ), | 660 | QString::number( info->size() ), |
660 | info->dirPath( true ), locked, | 661 | info->dirPath( true ), locked, |
661 | true ); | 662 | true ); |
662 | 663 | ||
663 | }// else CUSTOM View | 664 | }// else CUSTOM View |
664 | } | 665 | } |
665 | void OFileSelector::delItems() | 666 | void OFileSelector::delItems() |
666 | { | 667 | { |
667 | 668 | ||
668 | } | 669 | } |
669 | void OFileSelector::initializeName() | 670 | void OFileSelector::initializeName() |
670 | { | 671 | { |
671 | /** Name Layout Line | 672 | /** Name Layout Line |
672 | * This is the Layout line arranged in | 673 | * This is the Layout line arranged in |
673 | * horizontal way each components | 674 | * horizontal way each components |
674 | * are next to each other | 675 | * are next to each other |
675 | * but we will only do this if | 676 | * but we will only do this if |
676 | * we didn't initialize a while ago. | 677 | * we didn't initialize a while ago. |
677 | */ | 678 | */ |
678 | if( m_boxName == 0 ){ | 679 | if( m_boxName == 0 ){ |
679 | m_boxName = new QHBox( this ); // remove this this? or use a QHBox | 680 | m_boxName = new QHBox( this ); // remove this this? or use a QHBox |
680 | m_fnLabel = new QLabel( m_boxName ); | 681 | m_fnLabel = new QLabel( m_boxName ); |
681 | m_fnLabel->setText( tr("Name:") ); | 682 | m_fnLabel->setText( tr("Name:") ); |
682 | m_edit = new QLineEdit( m_boxName ); | 683 | m_edit = new QLineEdit( m_boxName ); |
683 | //m_boxName->addWidget( m_fnLabel ); | 684 | //m_boxName->addWidget( m_fnLabel ); |
684 | m_boxName->setMargin( 5 ); | 685 | m_boxName->setMargin( 5 ); |
685 | m_boxName->setSpacing( 8 ); | 686 | m_boxName->setSpacing( 8 ); |
686 | //m_boxName->setStretchFactor(m_edit, 100 ); // 100 is stretch factor | 687 | //m_boxName->setStretchFactor(m_edit, 100 ); // 100 is stretch factor |
687 | 688 | ||
688 | m_lay->addWidget( m_boxName, 0 ); // add it to the topLevel layout | 689 | m_lay->addWidget( m_boxName, 0 ); // add it to the topLevel layout |
689 | }// else we already initialized | 690 | }// else we already initialized |
690 | // maybe show the components? | 691 | // maybe show the components? |
691 | // | 692 | // |
692 | } | 693 | } |
693 | void OFileSelector::initializeYes() | 694 | void OFileSelector::initializeYes() |
694 | { | 695 | { |
695 | /** The Save Cancel bar | 696 | /** The Save Cancel bar |
696 | * | 697 | * |
697 | */ | 698 | */ |
698 | if( m_boxOk == 0 ){ | 699 | if( m_boxOk == 0 ){ |
699 | m_boxOk = new QHBox( this ); | 700 | m_boxOk = new QHBox( this ); |
700 | m_ok = new QPushButton( tr("&Save"),m_boxOk , "save" ); | 701 | m_ok = new QPushButton( tr("&Save"),m_boxOk , "save" ); |
701 | m_cancel = new QPushButton( tr("C&ancel"), m_boxOk, "cancel" ); | 702 | m_cancel = new QPushButton( tr("C&ancel"), m_boxOk, "cancel" ); |
702 | 703 | ||
703 | //m_boxOk->addWidget( m_ok ); | 704 | //m_boxOk->addWidget( m_ok ); |
704 | //m_boxOk->addWidget( m_cancel ); | 705 | //m_boxOk->addWidget( m_cancel ); |
705 | m_boxOk->setMargin( 5 ); | 706 | m_boxOk->setMargin( 5 ); |
706 | m_boxOk->setSpacing( 10 ); | 707 | m_boxOk->setSpacing( 10 ); |
707 | m_lay->addWidget( m_boxOk, 0 ); | 708 | m_lay->addWidget( m_boxOk, 0 ); |
708 | 709 | ||
709 | connect( m_ok, SIGNAL( clicked() ), | 710 | connect( m_ok, SIGNAL( clicked() ), |
710 | this, SLOT(slotOk() ) ); | 711 | this, SLOT(slotOk() ) ); |
711 | connect( m_cancel, SIGNAL( clicked() ), | 712 | connect( m_cancel, SIGNAL( clicked() ), |
712 | this, SLOT( slotCancel() ) ); | 713 | this, SLOT( slotCancel() ) ); |
713 | } | 714 | } |
714 | } | 715 | } |
715 | void OFileSelector::initializeChooser() | 716 | void OFileSelector::initializeChooser() |
716 | { | 717 | { |
717 | if( m_boxView == 0 ){ | 718 | if( m_boxView == 0 ){ |
718 | m_boxView = new QHBox( this ); | 719 | m_boxView = new QHBox( this ); |
719 | m_viewCheck = new QComboBox( m_boxView, "view check"); | 720 | m_viewCheck = new QComboBox( m_boxView, "view check"); |
720 | m_mimeCheck = new QComboBox( m_boxView, "mime check"); | 721 | m_mimeCheck = new QComboBox( m_boxView, "mime check"); |
721 | m_boxView->setSpacing( 8 ); | 722 | m_boxView->setSpacing( 8 ); |
722 | m_lay->addWidget(m_boxView, 0 ); | 723 | m_lay->addWidget(m_boxView, 0 ); |
723 | 724 | ||
724 | m_viewCheck->insertItem( tr("Documents") ); | 725 | m_viewCheck->insertItem( tr("Documents") ); |
725 | m_viewCheck->insertItem( tr("Files") ); | 726 | m_viewCheck->insertItem( tr("Files") ); |
726 | m_viewCheck->insertItem( tr("All Files") ); | 727 | m_viewCheck->insertItem( tr("All Files") ); |
727 | if(!m_autoMime ) | 728 | if(!m_autoMime ) |
728 | m_mimeCheck->insertItem(m_mimetypes.join(",") ); | 729 | m_mimeCheck->insertItem(m_mimetypes.join(",") ); |
729 | else{ | 730 | else{ |
730 | updateMimes(); | 731 | updateMimes(); |
731 | m_mimeCheck->insertStringList( m_mimetypes ); | 732 | m_mimeCheck->insertStringList( m_mimetypes ); |
732 | } | 733 | } |
733 | connect( m_viewCheck, SIGNAL( activated(const QString & ) ), | 734 | connect( m_viewCheck, SIGNAL( activated(const QString & ) ), |
734 | this, SLOT( slotViewCheck(const QString & ) ) ); | 735 | this, SLOT( slotViewCheck(const QString & ) ) ); |
735 | connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), | 736 | connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), |
736 | this, SLOT( slotMimeCheck( const QString & ) ) ); | 737 | this, SLOT( slotMimeCheck( const QString & ) ) ); |
737 | } | 738 | } |
738 | } | 739 | } |
739 | void OFileSelector::initializeListView() | 740 | void OFileSelector::initializeListView() |
740 | { | 741 | { |
741 | if( m_pseudo == 0 ){ | 742 | if( m_pseudo == 0 ){ |
742 | m_pseudo = new QWidget( m_stack, "Pseudo Widget"); | 743 | m_pseudo = new QWidget( m_stack, "Pseudo Widget"); |
743 | m_pseudoLayout = new QVBoxLayout( m_pseudo ); | 744 | m_pseudoLayout = new QVBoxLayout( m_pseudo ); |
744 | // toolbar | 745 | // toolbar |
745 | m_boxToolbar = new QHBox( m_pseudo ); | 746 | m_boxToolbar = new QHBox( m_pseudo ); |
746 | m_boxToolbar->setSpacing(0 ); // next to each other please | 747 | m_boxToolbar->setSpacing(0 ); // next to each other please |
747 | 748 | ||
748 | // toolbar members | 749 | // toolbar members |
749 | { | 750 | { |
750 | // location QComboBox | 751 | // location QComboBox |
751 | m_location = new QComboBox( m_boxToolbar ); | 752 | m_location = new QComboBox( m_boxToolbar ); |
752 | m_location->setEditable( TRUE ); | 753 | m_location->setEditable( TRUE ); |
753 | m_location->setDuplicatesEnabled( FALSE ); | 754 | m_location->setDuplicatesEnabled( FALSE ); |
754 | connect( m_location, SIGNAL(activated(const QString &) ), | 755 | connect( m_location, SIGNAL(activated(const QString &) ), |
755 | this, SLOT( slotLocationActivated(const QString &) ) ); | 756 | this, SLOT( slotLocationActivated(const QString &) ) ); |
756 | connect( m_location->lineEdit(), SIGNAL(returnPressed() ), | 757 | connect( m_location->lineEdit(), SIGNAL(returnPressed() ), |
757 | this, SLOT(locationComboChanged() ) ); | 758 | this, SLOT(locationComboChanged() ) ); |
758 | // UP Button | 759 | // UP Button |
759 | m_up = new QPushButton(Resource::loadIconSet("up"),"", | 760 | m_up = new QPushButton(Resource::loadIconSet("up"),"", |
760 | m_boxToolbar,"cdUpButton"); | 761 | m_boxToolbar,"cdUpButton"); |
761 | m_up->setFixedSize( QSize( 20, 20 ) ); | 762 | m_up->setFixedSize( QSize( 20, 20 ) ); |
762 | connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); | 763 | connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); |
763 | m_up->setFlat(TRUE); | 764 | m_up->setFlat(TRUE); |
764 | 765 | ||
765 | // Home Button | 766 | // Home Button |
766 | m_homeButton = new QPushButton(Resource::loadIconSet("home") , | 767 | m_homeButton = new QPushButton(Resource::loadIconSet("home") , |
767 | "", m_boxToolbar); | 768 | "", m_boxToolbar); |
768 | m_homeButton->setFixedSize( QSize( 20, 20 ) ); | 769 | m_homeButton->setFixedSize( QSize( 20, 20 ) ); |
769 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); | 770 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); |
770 | m_homeButton->setFlat(TRUE); | 771 | m_homeButton->setFlat(TRUE); |
771 | // Documents Button | 772 | // Documents Button |
772 | m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", | 773 | m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", |
773 | m_boxToolbar,"docsButton"); | 774 | m_boxToolbar,"docsButton"); |
774 | m_docButton->setFixedSize( QSize( 20, 20 ) ); | 775 | m_docButton->setFixedSize( QSize( 20, 20 ) ); |
775 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); | 776 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); |
776 | m_docButton->setFlat(TRUE); | 777 | m_docButton->setFlat(TRUE); |
777 | 778 | ||
778 | // Close button | 779 | // Close button |
779 | m_close = new QPushButton( Resource::loadIconSet( "close"), "", | 780 | m_close = new QPushButton( Resource::loadIconSet( "close"), "", |