summaryrefslogtreecommitdiff
path: root/libopie/ofileselector/ofileselector.h
Unidiff
Diffstat (limited to 'libopie/ofileselector/ofileselector.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector/ofileselector.h492
1 files changed, 0 insertions, 492 deletions
diff --git a/libopie/ofileselector/ofileselector.h b/libopie/ofileselector/ofileselector.h
deleted file mode 100644
index 76c3ced..0000000
--- a/libopie/ofileselector/ofileselector.h
+++ b/dev/null
@@ -1,492 +0,0 @@
1/*
2 This is based on code and ideas of
3 L. J. Potter ljp@llornkcor.com
4 Thanks a lot
5
6
7               =. This file is part of the OPIE Project
8             .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
9           .>+-=
10 _;:,     .>    :=|. This library is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This library is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details.
24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
33
34#ifndef opiefileselector_h
35#define opiefileselector_h
36
37#include <qpe/fileselector.h>
38
39#include <qdir.h>
40#include <qguardedptr.h>
41#include <qwidget.h>
42#include <qstring.h>
43#include <qpixmap.h>
44#include <qstringlist.h>
45#include <qmap.h>
46#include <qvaluelist.h>
47
48#include <qpe/applnk.h>
49#include <qlistview.h>
50
51/** This is OPIEs FileDialog Widget. You can use it
52 * as a dropin replacement of the fileselector and
53 * or use any of the new features.
54 * This is also a complete FileSave and FileLoad widget
55 * If you look for a Dialog check OFileDialog
56 *
57 */
58class DocLnk;
59class QCheckBox;
60class QComboBox;
61class QPushButton;
62class QGridLayout;
63class QLineEdit;
64class QLabel;
65class QWidgetStack;
66class QHBoxLayout;
67class QVBoxLayout;
68class QPopupMenu;
69class QFileInfo;
70class QHBox;
71class OFileView;
72class OLister;
73class OFileSelectorMain;
74class OFileFactory;
75//
76
77/* the mimetypes one name and a list of mimetypes */
78typedef QMap< QString, QStringList> MimeTypes;
79
80/**
81 * FIXME later
82 */
83struct OPopupMenuFactory {
84 OPopupMenuFactory() {}
85
86};
87
88
89/**
90 * Opie the default OFileSelector
91 * It features multiple views.
92 */
93class OFileSelector : public QWidget {
94 Q_OBJECT
95
96 /* friends are evil but I don't want to make the
97 * methods public
98 */
99 friend class OLister;
100 friend class OFileView;
101 public:
102 /**
103 * The mode of the file selector
104 * Either open, save, fileselector or dir browsing mode
105 *
106 */
107 enum Mode {Open = 1, Save = 2, Fileselector = 4, Dir = 8 };
108
109 /**
110 * Selector. Either Normal for the one shipped with
111 * libqpe or Extended. for the Extended
112 * ExtendedAll also shows 'hidden' files
113 */
114 enum Selector{Normal=0, Extended = 1, ExtendedAll = 2};
115
116 /**
117 * This is reserved for futrue views
118 */
119 enum View { Dirs = 1, Files = 2, Tree = 4, Icon = 8 };
120
121 /**
122 * A c'tor which should be used for advanced mode
123 * @param wid the parent
124 * @param mode the Mode of the Selector
125 * @param selector the current View of the Selector
126 * @param dirName in which dir to start
127 * @param fileName a proposed filename
128 * @param mimetypes A list of mimetypes \
129 * QString is for a identifier name like "Text files"
130 * the coresponding QStringList is used for the mimetypes
131 * if empty it'll fill the list of mimetypes depending
132 * on the content of the current directory
133 */
134
135 OFileSelector(QWidget *wid, int mode, int selector,
136 const QString &dirName,
137 const QString &fileName = QString::null,
138 const MimeTypes &mimetypes = MimeTypes() );
139
140
141 /**
142 * This is a QPE compatible c'tor
143 */
144 OFileSelector(const QString &mimeFilter, QWidget *parent,
145 const char *name, bool newVisible = TRUE,
146 bool closeVisible = FALSE );
147
148 ~OFileSelector();
149
150 // currently only for the FileSelector Mode
151 /* compability mode but only work
152 * with FileSelector
153 */
154 void setNewVisible( bool /*b*/ );
155 void setCloseVisible(bool /*b*/ );
156
157 // end file selector mode
158 // deprecated
159 void reread();
160 // make sure not to leak please
161 const DocLnk *selected();
162 // end deprecated
163
164 /**
165 * @return if the toolbar is visible
166 */
167 bool isToolbarVisible() const { return m_shTool; };
168
169 /**
170 * @return if the permissionBas is visible
171 */
172 bool isPermissionBarVisible() const { return m_shPerm; };
173
174 /**
175 * @return if the lineEdit is visible
176 */
177 bool isLineEditVisible()const { return m_shLne; };
178
179 /**
180 * if the chooser is visible
181 */
182 bool isChooserVisible( )const { return m_shChooser; };
183
184 /**
185 * @return if the yesCancel Bar is visible
186 */
187 bool isYesCancelVisible()const { return m_shYesNo; };
188
189 /**
190 * set Yes/Cancel visible
191 */
192 void setYesCancelVisible( bool show );
193
194 /**
195 * set the toolbar visible
196 */
197 void setToolbarVisible( bool show );
198
199 /**
200 * set the permissionBar to be visible
201 */
202 void setPermissionBarVisible( bool show );
203
204 /**
205 * set the lineedit for file entering visible
206 */
207 void setLineEditVisible(bool show) ;
208
209 /**
210 * set the chooser is visible
211 */
212 void setChooserVisible( bool chooser );
213
214 /**
215 * The permissionCheckbox
216 *
217 */
218 QCheckBox* permissionCheckbox();
219
220 /**
221 * setPermission
222 */
223 bool setPermission() const;
224
225 /**
226 * set ther permission to bool
227 */
228 void setPermissionChecked( bool check );
229
230 /**
231 * set the Selector Mode
232 */
233 void setMode( int );
234
235 void setLister( const QString& name );
236 void setView( const QString& all );
237 /**
238 * whether or not to show dirs
239 */
240 bool showDirs()const { return m_dir; }
241
242 /**
243 * setShowDirs
244 */
245 void setShowDirs(bool );
246
247 /**
248 * set CaseSensetive
249 */
250 bool isCaseSensetive()const { return m_case; }
251
252 /**
253 * set if to be case sensetive
254 */
255 void setCaseSensetive(bool caSe );
256
257 /**
258 * @return if to show files
259 */
260 bool showFiles()const { return m_files; };
261
262 /**
263 * set if files should be shown
264 */
265 void setShowFiles(bool );
266
267 /**
268 * change dir to path
269 */
270 bool cd(const QString &path );
271
272
273 /**
274 * return the mode of the fileselector
275 */
276 int mode()const { return m_mode; };
277
278 /**
279 * return the selector
280 */
281 int selector()const { return m_selector; };
282
283 /**
284 * set the Selector
285 */
286 void setSelector( int );
287
288 /**
289 * wether or not to show popups
290 */
291 bool showPopup()const { return m_showPopup; };
292
293 /**
294 * set show popups
295 */
296 void setShowPopup( bool pop ) { m_showPopup = pop; }
297
298 /**
299 * set the popup factory
300 */
301 void setPopupFactory( OPopupMenuFactory * );
302
303 /**
304 * reparse the current directory and updates
305 * the views + mimetypes
306 */
307 void reparse(); // re reads the dir
308
309 /**
310 * return the selected name
311 */
312 QString selectedName( )const;
313
314 /**
315 * for multiple selections return multiple
316 * filenames
317 */
318 QStringList selectedNames()const;
319
320 /**
321 * return the complete to the file
322 */
323 QString selectedPath() const;
324
325 /**
326 * return the completed paths
327 */
328 QStringList selectedPaths() const;
329
330 /**
331 * the current directory
332 */
333 QString directory()const;
334
335 /**
336 * fileCount
337 */
338 int fileCount();
339
340 DocLnk selectedDocument()const;
341
342 QValueList<DocLnk> selectedDocuments()const;
343
344 OFileView* currentView();
345 OFileView* currentView()const;
346 OLister* currentLister()const;
347 OFileFactory* factory();
348 int filter();
349 int sorting();
350 QPixmap pixmap( const QString& );
351 /* our tool bar */
352 QWidget* toolBar();
353
354 signals:
355 void fileSelected( const DocLnk & );
356 void fileSelected( const QString & );
357 void dirSelected(const QString &dir );
358 void dirSelected( const QDir& );
359 void closeMe();
360 void ok();
361 void cancel();
362 void contextMenu();
363
364 private slots:
365 void slotOk();
366 void slotCancel();
367 void slotViewCheck(const QString & );
368 void slotMimeCheck(const QString & );
369 void slotLocationActivated(const QString & );
370 void slotInsertLocationPath(const QString &, int);
371 void locationComboChanged();
372
373 private:
374 void init();
375 void updateMimes();
376
377
378 private:
379
380 OFileFactory* m_fileFactory;
381 OFileSelectorMain* m_mainView;
382 OLister* m_lister;
383 QString m_listerName;
384 OFileView* m_fileView;
385 FileSelector* m_select;
386 int m_mode, m_selector;
387 QComboBox *m_location,
388 *m_mimeCheck,
389 *m_viewCheck;
390
391 QPushButton *m_homeButton,
392 *m_docButton,
393 *m_hideButton,
394 *m_ok, *m_cancel;
395 QPushButton *m_reread,
396 *m_up,
397 *m_new,
398 *m_close;
399 QListView *m_View;
400 QCheckBox *m_checkPerm;
401 QWidget *m_pseudo;
402 QVBoxLayout *m_pseudoLayout;
403
404 QString m_currentDir;
405 QString m_name;
406
407 QMap<QString, QStringList> m_mimetypes;
408
409 QVBoxLayout *m_lay;
410 QGridLayout *m_Oselector;
411
412 QHBox *m_boxToolbar;
413 QHBox *m_boxOk;
414 QHBox *m_boxName;
415 QHBox *m_boxView;
416
417
418 QLineEdit *m_edit;
419 QLabel *m_fnLabel;
420
421 bool m_shClose : 1;
422 bool m_shNew : 1;
423 bool m_shTool : 1;
424 bool m_shPerm : 1;
425 bool m_shLne : 1;
426 bool m_shChooser : 1;
427 bool m_shYesNo : 1;
428 bool m_boCheckPerm : 1;
429 bool m_autoMime : 1;
430 bool m_case : 1;
431 bool m_dir : 1;
432 bool m_files : 1;
433 bool m_showPopup : 1;
434 bool m_showHidden : 1;
435
436 void initVars();
437
438 void delItems();
439 void initializeName();
440 void initializeYes();
441 void initializeChooser();
442 void initializePerm();
443 void initPics();
444 bool compliesMime(const QString &path,
445 const QString &mime);
446 bool compliesMime(const QString& mime );
447 /**
448 * Updates the QComboBox with the current mimetypes
449 */
450 void updateMimeCheck();
451
452 void initializeOldSelector();
453 void initToolbar();
454 void initLocations();
455 void initializeView(); // FIXME
456 void fillList();
457 void initFactory();
458 /**
459 * Returns the current mimetype
460 */
461 QString currentMimeType()const;
462 class OFileSelectorPrivate;
463 OFileSelectorPrivate *d;
464 static QMap<QString,QPixmap> *m_pixmaps;
465
466private slots:
467 void slotFileSelected(const QString & ); // not really meant to be a slot
468 void slotFileBridgeSelected( const DocLnk & );
469 // listview above
470 // popup below
471 virtual void slotDelete();
472 virtual void cdUP();
473 virtual void slotHome();
474 virtual void slotDoc();
475 virtual void slotNavigate( );
476
477 /* for OLister */
478private:
479
480 /* for OFileView */
481private:
482 void internFileSelected( const QString& );
483 void internFileSelected( const DocLnk& );
484 void internContextMenu();
485 void internChangedDir( const QString& );
486 void internChangedDir( const QDir& ) ;
487
488};
489
490
491#endif
492