summaryrefslogtreecommitdiff
path: root/libopie/ofileselector.h
authorzecke <zecke>2002-03-30 01:52:05 (UTC)
committer zecke <zecke>2002-03-30 01:52:05 (UTC)
commite49717bf2fa15791c2437a3ac69058ac909f0c6b (patch) (unidiff)
treeb1dc8c0b9a429518f90182f8ab3a2fdbfd760838 /libopie/ofileselector.h
parent06063167a17f44b51295cf13d5c453b61b2c2a66 (diff)
downloadopie-e49717bf2fa15791c2437a3ac69058ac909f0c6b.zip
opie-e49717bf2fa15791c2437a3ac69058ac909f0c6b.tar.gz
opie-e49717bf2fa15791c2437a3ac69058ac909f0c6b.tar.bz2
nightly commits
A improved interface thanks to jowenn and some more implementation Actually I don't understand why it's not yet finished ;)
Diffstat (limited to 'libopie/ofileselector.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.h100
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
@@ -38,7 +38,10 @@
38#include <qstring.h> 38#include <qstring.h>
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
44 * as a dropin replacement of the fileselector and 47 * as a dropin replacement of the fileselector and
@@ -59,27 +62,50 @@ class QWidgetStack;
59class QHBoxLayout; 62class QHBoxLayout;
60class QVBoxLayout; 63class QVBoxLayout;
61class QPopupMenu; 64class QPopupMenu;
62 65class QFileInfo;
63 66//
64class OFileSelectorItem : public QListViewItem { 67class 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 );
70 setText(1, path ); 73 setText(1, path );
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;
77 } 85 }
78 QString path()const{ 86 QString path()const{
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
85class OFileSelector : public QWidget { 111class OFileSelector : public QWidget {
@@ -90,35 +116,61 @@ class OFileSelector : public QWidget {
90 enum View { DIRS = 1, FILES = 2, TREE = 4, ICON = 8 }; 116 enum View { DIRS = 1, FILES = 2, TREE = 4, ICON = 8 };
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 & );
124 void fileSelected( const QString & ); 176 void fileSelected( const QString & );
@@ -164,24 +216,28 @@ class OFileSelector : public QWidget {
164 bool m_shYesNo:1; 216 bool m_shYesNo:1;
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:
169 224
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();
177 void initializeYes(); 232 void initializeYes();
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
187 243