-rw-r--r-- | library/applnk.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/library/applnk.h b/library/applnk.h index 18e20b6..9b5523e 100644 --- a/library/applnk.h +++ b/library/applnk.h | |||
@@ -1,172 +1,177 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef __APPLNK_H__ | 20 | #ifndef __APPLNK_H__ |
21 | #define __APPLNK_H__ | 21 | #define __APPLNK_H__ |
22 | 22 | ||
23 | #include <qobject.h> | 23 | #include <qobject.h> |
24 | #include <qiconset.h> | 24 | #include <qiconset.h> |
25 | #include <qlist.h> | 25 | #include <qlist.h> |
26 | #include <qdict.h> | 26 | #include <qdict.h> |
27 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
28 | 28 | ||
29 | class AppLnkSetPrivate; | 29 | class AppLnkSetPrivate; |
30 | class AppLnkPrivate; | 30 | class AppLnkPrivate; |
31 | 31 | ||
32 | class AppLnk | 32 | class AppLnk |
33 | { | 33 | { |
34 | public: | 34 | public: |
35 | AppLnk(); | 35 | AppLnk(); |
36 | AppLnk( const QString &file ); | 36 | AppLnk( const QString &file ); |
37 | AppLnk( const AppLnk © ); // copy constructor | 37 | AppLnk( const AppLnk © ); // copy constructor |
38 | virtual ~AppLnk(); | 38 | virtual ~AppLnk(); |
39 | 39 | ||
40 | bool isValid() const { return !mLinkFile.isNull(); } | 40 | bool isValid() const { return !mLinkFile.isNull(); } |
41 | 41 | ||
42 | static void setSmallIconSize(int); | 42 | static void setSmallIconSize(int); |
43 | static void setBigIconSize(int); | 43 | static void setBigIconSize(int); |
44 | static int smallIconSize(); | 44 | static int smallIconSize(); |
45 | static int bigIconSize(); | 45 | static int bigIconSize(); |
46 | 46 | ||
47 | QString name() const { return mName; } | 47 | QString name() const { return mName; } |
48 | const QPixmap& pixmap() const; | 48 | const QPixmap& pixmap() const; |
49 | const QPixmap& bigPixmap() const; | 49 | const QPixmap& bigPixmap() const; |
50 | virtual QString exec() const { return mExec; } | 50 | virtual QString exec() const { return mExec; } |
51 | QString type() const; | 51 | QString type() const; |
52 | QString rotation() const { return mRotation; } | 52 | QString rotation() const { return mRotation; } |
53 | QString comment() const { return mComment; } | 53 | QString comment() const { return mComment; } |
54 | QString file() const; | 54 | QString file() const; |
55 | QString linkFile() const; | 55 | QString linkFile() const; |
56 | QStringList mimeTypes() const { return mMimeTypes; } | 56 | QStringList mimeTypes() const { return mMimeTypes; } |
57 | QStringList mimeTypeIcons() const { return mMimeTypeIcons; } | 57 | QStringList mimeTypeIcons() const { return mMimeTypeIcons; } |
58 | const QArray<int> &categories() const; | 58 | const QArray<int> &categories() const; |
59 | int id() const { return mId; } | 59 | int id() const { return mId; } |
60 | 60 | ||
61 | bool linkFileKnown() const { return !mLinkFile.isNull(); } | 61 | bool linkFileKnown() const { return !mLinkFile.isNull(); } |
62 | 62 | ||
63 | void execute() const; | 63 | void execute() const; |
64 | void execute(const QStringList& args) const; | 64 | void execute(const QStringList& args) const; |
65 | void removeFiles(); | 65 | void removeFiles(); |
66 | void removeLinkFile(); | 66 | void removeLinkFile(); |
67 | 67 | ||
68 | void setName( const QString& docname ); | 68 | void setName( const QString& docname ); |
69 | void setExec( const QString& exec ); | 69 | void setExec( const QString& exec ); |
70 | void setFile( const QString& filename ); | 70 | void setFile( const QString& filename ); |
71 | void setLinkFile( const QString& filename ); | 71 | void setLinkFile( const QString& filename ); |
72 | void setComment( const QString& comment ); | 72 | void setComment( const QString& comment ); |
73 | void setType( const QString& mimetype ); | 73 | void setType( const QString& mimetype ); |
74 | void setIcon( const QString& iconname ); | 74 | void setIcon( const QString& iconname ); |
75 | void setCategories( const QArray<int> &v ); | 75 | void setCategories( const QArray<int> &v ); |
76 | bool writeLink() const; | 76 | bool writeLink() const; |
77 | 77 | ||
78 | void setProperty(const QString& key, const QString& value); | 78 | void setProperty(const QString& key, const QString& value); |
79 | QString property(const QString& key) const; | 79 | QString property(const QString& key) const; |
80 | 80 | ||
81 | //#ifdef QTOPIA_INTERNAL_PRELOADACCESS | ||
82 | bool isPreloaded() const; | ||
83 | void setPreloaded(bool yesNo); | ||
84 | //#endif | ||
85 | |||
81 | protected: | 86 | protected: |
82 | QString mName; | 87 | QString mName; |
83 | QPixmap mPixmap; | 88 | QPixmap mPixmap; |
84 | QPixmap mBigPixmap; | 89 | QPixmap mBigPixmap; |
85 | QString mExec; | 90 | QString mExec; |
86 | QString mType; | 91 | QString mType; |
87 | QString mRotation; | 92 | QString mRotation; |
88 | QString mComment; | 93 | QString mComment; |
89 | QString mFile; | 94 | QString mFile; |
90 | QString mLinkFile; | 95 | QString mLinkFile; |
91 | QString mIconFile; | 96 | QString mIconFile; |
92 | QStringList mMimeTypes; | 97 | QStringList mMimeTypes; |
93 | QStringList mMimeTypeIcons; | 98 | QStringList mMimeTypeIcons; |
94 | int mId; | 99 | int mId; |
95 | static int lastId; | 100 | static int lastId; |
96 | AppLnkPrivate *d; | 101 | AppLnkPrivate *d; |
97 | friend class AppLnkSet; | 102 | friend class AppLnkSet; |
98 | 103 | ||
99 | virtual void invoke(const QStringList& args) const; | 104 | virtual void invoke(const QStringList& args) const; |
100 | bool ensureLinkExists() const; | 105 | bool ensureLinkExists() const; |
101 | void storeLink() const; | 106 | void storeLink() const; |
102 | }; | 107 | }; |
103 | 108 | ||
104 | class DocLnk : public AppLnk | 109 | class DocLnk : public AppLnk |
105 | { | 110 | { |
106 | public: | 111 | public: |
107 | DocLnk(); | 112 | DocLnk(); |
108 | DocLnk( const DocLnk &o ) : AppLnk(o) { } | 113 | DocLnk( const DocLnk &o ) : AppLnk(o) { } |
109 | DocLnk( const QString &file ); | 114 | DocLnk( const QString &file ); |
110 | DocLnk( const QString &file, bool may_be_desktopfile ); | 115 | DocLnk( const QString &file, bool may_be_desktopfile ); |
111 | virtual ~DocLnk(); | 116 | virtual ~DocLnk(); |
112 | 117 | ||
113 | QString exec() const; | 118 | QString exec() const; |
114 | 119 | ||
115 | protected: | 120 | protected: |
116 | void invoke(const QStringList& args) const; | 121 | void invoke(const QStringList& args) const; |
117 | 122 | ||
118 | private: | 123 | private: |
119 | void init(const QString &file); | 124 | void init(const QString &file); |
120 | }; | 125 | }; |
121 | 126 | ||
122 | class AppLnkSet | 127 | class AppLnkSet |
123 | { | 128 | { |
124 | public: | 129 | public: |
125 | AppLnkSet(); | 130 | AppLnkSet(); |
126 | AppLnkSet( const QString &dir ); | 131 | AppLnkSet( const QString &dir ); |
127 | ~AppLnkSet(); | 132 | ~AppLnkSet(); |
128 | 133 | ||
129 | const AppLnk *find( int id ) const; | 134 | const AppLnk *find( int id ) const; |
130 | const AppLnk *findExec( const QString& execname ) const; | 135 | const AppLnk *findExec( const QString& execname ) const; |
131 | 136 | ||
132 | QStringList types() const { return typs; } | 137 | QStringList types() const { return typs; } |
133 | QString typeName( const QString& ) const; | 138 | QString typeName( const QString& ) const; |
134 | QPixmap typePixmap( const QString& ) const; | 139 | QPixmap typePixmap( const QString& ) const; |
135 | QPixmap typeBigPixmap( const QString& ) const; | 140 | QPixmap typeBigPixmap( const QString& ) const; |
136 | 141 | ||
137 | void add(AppLnk*); | 142 | void add(AppLnk*); |
138 | bool remove(AppLnk*); | 143 | bool remove(AppLnk*); |
139 | 144 | ||
140 | const QList<AppLnk> &children() const { return mApps; } | 145 | const QList<AppLnk> &children() const { return mApps; } |
141 | void detachChildren(); | 146 | void detachChildren(); |
142 | 147 | ||
143 | protected: | 148 | protected: |
144 | friend class AppLnk; | 149 | friend class AppLnk; |
145 | QList<AppLnk> mApps; | 150 | QList<AppLnk> mApps; |
146 | QString mFile; | 151 | QString mFile; |
147 | QStringList typs; | 152 | QStringList typs; |
148 | AppLnkSetPrivate *d; | 153 | AppLnkSetPrivate *d; |
149 | 154 | ||
150 | private: | 155 | private: |
151 | AppLnkSet( const AppLnkSet & ); // no copying! | 156 | AppLnkSet( const AppLnkSet & ); // no copying! |
152 | void findChildren(const QString &, const QString& t, const QString& lt, int depth = 0); | 157 | void findChildren(const QString &, const QString& t, const QString& lt, int depth = 0); |
153 | }; | 158 | }; |
154 | 159 | ||
155 | class DocLnkSet : public AppLnkSet | 160 | class DocLnkSet : public AppLnkSet |
156 | { | 161 | { |
157 | public: | 162 | public: |
158 | DocLnkSet(); | 163 | DocLnkSet(); |
159 | DocLnkSet( const QString &dir, const QString &mimefilter=QString::null ); | 164 | DocLnkSet( const QString &dir, const QString &mimefilter=QString::null ); |
160 | 165 | ||
161 | const QList<DocLnk> &children() const { return (const QList<DocLnk> &)mApps; } | 166 | const QList<DocLnk> &children() const { return (const QList<DocLnk> &)mApps; } |
162 | 167 | ||
163 | void appendFrom( DocLnkSet& other ); | 168 | void appendFrom( DocLnkSet& other ); |
164 | 169 | ||
165 | private: | 170 | private: |
166 | DocLnkSet( const DocLnkSet & ); // no copying! | 171 | DocLnkSet( const DocLnkSet & ); // no copying! |
167 | void findChildren(const QString &dr, const QValueList<QRegExp> &mimeFilters, QDict<void> &reference, int depth=0); | 172 | void findChildren(const QString &dr, const QValueList<QRegExp> &mimeFilters, QDict<void> &reference, int depth=0); |
168 | }; | 173 | }; |
169 | 174 | ||
170 | 175 | ||
171 | #endif // __APPLNK_H__ | 176 | #endif // __APPLNK_H__ |
172 | 177 | ||