-rw-r--r-- | libopie/libopie.pro | 2 | ||||
-rw-r--r-- | libopie/ofileselector.cc | 1 | ||||
-rw-r--r-- | libopie/ofileview.h | 79 |
3 files changed, 81 insertions, 1 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro index b2ecd07..ba64bda 100644 --- a/libopie/libopie.pro +++ b/libopie/libopie.pro | |||
@@ -1,8 +1,8 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qte warn_on release | 2 | CONFIG += qte warn_on release |
3 | HEADERS = ofontmenu.h ofileselector.h ofiledialog.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h colordialog.h colorpopupmenu.h | 3 | HEADERS = ofontmenu.h ofileselector.h ofiledialog.h ofileview.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h colordialog.h colorpopupmenu.h |
4 | SOURCES = ofontmenu.cc ofileselector.cc ofiledialog.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp colordialog.cpp colorpopupmenu.cpp | 4 | SOURCES = ofontmenu.cc ofileselector.cc ofiledialog.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp colordialog.cpp colorpopupmenu.cpp |
5 | TARGET = opie | 5 | TARGET = opie |
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DESTDIR = $(QTDIR)/lib$(PROJMAK) | 7 | DESTDIR = $(QTDIR)/lib$(PROJMAK) |
8 | #VERSION = 1.0.0 | 8 | #VERSION = 1.0.0 |
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index 0a6e595..0e508af 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc | |||
@@ -1,156 +1,157 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 3 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <qnamespace.h> | 29 | #include <qnamespace.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | #include <qcombobox.h> | 31 | #include <qcombobox.h> |
32 | #include <qhbox.h> | 32 | #include <qhbox.h> |
33 | #include <qvbox.h> | 33 | #include <qvbox.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qwidgetstack.h> | 35 | #include <qwidgetstack.h> |
36 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
37 | #include <qcheckbox.h> | 37 | #include <qcheckbox.h> |
38 | #include <qlabel.h> | 38 | #include <qlabel.h> |
39 | #include <qheader.h> | 39 | #include <qheader.h> |
40 | #include <qdir.h> | 40 | #include <qdir.h> |
41 | #include <qpainter.h> | 41 | #include <qpainter.h> |
42 | #include <qaction.h> | 42 | #include <qaction.h> |
43 | #include <qpopupmenu.h> | 43 | #include <qpopupmenu.h> |
44 | #include <qcursor.h> | 44 | #include <qcursor.h> |
45 | #include <qstringlist.h> | 45 | #include <qstringlist.h> |
46 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
47 | 47 | ||
48 | #include <qpe/qpeapplication.h> | 48 | #include <qpe/qpeapplication.h> |
49 | #include <qpe/fileselector.h> | 49 | #include <qpe/fileselector.h> |
50 | #include <qpe/applnk.h> | 50 | #include <qpe/applnk.h> |
51 | #include <qpe/global.h> | 51 | #include <qpe/global.h> |
52 | #include <qpe/mimetype.h> | 52 | #include <qpe/mimetype.h> |
53 | #include <qpe/resource.h> | 53 | #include <qpe/resource.h> |
54 | #include <qpe/storage.h> | 54 | #include <qpe/storage.h> |
55 | 55 | ||
56 | #include <unistd.h> | 56 | #include <unistd.h> |
57 | #include <stdlib.h> | 57 | #include <stdlib.h> |
58 | #include <sys/stat.h> | 58 | #include <sys/stat.h> |
59 | 59 | ||
60 | #include "ofileselector.h" | 60 | #include "ofileselector.h" |
61 | //#include "ofileview.h" | ||
61 | 62 | ||
62 | QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; | 63 | QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; |
63 | 64 | ||
64 | namespace { | 65 | namespace { |
65 | 66 | ||
66 | int indexByString( const QComboBox *box, const QString &str ){ | 67 | int indexByString( const QComboBox *box, const QString &str ){ |
67 | int index= -1; | 68 | int index= -1; |
68 | for(int i= 0; i < box->count(); i++ ){ | 69 | for(int i= 0; i < box->count(); i++ ){ |
69 | if( str == box->text(i ) ){ | 70 | if( str == box->text(i ) ){ |
70 | index= i; | 71 | index= i; |
71 | break; | 72 | break; |
72 | } | 73 | } |
73 | } | 74 | } |
74 | return index; | 75 | return index; |
75 | } | 76 | } |
76 | class OFileSelectorItem : public QListViewItem { | 77 | class OFileSelectorItem : public QListViewItem { |
77 | public: | 78 | public: |
78 | OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, | 79 | OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, |
79 | const QString &date, const QString &size, const QString &mDir, | 80 | const QString &date, const QString &size, const QString &mDir, |
80 | bool isLocked=false, bool isDir=false ): QListViewItem(view) { | 81 | bool isLocked=false, bool isDir=false ): QListViewItem(view) { |
81 | setPixmap(0, pixmap ); | 82 | setPixmap(0, pixmap ); |
82 | setText(1, path ); | 83 | setText(1, path ); |
83 | setText(2, size ); | 84 | setText(2, size ); |
84 | setText(3, date ); | 85 | setText(3, date ); |
85 | //setText(4, mDir ); | 86 | //setText(4, mDir ); |
86 | m_dir = mDir; | 87 | m_dir = mDir; |
87 | dir = isDir; | 88 | dir = isDir; |
88 | mLocked = isLocked; | 89 | mLocked = isLocked; |
89 | } | 90 | } |
90 | bool isLocked() const{ | 91 | bool isLocked() const{ |
91 | return mLocked; | 92 | return mLocked; |
92 | } | 93 | } |
93 | QString directory()const{ | 94 | QString directory()const{ |
94 | return m_dir; | 95 | return m_dir; |
95 | } | 96 | } |
96 | bool isDir()const{ | 97 | bool isDir()const{ |
97 | return dir; | 98 | return dir; |
98 | } | 99 | } |
99 | QString path()const{ | 100 | QString path()const{ |
100 | return text(1 ); | 101 | return text(1 ); |
101 | } | 102 | } |
102 | QString key(int id, bool )const { | 103 | QString key(int id, bool )const { |
103 | QString ke; | 104 | QString ke; |
104 | if( id == 0 || id == 1 ){ // name | 105 | if( id == 0 || id == 1 ){ // name |
105 | if( dir ){ | 106 | if( dir ){ |
106 | ke.append("0" ); | 107 | ke.append("0" ); |
107 | ke.append( text(1) ); | 108 | ke.append( text(1) ); |
108 | }else{ | 109 | }else{ |
109 | ke.append("1" ); | 110 | ke.append("1" ); |
110 | ke.append( text(1) ); | 111 | ke.append( text(1) ); |
111 | } | 112 | } |
112 | }else if( id == 2 ){ // size | 113 | }else if( id == 2 ){ // size |
113 | return text(2); | 114 | return text(2); |
114 | }else if( id == 3 ){ // date | 115 | }else if( id == 3 ){ // date |
115 | return text(3); | 116 | return text(3); |
116 | } | 117 | } |
117 | return ke; | 118 | return ke; |
118 | }; | 119 | }; |
119 | private: | 120 | private: |
120 | bool mLocked:1; | 121 | bool mLocked:1; |
121 | bool dir:1; | 122 | bool dir:1; |
122 | QString m_dir; | 123 | QString m_dir; |
123 | }; | 124 | }; |
124 | }; | 125 | }; |
125 | 126 | ||
126 | 127 | ||
127 | OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, | 128 | OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, |
128 | const QString &fileName, const QStringList &mimetypes ) : QWidget( wid ) | 129 | const QString &fileName, const QStringList &mimetypes ) : QWidget( wid ) |
129 | { | 130 | { |
130 | if(wid!=0) | 131 | if(wid!=0) |
131 | resize(wid->width(),wid->height()); | 132 | resize(wid->width(),wid->height()); |
132 | m_selector = selector; | 133 | m_selector = selector; |
133 | m_currentDir = dirName; | 134 | m_currentDir = dirName; |
134 | m_name = fileName; | 135 | m_name = fileName; |
135 | m_mimetypes = mimetypes; | 136 | m_mimetypes = mimetypes; |
136 | 137 | ||
137 | if( mimetypes.isEmpty() ) | 138 | if( mimetypes.isEmpty() ) |
138 | m_autoMime = true; | 139 | m_autoMime = true; |
139 | 140 | ||
140 | qWarning("OFileSelector mimetypes %s", mimetypes.join(" ").latin1() ); | 141 | qWarning("OFileSelector mimetypes %s", mimetypes.join(" ").latin1() ); |
141 | m_mode = mode; | 142 | m_mode = mode; |
142 | m_shTool = true; | 143 | m_shTool = true; |
143 | m_shPerm = true; | 144 | m_shPerm = true; |
144 | m_shLne = true; | 145 | m_shLne = true; |
145 | m_shChooser = true; | 146 | m_shChooser = true; |
146 | m_shYesNo = true; | 147 | m_shYesNo = true; |
147 | 148 | ||
148 | // for FILESELECTOR only view is interesting | 149 | // for FILESELECTOR only view is interesting |
149 | m_location = 0; | 150 | m_location = 0; |
150 | m_homeButton = 0; | 151 | m_homeButton = 0; |
151 | m_docButton = 0; | 152 | m_docButton = 0; |
152 | m_hideButton = 0; | 153 | m_hideButton = 0; |
153 | m_ok = 0; | 154 | m_ok = 0; |
154 | m_cancel = 0; | 155 | m_cancel = 0; |
155 | m_reread = 0; | 156 | m_reread = 0; |
156 | m_up = 0; | 157 | m_up = 0; |
diff --git a/libopie/ofileview.h b/libopie/ofileview.h new file mode 100644 index 0000000..48a71ca --- a/dev/null +++ b/libopie/ofileview.h | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This library is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This library is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = Library General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #ifndef ofileview_h | ||
30 | #define ofileview_h | ||
31 | |||
32 | #include <qobject.h> | ||
33 | #include <qwidget.h> | ||
34 | |||
35 | class QFileInfo; | ||
36 | class QDir; | ||
37 | class DocLnk; | ||
38 | class OFileSelectorView : public QWidget { | ||
39 | Q_OBJECT | ||
40 | public: | ||
41 | OFileSelectorView(QWidget *widget, | ||
42 | const char *name ) | ||
43 | : QWidget(widget, name ) | ||
44 | { }; | ||
45 | virtual ~OFileSelectorView(); | ||
46 | |||
47 | virtual void addFile(const QString &mine, | ||
48 | QFileInfo *info, | ||
49 | bool isSymlink = FALSE ) = 0; | ||
50 | |||
51 | virtual void addDir (const QString &mine, | ||
52 | QFileInfo *info, | ||
53 | bool isSymlink = FALSE ) = 0; | ||
54 | |||
55 | virtual void addSymlink(const QString &mime, | ||
56 | QFileInfo *info, | ||
57 | bool isSymlink = FALSE ) = 0; | ||
58 | |||
59 | virtual void cd(const QString &path ); | ||
60 | signals: | ||
61 | void fileSelected(const QString &); | ||
62 | void fileSelected(const DocLnk & ); | ||
63 | void contextMenu(); | ||
64 | void changedDir(const QString &); | ||
65 | void changedDir(const QDir & ); | ||
66 | }; | ||
67 | |||
68 | class OFileViewFactory { | ||
69 | // Q_OBJECT | ||
70 | public: | ||
71 | OFileViewFactory() {} ; | ||
72 | virtual ~OFileViewFactory(); | ||
73 | |||
74 | OFileSelectorView* newView(QWidget *parent, const char *name ); | ||
75 | QString name()const; | ||
76 | }; | ||
77 | |||
78 | |||
79 | #endif | ||