-rw-r--r-- | libslcompat/.cvsignore | 6 | ||||
-rw-r--r-- | libslcompat/README | 4 | ||||
-rw-r--r-- | libslcompat/config.in | 4 | ||||
-rw-r--r-- | libslcompat/libslcompat.pro | 16 | ||||
-rw-r--r-- | libslcompat/slcolorselector.cpp | 64 | ||||
-rw-r--r-- | libslcompat/slcolorselector.h | 112 | ||||
-rw-r--r-- | libslcompat/slfiledialog.h | 70 | ||||
-rw-r--r-- | libslcompat/slfileselector.cpp | 86 | ||||
-rw-r--r-- | libslcompat/slfileselector.h | 414 | ||||
-rw-r--r-- | libslcompat/slmisc.h | 135 |
10 files changed, 911 insertions, 0 deletions
diff --git a/libslcompat/.cvsignore b/libslcompat/.cvsignore new file mode 100644 index 0000000..8f7300c --- a/dev/null +++ b/libslcompat/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | Makefile* | ||
2 | moc* | ||
3 | *moc | ||
4 | *.o | ||
5 | ~* | ||
6 | |||
diff --git a/libslcompat/README b/libslcompat/README new file mode 100644 index 0000000..1bed034 --- a/dev/null +++ b/libslcompat/README | |||
@@ -0,0 +1,4 @@ | |||
1 | Skeleton for a compat library for the Sharp closed source libsl. | ||
2 | Early stage and will probably never be useful except for getting | ||
3 | some of the japaneese apps to compile. | ||
4 | Better pester Sharp to open up their sources. | ||
diff --git a/libslcompat/config.in b/libslcompat/config.in new file mode 100644 index 0000000..365d217 --- a/dev/null +++ b/libslcompat/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config LIBSLCOMPAT | ||
2 | boolean "Sharp libsl compatibility library" | ||
3 | default "n" | ||
4 | depends on LIBOPIE2UI | ||
diff --git a/libslcompat/libslcompat.pro b/libslcompat/libslcompat.pro new file mode 100644 index 0000000..84d9ad6 --- a/dev/null +++ b/libslcompat/libslcompat.pro | |||
@@ -0,0 +1,16 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qte warn_on debug | ||
3 | |||
4 | HEADERS = slcolorselector.h \ | ||
5 | slfileselector.h \ | ||
6 | slmisc.h | ||
7 | |||
8 | SOURCES = slcolorselector.cpp \ | ||
9 | slfileselector.cpp | ||
10 | |||
11 | TARGET = slcompat | ||
12 | INCLUDEPATH += $(OPIEDIR)/include | ||
13 | DESTDIR = $(OPIEDIR)/lib | ||
14 | LIBS += -lopiecore2 -lopieui2 -lqtaux2 | ||
15 | |||
16 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/libslcompat/slcolorselector.cpp b/libslcompat/slcolorselector.cpp new file mode 100644 index 0000000..18b408f --- a/dev/null +++ b/libslcompat/slcolorselector.cpp | |||
@@ -0,0 +1,64 @@ | |||
1 | #include "slcolorselector.h" | ||
2 | |||
3 | SlColorTable::SlColorTable( QWidget *parent, const char *name,WFlags f, | ||
4 | int r, int c, const QRgb *a ) | ||
5 | :QTableView( parent, name, f ) | ||
6 | { | ||
7 | } | ||
8 | |||
9 | SlColorTable::~SlColorTable() | ||
10 | { | ||
11 | } | ||
12 | |||
13 | QSize SlColorTable::sizeHint() const | ||
14 | { | ||
15 | } | ||
16 | |||
17 | void SlColorTable::paintCell(QPainter*,int,int) | ||
18 | { | ||
19 | } | ||
20 | |||
21 | void SlColorTable::mousePressEvent(QMouseEvent*) | ||
22 | { | ||
23 | } | ||
24 | |||
25 | void SlColorTable::mouseMoveEvent(QMouseEvent*) | ||
26 | { | ||
27 | } | ||
28 | |||
29 | void SlColorTable::mouseReleaseEvent(QMouseEvent*) | ||
30 | { | ||
31 | } | ||
32 | |||
33 | void SlColorTable::keyPressEvent(QKeyEvent*) | ||
34 | { | ||
35 | } | ||
36 | |||
37 | |||
38 | /*================================================================*/ | ||
39 | |||
40 | SlColorSelector::SlColorSelector(bool isTransparentAccept, QWidget *parent, const char *name, WFlags f) | ||
41 | :QVBox( parent, name, f ) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | SlColorSelector::~SlColorSelector() | ||
46 | { | ||
47 | } | ||
48 | |||
49 | /*================================================================*/ | ||
50 | |||
51 | SlColorSelectorPopup::SlColorSelectorPopup(bool isTransparentAccept, QWidget *parent, const char *name, WFlags f) | ||
52 | :OColorPopupMenu( QColor(), parent, name ) | ||
53 | { | ||
54 | } | ||
55 | |||
56 | |||
57 | SlColorSelectorPopup::~SlColorSelectorPopup() | ||
58 | { | ||
59 | } | ||
60 | |||
61 | void SlColorSelectorPopup::setCurrentColor(QRgb) | ||
62 | { | ||
63 | } | ||
64 | |||
diff --git a/libslcompat/slcolorselector.h b/libslcompat/slcolorselector.h new file mode 100644 index 0000000..e1ee1f2 --- a/dev/null +++ b/libslcompat/slcolorselector.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 SHARP CORPORATION All rights reserved. | ||
3 | */ | ||
4 | #ifndef _SLCOLORSELECTOR_H_INCLUDED | ||
5 | #define _SLCOLORSELECTOR_H_INCLUDED | ||
6 | |||
7 | #include <opie2/ocolorpopupmenu.h> | ||
8 | using namespace Opie; | ||
9 | #include <qtableview.h> | ||
10 | #include <qpopupmenu.h> | ||
11 | #include <qvbox.h> | ||
12 | |||
13 | #define DEF_COLOR_R (6) | ||
14 | #define DEF_COLOR_C (8) | ||
15 | struct SlColorTablePrivate; | ||
16 | class SlColorTable : public QTableView | ||
17 | { | ||
18 | Q_OBJECT | ||
19 | public: | ||
20 | SlColorTable(QWidget *parent=0,const char *name=NULL,WFlags f=0, | ||
21 | int r=DEF_COLOR_R,int c=DEF_COLOR_C,const QRgb *a=NULL); | ||
22 | ~SlColorTable(); | ||
23 | void setCurrentColor(QRgb); | ||
24 | |||
25 | protected: | ||
26 | QSize sizeHint() const; | ||
27 | void paintCell(QPainter*,int,int); | ||
28 | void mousePressEvent(QMouseEvent*); | ||
29 | void mouseMoveEvent(QMouseEvent*); | ||
30 | void mouseReleaseEvent(QMouseEvent*); | ||
31 | void keyPressEvent(QKeyEvent*); | ||
32 | |||
33 | signals: | ||
34 | |||
35 | |||
36 | void selected(QRgb rgb); | ||
37 | |||
38 | |||
39 | void reSelected(QRgb rgb); | ||
40 | |||
41 | private: | ||
42 | SlColorTablePrivate *p; | ||
43 | void setCurrent(int,int); | ||
44 | void setSelected(int,int); | ||
45 | QRgb getRgbInCell(int,int); | ||
46 | }; | ||
47 | |||
48 | |||
49 | struct SlColorSelectorPrivate; | ||
50 | class SlColorSelector : public QVBox | ||
51 | { | ||
52 | Q_OBJECT | ||
53 | public: | ||
54 | SlColorSelector(bool isTransparentAccept, | ||
55 | QWidget *parent=0,const char *name=NULL,WFlags f=0); | ||
56 | ~SlColorSelector(); | ||
57 | void setCurrentColor(QRgb); | ||
58 | void setCurrentColorTransparent(); | ||
59 | |||
60 | signals: | ||
61 | |||
62 | |||
63 | void selected(QRgb rgb); | ||
64 | |||
65 | |||
66 | void reSelected(QRgb rgb); | ||
67 | |||
68 | |||
69 | void transparentSelected(); | ||
70 | |||
71 | |||
72 | void transparentReSelected(); | ||
73 | /* | ||
74 | private slots: | ||
75 | void slotTransparentToggled(int); | ||
76 | */ | ||
77 | private: | ||
78 | SlColorSelectorPrivate *p; | ||
79 | }; | ||
80 | |||
81 | struct SlColorSelectorPopupPrivate; | ||
82 | class SlColorSelectorPopup : public OColorPopupMenu //QPopupMenu | ||
83 | { | ||
84 | Q_OBJECT | ||
85 | public: | ||
86 | SlColorSelectorPopup(bool isTransparentAccept, | ||
87 | QWidget *parent=0,const char *name=NULL,WFlags f=0); | ||
88 | ~SlColorSelectorPopup(); | ||
89 | void setCurrentColor(QRgb); | ||
90 | void setCurrentColorTransparent(); | ||
91 | |||
92 | signals: | ||
93 | |||
94 | |||
95 | void selected(QRgb rgb); | ||
96 | |||
97 | |||
98 | void transparentSelected(); | ||
99 | /* | ||
100 | private slots: | ||
101 | void slotSelected(QRgb); | ||
102 | void slotReSelected(QRgb); | ||
103 | void slotTransparentSelected(); | ||
104 | void slotTransparentReSelected(); | ||
105 | */ | ||
106 | private: | ||
107 | SlColorSelectorPopupPrivate *p; | ||
108 | }; | ||
109 | |||
110 | #endif | ||
111 | |||
112 | |||
diff --git a/libslcompat/slfiledialog.h b/libslcompat/slfiledialog.h new file mode 100644 index 0000000..2ad105c --- a/dev/null +++ b/libslcompat/slfiledialog.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 SHARP CORPORATION All rights reserved. | ||
3 | */ | ||
4 | #ifndef __SLFILEDIALOG_H__ | ||
5 | #define __SLFILEDIALOG_H__ | ||
6 | |||
7 | #include <qdialog.h> | ||
8 | #include <qfileinfo.h> | ||
9 | #include <qvalidator.h> | ||
10 | #include <sl/slmisc.h> | ||
11 | |||
12 | class SlFileNameValidator : public QValidator | ||
13 | { | ||
14 | Q_OBJECT | ||
15 | public: | ||
16 | SlFileNameValidator( QWidget * parent, const char * name = 0 ) : QValidator(parent,name) {}; | ||
17 | virtual State validate(QString&,int&) const; | ||
18 | virtual void fixup(QString&) const; | ||
19 | }; | ||
20 | |||
21 | class SlFileDialogPrivate; | ||
22 | class SlFileDialog : public QDialog | ||
23 | { | ||
24 | Q_OBJECT | ||
25 | public: | ||
26 | |||
27 | |||
28 | SlFileDialog(bool bSaveAs = FALSE, QWidget * parent=0, const char * name=0, bool modal=TRUE, WFlags f=0 ); | ||
29 | |||
30 | |||
31 | virtual ~SlFileDialog(); | ||
32 | |||
33 | |||
34 | void setNewDirEnabled(bool); | ||
35 | |||
36 | |||
37 | void setDefaultFile( QString path ); | ||
38 | void setDefaultName( QString name ); | ||
39 | |||
40 | |||
41 | void setMimeType( QString mime ); | ||
42 | |||
43 | |||
44 | void setComplementExt( QString ext ); | ||
45 | |||
46 | |||
47 | void setIconViewType(bool isIcon); | ||
48 | |||
49 | |||
50 | QString &getFilePath(); | ||
51 | QString &getFileName(); | ||
52 | |||
53 | int exec(); | ||
54 | |||
55 | protected slots: | ||
56 | virtual void accept(); | ||
57 | |||
58 | void fileSelected(const QFileInfo &fInfo); | ||
59 | void slotNewDir(); | ||
60 | void rotateChanged(); | ||
61 | void keyPressed(QKeyEvent*,bool&); | ||
62 | |||
63 | protected: | ||
64 | void getDefaultColumnWidth(SlMisc::SlListColumnInfos &infos); | ||
65 | |||
66 | SlFileDialogPrivate *m_pD; | ||
67 | |||
68 | }; | ||
69 | |||
70 | #endif | ||
diff --git a/libslcompat/slfileselector.cpp b/libslcompat/slfileselector.cpp new file mode 100644 index 0000000..3189b51 --- a/dev/null +++ b/libslcompat/slfileselector.cpp | |||
@@ -0,0 +1,86 @@ | |||
1 | #include "slfileselector.h" | ||
2 | |||
3 | SlFileIconView::SlFileIconView( QWidget* parent, const char* name ) | ||
4 | :QIconView( parent, name ) | ||
5 | { | ||
6 | } | ||
7 | |||
8 | SlFileIconView::~SlFileIconView() | ||
9 | { | ||
10 | } | ||
11 | |||
12 | /*================================================================*/ | ||
13 | |||
14 | SlFileListView::SlFileListView( QWidget* parent, const char* name ) | ||
15 | :QListView( parent, name ) | ||
16 | { | ||
17 | } | ||
18 | |||
19 | SlFileListView::~SlFileListView() | ||
20 | { | ||
21 | } | ||
22 | |||
23 | /*================================================================*/ | ||
24 | |||
25 | SlFileSelector::SlFileSelector( const QString &dirPath, const QString &mimefilter, QWidget *parent, const char *name ) | ||
26 | :OFileSelector( dirPath, parent, name ) | ||
27 | { | ||
28 | } | ||
29 | |||
30 | SlFileSelector::~SlFileSelector() | ||
31 | { | ||
32 | } | ||
33 | |||
34 | bool SlFileSelector::isTopDir() | ||
35 | { | ||
36 | return false; | ||
37 | } | ||
38 | |||
39 | void SlFileSelector::setSelected() | ||
40 | { | ||
41 | } | ||
42 | |||
43 | void SlFileSelector::setSelected(const QString&) | ||
44 | { | ||
45 | int a; | ||
46 | } | ||
47 | |||
48 | void SlFileSelector::createFileList() | ||
49 | { | ||
50 | int a; | ||
51 | } | ||
52 | |||
53 | void SlFileSelector::createFileList(QDir&) | ||
54 | { | ||
55 | int a; | ||
56 | } | ||
57 | |||
58 | const QFileInfo* SlFileSelector::selected() | ||
59 | { | ||
60 | int a; | ||
61 | } | ||
62 | |||
63 | void SlFileSelector::setCurrentFile(const QString&) | ||
64 | { | ||
65 | int a; | ||
66 | } | ||
67 | |||
68 | const QString SlFileSelector::currentDir() | ||
69 | { | ||
70 | int a; | ||
71 | } | ||
72 | |||
73 | |||
74 | void SlFileSelector::focusInEvent(QFocusEvent*) | ||
75 | { | ||
76 | } | ||
77 | |||
78 | void SlFileSelector::show() | ||
79 | { | ||
80 | } | ||
81 | |||
82 | void SlFileSelector::keyPressEvent( QKeyEvent *e ) | ||
83 | { | ||
84 | } | ||
85 | |||
86 | |||
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> | ||
8 | using 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 | |||
23 | class QComboBox; | ||
24 | class SlFileItemType; | ||
25 | class QCopChannel; | ||
26 | |||
27 | struct SlFileListItemPrivate; | ||
28 | class SlFileListItem | ||
29 | { | ||
30 | public: | ||
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 | }; | ||
54 | private: | ||
55 | SlFileListItemPrivate *p; | ||
56 | SlFileListItem(const SlFileListItem&); | ||
57 | }; | ||
58 | |||
59 | typedef QValueList<SlFileListItem*> SlFileList; | ||
60 | typedef QValueList<SlFileListItem::ColumnItem> SlFileListColumnConf; | ||
61 | |||
62 | class SlFileListViewItem; | ||
63 | |||
64 | struct SlFileListViewPrivate; | ||
65 | class SlFileListView : public QListView | ||
66 | { | ||
67 | Q_OBJECT | ||
68 | |||
69 | public: | ||
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 | |||
89 | protected: | ||
90 | //void keyPressEvent( QKeyEvent *e ); | ||
91 | |||
92 | signals: | ||
93 | void keyPressed(QKeyEvent *e,bool &isAccepted); | ||
94 | |||
95 | protected slots: | ||
96 | |||
97 | private: | ||
98 | friend class SlFileSelector; | ||
99 | SlFileListViewPrivate *p; | ||
100 | SlFileListView(const SlFileListView&); | ||
101 | }; | ||
102 | |||
103 | class SlFileIconViewItem; | ||
104 | |||
105 | struct SlFileIconViewPrivate; | ||
106 | class SlFileIconView : public QIconView | ||
107 | { | ||
108 | Q_OBJECT | ||
109 | |||
110 | public: | ||
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 | |||
128 | protected: | ||
129 | //void keyPressEvent( QKeyEvent *e ); | ||
130 | |||
131 | protected slots: | ||
132 | |||
133 | signals: | ||
134 | void keyPressed(QKeyEvent *e,bool &isAccepted); | ||
135 | |||
136 | private: | ||
137 | friend class SlFileSelector; | ||
138 | SlFileIconViewPrivate *p; | ||
139 | SlFileIconView(const SlFileIconView&); | ||
140 | }; | ||
141 | |||
142 | class SlFileSelectorFilter : public QObject | ||
143 | { | ||
144 | public: | ||
145 | SlFileSelectorFilter(QWidget *parent,const char *name=0); | ||
146 | ~SlFileSelectorFilter(); | ||
147 | |||
148 | virtual bool isAddToList(QFileInfo&) const = 0; | ||
149 | private: | ||
150 | SlFileSelectorFilter(const SlFileSelectorFilter&); | ||
151 | }; | ||
152 | |||
153 | typedef QList<MimeType> SlFileMimeTypeList; | ||
154 | |||
155 | struct SlFileSelectorPrivate; | ||
156 | class SlFileSelector : public OFileSelector /*QVBox*/ | ||
157 | { | ||
158 | Q_OBJECT | ||
159 | |||
160 | public: | ||
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 ¤tFileName, | ||
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 | |||
349 | signals: | ||
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 | /* | ||
375 | private 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 | */ | ||
393 | protected: | ||
394 | void focusInEvent(QFocusEvent*); | ||
395 | void show(); | ||
396 | void keyPressEvent( QKeyEvent *e ); | ||
397 | |||
398 | private: | ||
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 | |||
diff --git a/libslcompat/slmisc.h b/libslcompat/slmisc.h new file mode 100644 index 0000000..20ba988 --- a/dev/null +++ b/libslcompat/slmisc.h | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 SHARP CORPORATION All rights reserved. | ||
3 | */ | ||
4 | #ifndef _SLMISC_H_INCLUDED | ||
5 | #define _SLMISC_H_INCLUDED | ||
6 | |||
7 | #include <qpe/qpeapplication.h> | ||
8 | #include <qfileinfo.h> | ||
9 | #include <qpe/global.h> | ||
10 | #include <qmessagebox.h> | ||
11 | |||
12 | |||
13 | #define _SLPOWER | ||
14 | |||
15 | class QPopupMenu; | ||
16 | class QListView; | ||
17 | #if !defined(_SLPOWER) | ||
18 | class PowerStatus; | ||
19 | #else | ||
20 | class SlPowerStatus; | ||
21 | #endif | ||
22 | class Config; | ||
23 | |||
24 | typedef ulong SlResolutionScale; | ||
25 | |||
26 | class SlMisc { | ||
27 | public: | ||
28 | static bool isExecutable(const QString &c) { | ||
29 | QFileInfo exec(QPEApplication::qpeDir() + "/bin/" + c); | ||
30 | return exec.isExecutable(); | ||
31 | }; | ||
32 | static ulong availableMemory(); | ||
33 | static bool invalidFileName(QString &fName); | ||
34 | static QString getValidFileName(const QString &baseName); | ||
35 | static QString getCanonicalPath(const QString &fName); | ||
36 | static void enableAutoPowerOff(bool isOn); | ||
37 | static void enableAutoPowerOff(bool isOn,bool DimAlso,bool ScreenSaverAlso=FALSE); | ||
38 | static void enableLockApplication(bool); | ||
39 | static bool isTheSmbShareFileHasWriteEntry(const QString &shareFName); | ||
40 | static bool isTheSmbShareFileNowCopy(const QString &shareFName); | ||
41 | static bool checkTheSmbShareFileMode(const QString &shareFName, | ||
42 | char modeMask, char checkMode, bool equality); | ||
43 | static bool isTheFileLockedBySmbd(const QString &fName); | ||
44 | static bool isSambaForked(); | ||
45 | static void startSamba(); | ||
46 | static void stopSamba(); | ||
47 | enum ListType { Pid, CmdLine, Both }; | ||
48 | static QStringList procList (const QRegExp& re, uint max = 0, enum ListType type = Pid); | ||
49 | static void dumpMemInfo(bool isShowHeap); | ||
50 | static bool canCreateTheFile(const QString&); | ||
51 | static QString getLanguage(); | ||
52 | static QSize getMaximizedWidgetInfo(); | ||
53 | static QSize SlMisc::getScrollbarMetrics(); | ||
54 | static int getDpi(); | ||
55 | static SlResolutionScale getResolutionScale(); | ||
56 | static int getMaximizedWidgetContentsWidth(); | ||
57 | static bool isLandscape(); | ||
58 | static void requestCloseFile(const QString&); | ||
59 | static void requestOpenFile(const QString&); | ||
60 | |||
61 | static void insertStandardFontMenu(QPopupMenu *pm); | ||
62 | static void insertAllFontMenu(QPopupMenu *pm); | ||
63 | static int getLogicalSizeFromMenuId(int id); | ||
64 | static void setFontSizeItemChecked(QPopupMenu *pm,int logicalSize); | ||
65 | static int getFontPointSize(int logicalSize); | ||
66 | static void toggleFontSize(QPopupMenu *pm,int &logicalSize,bool isLarge=true); | ||
67 | static void toggleAllFontSize(QPopupMenu *pm,int *fontSize,bool isLarge=true); | ||
68 | |||
69 | static void SlFontArrange (QWidget* widget); | ||
70 | static void SlLayoutSpaceArrange (QObject* object); | ||
71 | |||
72 | static bool checkBatteryError(const QString &module_name, bool force); | ||
73 | static bool checkBatteryErrorWithoutDialog(const QString &module_name, bool force); | ||
74 | |||
75 | |||
76 | enum InputDeviceType { | ||
77 | BuiltinKeyboard = 1, | ||
78 | SoftwareKeyboard = 2 | ||
79 | }; | ||
80 | static InputDeviceType defaultInputDevice(); | ||
81 | |||
82 | |||
83 | typedef struct SlListColumnInfo { | ||
84 | enum Type { | ||
85 | Fixed = 0, | ||
86 | StringLen, | ||
87 | Scale, | ||
88 | FixedDpiAware | ||
89 | }; | ||
90 | Type type; | ||
91 | QString str; | ||
92 | int val; | ||
93 | }; | ||
94 | typedef QValueList<SlListColumnInfo> SlListColumnInfos; | ||
95 | |||
96 | static void setListColumnsWidth(QWidget *w,SlListColumnInfos &infos, | ||
97 | Config &config); | ||
98 | static void writeListColumnsWidth(QWidget *w,SlListColumnInfos &infos, | ||
99 | Config &config); | ||
100 | static void writeListColumnsWidth(QWidget *w,SlListColumnInfos &infos, | ||
101 | Config &config,bool isLandscape); | ||
102 | static void rotateListColumnsWidth(QWidget *w,SlListColumnInfos &infos, | ||
103 | Config &config); | ||
104 | static void setListColumnsWidth(QWidget *w,SlListColumnInfos &infos, Config *config=NULL); | ||
105 | static void writeListColumnsWidth(QWidget *w,SlListColumnInfos &infos, Config *config=NULL); | ||
106 | static void writeListColumnsWidth(QWidget *w,SlListColumnInfos &infos, bool isLandscape, Config *config=NULL); | ||
107 | static void rotateListColumnsWidth(QWidget *w,SlListColumnInfos &infos, Config *config=NULL); | ||
108 | static void temporaryMessageBox(const QString &caption, const QString &text, int msec=10000, QMessageBox::Icon icon=QMessageBox::NoIcon, int button0=0, int button1=0, int button2=0, QWidget *parent=0, const char *name=0, QWidget::WFlags f=QWidget::WStyle_DialogBorder); | ||
109 | |||
110 | static QString defaultWallPaper(); | ||
111 | typedef enum AppCommand { | ||
112 | NoneCommand = 0, | ||
113 | NewCommand, | ||
114 | ModifyCommand, | ||
115 | DeleteCommand, | ||
116 | ZoomInCommand, | ||
117 | ZoomOutCommand, | ||
118 | CutCommand = 50, | ||
119 | CopyCommand, | ||
120 | PasteCommand | ||
121 | }; | ||
122 | static AppCommand appCommandFromKey(const QKeyEvent &e); | ||
123 | |||
124 | typedef enum RequiredSize { | ||
125 | SmallSize = 0, | ||
126 | LargeSize | ||
127 | }; | ||
128 | static const char* getTmpPath(RequiredSize); | ||
129 | static const char* getTmpPath(ulong); | ||
130 | static QString getObexTmpPath(); | ||
131 | static ulong availableInternalStorage(void); | ||
132 | static QString moduleNameFromPath(const QString &path); | ||
133 | }; | ||
134 | |||
135 | #endif | ||