summaryrefslogtreecommitdiff
path: root/libslcompat/slfileselector.h
Unidiff
Diffstat (limited to 'libslcompat/slfileselector.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libslcompat/slfileselector.h414
1 files changed, 414 insertions, 0 deletions
diff --git a/libslcompat/slfileselector.h b/libslcompat/slfileselector.h
new file mode 100644
index 0000000..35fd11b
--- a/dev/null
+++ b/libslcompat/slfileselector.h
@@ -0,0 +1,414 @@
1/*
2 * Copyright (C) 2002 SHARP CORPORATION All rights reserved.
3 */
4#ifndef _SLFILESELECTOR_H_INCLUDED
5#define _SLFILESELECTOR_H_INCLUDED
6
7#include <opie2/ofileselector.h>
8using namespace Opie;
9#include <qhbox.h>
10#include <qvbox.h>
11#include <qlistview.h>
12#include <qiconview.h>
13#include <qtoolbutton.h>
14#include <qfileinfo.h>
15#include <qtableview.h>
16#include <qwidgetstack.h>
17#include <qvaluelist.h>
18
19#include <qpe/applnk.h>
20#include <qpe/mimetype.h>
21#include <sl/slmisc.h>
22
23class QComboBox;
24class SlFileItemType;
25class QCopChannel;
26
27struct SlFileListItemPrivate;
28class SlFileListItem
29{
30public:
31 SlFileListItem(const QFileInfo&,const MimeType&);
32 ~SlFileListItem();
33 const QFileInfo &file() const;
34 const MimeType &mimeType() const;
35 const QString getItemIconFilePath() const;
36 const QString name() const;
37 void setName(const QString&);
38 const QString sortKey() const;
39 void setSortKey(const QString&);
40 QPixmap pixmap() const;
41 QPixmap bigPixmap() const;
42 const QString dateString() const;
43 const QString typeString() const;
44 const QString bytesString() const;
45 void setDevice();
46 bool isDevice() const;
47 enum ColumnItem {
48 Name = 1,
49 Type,
50 Date,
51 Bytes,
52 Custom = 100
53 };
54private:
55 SlFileListItemPrivate *p;
56 SlFileListItem(const SlFileListItem&);
57};
58
59typedef QValueList<SlFileListItem*> SlFileList;
60typedef QValueList<SlFileListItem::ColumnItem> SlFileListColumnConf;
61
62class SlFileListViewItem;
63
64struct SlFileListViewPrivate;
65class SlFileListView : public QListView
66{
67 Q_OBJECT
68
69public:
70 SlFileListView(QWidget*, const char*);
71 ~SlFileListView();
72 void createFileList(SlFileList&);
73 int fileCount() const;
74 void updateItem(SlFileListViewItem*);
75 void createItem(SlFileListItem*);
76 void deleteItem(const QString&);
77 void deleteItem(SlFileListViewItem*);
78 SlFileListViewItem* searchItem(const QString&);
79 SlFileListColumnConf columnConf();
80 void setColumnConf(SlFileListColumnConf&);
81 void updateColumn();
82 static const QString columnItemName(SlFileListItem::ColumnItem);
83 static const SlFileListColumnConf columnItemList();
84
85 //virtual void takeItem( SlFileListViewItem * );
86
87 SlMisc::SlListColumnInfos columnWidthInfos();
88
89protected:
90 //void keyPressEvent( QKeyEvent *e );
91
92signals:
93 void keyPressed(QKeyEvent *e,bool &isAccepted);
94
95protected slots:
96
97private:
98 friend class SlFileSelector;
99 SlFileListViewPrivate *p;
100 SlFileListView(const SlFileListView&);
101};
102
103class SlFileIconViewItem;
104
105struct SlFileIconViewPrivate;
106class SlFileIconView : public QIconView
107{
108 Q_OBJECT
109
110public:
111 SlFileIconView(QWidget*, const char*);
112 ~SlFileIconView();
113 void createFileList(SlFileList&);
114 int fileCount() const;
115 void updateItem(SlFileIconViewItem*);
116 void createItem(SlFileListItem*);
117 void deleteItem(const QString&);
118 void deleteItem(SlFileIconViewItem*);
119 SlFileIconViewItem* searchItem(const QString&);
120 void setSorting(int column,bool ascending);
121 int sortColumn() const;
122 void repaintItemsForce();
123 SlFileListColumnConf columnConf();
124 void setColumnConf(SlFileListColumnConf&);
125
126 //virtual void takeItem( SlFileIconViewItem * );
127
128protected:
129 //void keyPressEvent( QKeyEvent *e );
130
131protected slots:
132
133signals:
134 void keyPressed(QKeyEvent *e,bool &isAccepted);
135
136private:
137 friend class SlFileSelector;
138 SlFileIconViewPrivate *p;
139 SlFileIconView(const SlFileIconView&);
140};
141
142class SlFileSelectorFilter : public QObject
143{
144public:
145 SlFileSelectorFilter(QWidget *parent,const char *name=0);
146 ~SlFileSelectorFilter();
147
148 virtual bool isAddToList(QFileInfo&) const = 0;
149private:
150 SlFileSelectorFilter(const SlFileSelectorFilter&);
151};
152
153typedef QList<MimeType> SlFileMimeTypeList;
154
155struct SlFileSelectorPrivate;
156class SlFileSelector : public OFileSelector /*QVBox*/
157{
158 Q_OBJECT
159
160public:
161
162
163 enum SlFileSelectorViewType {
164
165 ListView = 1,
166
167 IconView
168 };
169
170
171 enum SlFileOverwirteMode {
172
173 Overwrite = 1,
174
175 NewName,
176
177 Error
178 };
179 SlFileSelector(const QString &dirPath,
180 const QString &mimefilter,
181 QWidget *parent,
182 const char *name);
183 SlFileSelector(const QString &currentFileName,
184 SlFileSelectorViewType type,
185 const QString &mimeFilter,
186 SlFileListColumnConf &items,
187 int sortColumn,bool sortAscending,
188 SlFileSelectorFilter *filter=NULL,
189 bool isRecursive=FALSE,
190 QWidget *parent=NULL,
191 const char *name=NULL,
192 WFlags f=0);
193 SlFileSelector(QWidget *parent=NULL,const char *name=NULL,WFlags f=0);
194 virtual ~SlFileSelector();
195 void createFileList();
196 void createFileList(QDir&);
197 int fileCount() const;
198 const QFileInfo* selected();
199 void modifyItem(QFileInfo*,bool);
200 void createItem(QString&);
201 void deleteItem(const QString&);
202 void deleteItem();
203 void updateItem(const QString&);
204 SlFileListItem* searchItem(const QString&);
205 void setSelected();
206 void setSelected(const QString&);
207 void ensureItemVisible();
208 SlFileListItem* selectedItem();
209 bool setSelectedNext(bool);
210 bool setSelectedPrev(bool);
211 const QString currentDir();
212 void setSorting(int,bool);
213 int sortColumn() const;
214 bool ascending() const;
215 SlFileSelectorViewType viewType();
216 void setColumnItem(SlFileListColumnConf&);
217 void setViewType(SlFileSelectorViewType);
218 void setListView();
219 void setIconView();
220 int columnWidth(int);
221 void setColumnWidth(int,int);
222 static const QString columnItemName(SlFileListItem::ColumnItem);
223 static const SlFileListColumnConf columnItemList();
224
225 int columns() const;
226
227 bool upDir();
228 bool isTopDir();
229
230 void setCurrentFile(const QString&);
231 const QString currentFile(bool isReal=FALSE);
232 static bool copyFile(const QString&,const QString&,
233 SlFileOverwirteMode m=Error,
234 QString *resultName=NULL);
235
236 static bool copyFileCreateDir(const QString &srcName,
237 const QString &dstName,
238 SlFileOverwirteMode m=Error,
239 QString *resultName=NULL);
240 static bool moveFile(const QString&,const QString&,
241 SlFileOverwirteMode m=Error,
242 QString *resultName=NULL);
243 static QString getCopyFileName(const QString&);
244
245 const QStringList& recent() const;
246 void setRecent(const QStringList&);
247
248
249 void setRecent(const QStringList&,bool isReplace);
250 void setRecentEnabled(bool);
251
252 const QStringList& history() const;
253 void setHistory(const QStringList&);
254
255
256 void setHistory(const QStringList&,bool isReplace);
257 bool isHistoryBackAvailable() const;
258 bool isHistoryForwardAvailable() const;
259 bool historyBack();
260 bool historyForward();
261 QPopupMenu *backHistoryPopupMenu() const;
262 QPopupMenu *forwardHistoryPopupMenu() const;
263 void setColumnConf(SlFileListColumnConf&);
264
265 void sendFileUpdateMessage(const QString&);
266 void updateView();
267 void recreateIcon();
268 void focusToNext();
269 void focusToPrev();
270 bool rename();
271 bool newfolder();
272 bool del();
273 bool duplicate();
274 bool cut();
275 bool copy();
276 bool paste();
277 void setMimeFilter(const QString &);
278 void clearTmpFolder();
279
280 void setRecursive(bool,bool);
281 bool recursive() const;
282 void setFilter(SlFileSelectorFilter *);
283 SlFileSelectorFilter *filter();
284 bool isEnablePaste();
285
286 static bool deleteFile(const QString&);
287 static bool deleteDir(const QDir&);
288 static bool copyDir(const QString &srcName,const QString &dstName,
289 SlFileOverwirteMode m=Error);
290 static bool moveDir(const QString&,const QString&,
291 SlFileOverwirteMode m=Error);
292 static QString getCopyDirName(const QString &);
293 static bool makeDir(const QString &path);
294
295 static uint size(const QString &fName);
296 static uint fileFree(const QString &fName);
297
298
299
300 enum DesktopMode {
301
302 HideDesktop = 1,
303
304 ShowAll,
305
306 FileTab
307 };
308 void setDesktopMode(DesktopMode mode);
309 void setEnabledSystemChannel(bool);
310 void showUpDirBtn(bool);
311 void showWritableFile(bool);
312
313
314 void setEnableSD(bool);
315 void setEnableCF(bool);
316 bool getEnableSD();
317 bool getEnableCF();
318
319
320
321
322 void sendKeyPressEvent( QKeyEvent *e );
323
324 void setScale(int scale);
325 int scale() const;
326
327 SlMisc::SlListColumnInfos columnWidthInfos();
328
329
330
331 enum FocusMode {
332
333 Auto = 1,
334
335 ByTab,
336
337 ByCommand
338 };
339 void setFocusMode(FocusMode mode);
340
341 void adjustContentsSize();
342
343 static void updateFile(const QString &filename);
344
345 bool delFile(const QString &mymsg);
346
347 bool isIncludedFile(const QString &filename);
348
349signals:
350
351
352 void selectionChanged(const QFileInfo &file,bool isDevice);
353
354
355 void fileSelected(const QFileInfo &file);
356
357
358 void dirOpened(const QDir &dir);
359
360
361 void enabledPaste(bool);
362
363
364 void columnWidthChanged(int column,int oldSize,int newSize);
365
366
367 void itemRightPressed(const QFileInfo &file,const QPoint &pos);
368
369
370 void selectionLost();
371
372
373 //void keyPressed(QKeyEvent *e,bool &isAccepted);
374/*
375private slots:
376 void fileClicked(QListViewItem *);
377 void fileClicked(QIconViewItem *);
378 void selectionChanged(QListViewItem *);
379 void selectionChanged(QIconViewItem *);
380 void dMenuChanged(int);
381 void changeDirectory(int,bool isImmediate=TRUE);
382 void hMenuSelected(int);
383 void cardMessage( const QCString &, const QByteArray &);
384 void systemMessage( const QCString &, const QByteArray &);
385 void headerClicked(int);
386 void asyncHMenuSelected();
387 void asyncDMenuChanged();
388 void rightPressed(QIconViewItem *,const QPoint&);
389 void rightPressed(QListViewItem *,const QPoint&,int);
390 void upDirClicked();
391 void slotKeyPressed(QKeyEvent *e,bool &isAccepted);
392*/
393protected:
394 void focusInEvent(QFocusEvent*);
395 void show();
396 void keyPressEvent( QKeyEvent *e );
397
398private:
399 void openDirInside(QDir&);
400 void createMyPda();
401 void init();
402 SlFileSelectorPrivate *p;
403 SlFileSelector(const SlFileSelector&);
404 ulong focusWidgets() const;
405 QWidget* nextFocus(QWidget *,bool) const;
406 bool focusToTheWidget(QWidget *);
407};
408
409#endif
410
411
412
413
414