summaryrefslogtreecommitdiff
path: root/library/applnk.h
authoreilers <eilers>2003-08-08 14:45:49 (UTC)
committer eilers <eilers>2003-08-08 14:45:49 (UTC)
commit14d394e6c107b037a09a31a92605034fe50f7813 (patch) (unidiff)
tree800699cf4dc9681c3eb023340634dd6a15fd04c8 /library/applnk.h
parentdbc6ea35f5535a1f69deb7ebbafc0f721721dbf2 (diff)
downloadopie-14d394e6c107b037a09a31a92605034fe50f7813.zip
opie-14d394e6c107b037a09a31a92605034fe50f7813.tar.gz
opie-14d394e6c107b037a09a31a92605034fe50f7813.tar.bz2
Merged branches from BRANCH_1_0
Diffstat (limited to 'library/applnk.h') (more/less context) (ignore whitespace changes)
-rw-r--r--library/applnk.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/library/applnk.h b/library/applnk.h
index b4590d3..87971f7 100644
--- a/library/applnk.h
+++ b/library/applnk.h
@@ -1,208 +1,206 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the 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
29class AppLnkSetPrivate; 29class AppLnkSetPrivate;
30class AppLnkPrivate; 30class AppLnkPrivate;
31 31
32class AppLnk 32class AppLnk
33{ 33{
34public: 34public:
35 AppLnk(); 35 AppLnk();
36 AppLnk( const QString &file ); 36 AppLnk( const QString &file );
37 AppLnk( const AppLnk &copy ); // copy constructor 37 AppLnk( const AppLnk &copy ); // 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 QString icon() const { return mIconFile; } 50 QString icon() const { return mIconFile; }
51 virtual QString exec() const { return mExec; } 51 virtual QString exec() const { return mExec; }
52 QString type() const; 52 QString type() const;
53 QString rotation() const { return mRotation; } 53 QString rotation() const { return mRotation; }
54 QString comment() const { return mComment; } 54 QString comment() const { return mComment; }
55 QString file() const; 55 QString file() const;
56 QString linkFile() const; 56 QString linkFile() const;
57 QStringList mimeTypes() const { return mMimeTypes; } 57 QStringList mimeTypes() const { return mMimeTypes; }
58 QStringList mimeTypeIcons() const { return mMimeTypeIcons; } 58 QStringList mimeTypeIcons() const { return mMimeTypeIcons; }
59 const QArray<int> &categories() const; 59 const QArray<int> &categories() const;
60 int id() const { return mId; } 60 int id() const { return mId; }
61 61
62 bool fileKnown() const { return !mFile.isNull(); } 62 bool fileKnown() const { return !mFile.isNull(); }
63 bool linkFileKnown() const { return !mLinkFile.isNull(); } 63 bool linkFileKnown() const { return !mLinkFile.isNull(); }
64 64
65 void execute() const; 65 void execute() const;
66 void execute(const QStringList& args) const; 66 void execute(const QStringList& args) const;
67 void removeFiles(); 67 void removeFiles();
68 void removeLinkFile(); 68 void removeLinkFile();
69 69
70 void setName( const QString& docname ); 70 void setName( const QString& docname );
71 void setExec( const QString& exec ); 71 void setExec( const QString& exec );
72 void setFile( const QString& filename ); 72 void setFile( const QString& filename );
73 void setLinkFile( const QString& filename ); 73 void setLinkFile( const QString& filename );
74 void setComment( const QString& comment ); 74 void setComment( const QString& comment );
75 void setType( const QString& mimetype ); 75 void setType( const QString& mimetype );
76 inline void setRotation ( const QString &rot ) { mRotation = rot; } // inline for BC 76 inline void setRotation ( const QString &rot ) { mRotation = rot; } // inline for BC
77 void setIcon( const QString& iconname ); 77 void setIcon( const QString& iconname );
78 void setCategories( const QArray<int> &v ); 78 void setCategories( const QArray<int> &v );
79 bool writeLink() const; 79 bool writeLink() const;
80 80
81 void setProperty(const QString& key, const QString& value); 81 void setProperty(const QString& key, const QString& value);
82 QString property(const QString& key) const; 82 QString property(const QString& key) const;
83 83
84#ifdef QTOPIA_INTERNAL_PRELOADACCESS 84#ifdef QTOPIA_INTERNAL_PRELOADACCESS
85 bool isPreloaded() const; 85 bool isPreloaded() const;
86 void setPreloaded(bool yesNo); 86 void setPreloaded(bool yesNo);
87#endif 87#endif
88 88
89#ifdef QTOPIA_INTERNAL_APPLNKASSIGN
90 AppLnk &operator=(const AppLnk &other); 89 AppLnk &operator=(const AppLnk &other);
91#endif
92 90
93protected: 91protected:
94 QString mName; 92 QString mName;
95 93
96 /* remove for Qtopia 3.0 -zecke */ 94 /* remove for Qtopia 3.0 -zecke */
97 QPixmap mPixmap; 95 QPixmap mPixmap;
98 96
99 /* remove for Qtopia 3.0 -zecke */ 97 /* remove for Qtopia 3.0 -zecke */
100 QPixmap mBigPixmap; 98 QPixmap mBigPixmap;
101 99
102 QString mExec; 100 QString mExec;
103 QString mType; 101 QString mType;
104 QString mRotation; 102 QString mRotation;
105 QString mComment; 103 QString mComment;
106 QString mFile; 104 QString mFile;
107 QString mLinkFile; 105 QString mLinkFile;
108 QString mIconFile; 106 QString mIconFile;
109 QStringList mMimeTypes; 107 QStringList mMimeTypes;
110 QStringList mMimeTypeIcons; 108 QStringList mMimeTypeIcons;
111 int mId; 109 int mId;
112 static int lastId; 110 static int lastId;
113 AppLnkPrivate *d; 111 AppLnkPrivate *d;
114 friend class AppLnkSet; 112 friend class AppLnkSet;
115 113
116 virtual void invoke(const QStringList& args) const; 114 virtual void invoke(const QStringList& args) const;
117 bool ensureLinkExists() const; 115 bool ensureLinkExists() const;
118 void storeLink() const; 116 void storeLink() const;
119 117
120private: 118private:
121 const QPixmap& pixmap(int pos, int size) const; 119 const QPixmap& pixmap(int pos, int size) const;
122}; 120};
123 121
124class DocLnk : public AppLnk 122class DocLnk : public AppLnk
125{ 123{
126public: 124public:
127 DocLnk(); 125 DocLnk();
128 DocLnk( const DocLnk &o ) : AppLnk(o) { } 126 DocLnk( const DocLnk &o ) : AppLnk(o) { }
129 DocLnk( const QString &file ); 127 DocLnk( const QString &file );
130 DocLnk( const QString &file, bool may_be_desktopfile ); 128 DocLnk( const QString &file, bool may_be_desktopfile );
131 virtual ~DocLnk(); 129 virtual ~DocLnk();
132 130
133 131
134#ifdef QTOPIA_INTERNAL_APPLNKASSIGN 132#ifdef QTOPIA_INTERNAL_APPLNKASSIGN
135 DocLnk &operator=(const DocLnk &other) { AppLnk::operator=(other); return *this; } 133 DocLnk &operator=(const DocLnk &other) { AppLnk::operator=(other); return *this; }
136#endif 134#endif
137 135
138 QString exec() const; 136 QString exec() const;
139 137
140protected: 138protected:
141 void invoke(const QStringList& args) const; 139 void invoke(const QStringList& args) const;
142 140
143private: 141private:
144 void init(const QString &file); 142 void init(const QString &file);
145}; 143};
146 144
147class AppLnkSet 145class AppLnkSet
148{ 146{
149public: 147public:
150 AppLnkSet(); 148 AppLnkSet();
151 AppLnkSet( const QString &dir ); 149 AppLnkSet( const QString &dir );
152 ~AppLnkSet(); 150 ~AppLnkSet();
153 151
154 const AppLnk *find( int id ) const; 152 const AppLnk *find( int id ) const;
155 const AppLnk *findExec( const QString& execname ) const; 153 const AppLnk *findExec( const QString& execname ) const;
156 154
157 QStringList types() const { return typs; } 155 QStringList types() const { return typs; }
158 QString typeName( const QString& ) const; 156 QString typeName( const QString& ) const;
159 QPixmap typePixmap( const QString& ) const; 157 QPixmap typePixmap( const QString& ) const;
160 QPixmap typeBigPixmap( const QString& ) const; 158 QPixmap typeBigPixmap( const QString& ) const;
161 159
162 void add(AppLnk*); 160 void add(AppLnk*);
163 bool remove(AppLnk*); 161 bool remove(AppLnk*);
164 void clear() { 162 void clear() {
165 QListIterator<AppLnk> it( mApps ); 163 QListIterator<AppLnk> it( mApps );
166 for ( ; it.current(); ) { 164 for ( ; it.current(); ) {
167 AppLnk* a = *it; 165 AppLnk* a = *it;
168 ++it; 166 ++it;
169 a->mId = 0; 167 a->mId = 0;
170 delete a; 168 delete a;
171 } 169 }
172 mApps.clear(); 170 mApps.clear();
173 typs.clear(); 171 typs.clear();
174 } 172 }
175 173
176 const QList<AppLnk> &children() const { return mApps; } 174 const QList<AppLnk> &children() const { return mApps; }
177 void detachChildren(); 175 void detachChildren();
178 176
179protected: 177protected:
180 friend class AppLnk; 178 friend class AppLnk;
181 QList<AppLnk> mApps; 179 QList<AppLnk> mApps;
182 QString mFile; 180 QString mFile;
183 QStringList typs; 181 QStringList typs;
184 AppLnkSetPrivate *d; 182 AppLnkSetPrivate *d;
185 183
186private: 184private:
187 AppLnkSet( const AppLnkSet & ); // no copying! 185 AppLnkSet( const AppLnkSet & ); // no copying!
188 void findChildren(const QString &, const QString& t, const QString& lt, int depth = 0); 186 void findChildren(const QString &, const QString& t, const QString& lt, int depth = 0);
189}; 187};
190 188
191class DocLnkSet : public AppLnkSet 189class DocLnkSet : public AppLnkSet
192{ 190{
193public: 191public:
194 DocLnkSet(); 192 DocLnkSet();
195 DocLnkSet( const QString &dir, const QString &mimefilter=QString::null ); 193 DocLnkSet( const QString &dir, const QString &mimefilter=QString::null );
196 194
197 const QList<DocLnk> &children() const { return (const QList<DocLnk> &)mApps; } 195 const QList<DocLnk> &children() const { return (const QList<DocLnk> &)mApps; }
198 196
199 void appendFrom( DocLnkSet& other ); 197 void appendFrom( DocLnkSet& other );
200 198
201private: 199private:
202 DocLnkSet( const DocLnkSet & ); // no copying! 200 DocLnkSet( const DocLnkSet & ); // no copying!
203 void findChildren(const QString &dr, const QValueList<QRegExp> &mimeFilters, QDict<void> &reference, int depth=0); 201 void findChildren(const QString &dr, const QValueList<QRegExp> &mimeFilters, QDict<void> &reference, int depth=0);
204}; 202};
205 203
206 204
207#endif // __APPLNK_H__ 205#endif // __APPLNK_H__
208 206