summaryrefslogtreecommitdiff
authorzecke <zecke>2002-03-26 16:14:25 (UTC)
committer zecke <zecke>2002-03-26 16:14:25 (UTC)
commit7c55845eb070ce39eb0673be191130be64e96cfb (patch) (unidiff)
treea4d2778f2e52f2e90dcb20431a2bf8e63e26c449
parent8e658c0aa14db9f8b88eec738827ec640c0be818 (diff)
downloadopie-7c55845eb070ce39eb0673be191130be64e96cfb.zip
opie-7c55845eb070ce39eb0673be191130be64e96cfb.tar.gz
opie-7c55845eb070ce39eb0673be191130be64e96cfb.tar.bz2
- here comes the header of the new opie fileselector
- basicly I'm committing to let other people check if they like the api or not
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.h139
1 files changed, 139 insertions, 0 deletions
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h
new file mode 100644
index 0000000..405a3ce
--- a/dev/null
+++ b/libopie/ofileselector.h
@@ -0,0 +1,139 @@
1/*
2 This is based on code and idea 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 <qwidget.h>
38#include <qstring.h>
39#include <qpixmap.h>
40
41#include <qlistview.h>
42/** This is OPIEs FileDialog Widget. You can use it
43 * as a dropin replacement of the fileselector and
44 * or use any of the new features.
45 * This is also a complete FileSave and FileLoad widget
46 * If you look for a Dialog check OFileDialog
47 *
48 */
49class DocLnk;
50class QCheckBox;
51class QComboBox;
52class QPushButton;
53class FileSelector;
54class QGridLayout;
55
56class OFileSelectorItem : public QListViewItem {
57 public:
58 OFileSelectorItem(const QPixmap &pixmap, const QString &path,
59 const QString &date, const QString &size,
60 bool isDir=false ){
61 setPixmap(0, pixmap );
62 setText(1, path );
63 setText(2, size );
64 setText(3, date );
65 dir = isDir;
66 }
67 bool isDir()const{
68 return dir;
69 }
70 QString path()const{
71 return text(1 );
72 }
73 private:
74 bool dir:1;
75};
76
77class OFileSelector : public QWidget {
78 Q_OBJECT
79 public:
80 enum Mode {OPEN=1, SAVE, FILESELECTOR };
81 enum Selector{NORMAL=1, EXTENDED };
82 OFileSelector(int mode, const QString &dirName, const QString &fileName = Qtring::null, const QStringList mimetypes = QStringList() );
83 bool showToolbar() const;
84 bool showPermissionBar() const;
85 bool showLineEdit()const;
86 bool showChooser( )const;
87 void setShowToolbar( bool show );
88 void setShowPermissionBar( bool show );
89 void setShowLineEdit(bool show) ;
90 void setShowChooser( bool chooser );
91 QCheckBox* permissionCheckbox();
92 bool setPermission() const;
93 void setPermissionChecked( bool check );
94 void setMode( int );
95 int mode()const;
96
97 QString selectedName( );
98 const DocLnk* selectedDocument()const;
99
100 void reparse(); // re reads the dir
101 QString directory();
102 int fileCount();
103
104 signals:
105 void fileSelected( const DocLnk & );
106 void fileSelected( const QString & );
107 void closeMe();
108 void ok();
109 void cancel();
110 protected:
111 void slotOk();
112 void slotCancel();
113
114 int m_mode, m_selector;
115 QComboBox *m_location;
116 QPushButton *m_homeButton, *m_docButton, *m_hideButton, *m_ok, *m_cancel;
117 QPushButton *m_reread, *m_up;
118 QListView *m_View;
119 QString m_currentDir;
120 FileSelector *m_Select;
121 QWidgetStack *m_stack;
122 QGridLayout *m_lay;
123 QHBox *m_toolbar;
124 QHBox *m_ok;
125 bool m_shTool:1;
126 bool m_shPerm:1;
127 bool m_shLne:1;
128 bool m_shChooser:1;
129
130 protected:
131
132 private:
133 class OFileSelectorPrivate;
134 OFileSelectorPrivate *d;
135
136};
137
138
139#endif