summaryrefslogtreecommitdiff
path: root/library/applnk.h
authorsandman <sandman>2002-10-06 03:26:59 (UTC)
committer sandman <sandman>2002-10-06 03:26:59 (UTC)
commita1ebad08d462e682554d39a9beabce125a374452 (patch) (side-by-side diff)
tree254d7ddc5b257b278172af4952b2bec27b5df3b5 /library/applnk.h
parent2c16c8767fa5c16c0eeebc7008202a68a61a5308 (diff)
downloadopie-a1ebad08d462e682554d39a9beabce125a374452.zip
opie-a1ebad08d462e682554d39a9beabce125a374452.tar.gz
opie-a1ebad08d462e682554d39a9beabce125a374452.tar.bz2
- support "Rotation" setting in .desktop applnk file
- changed properties dialog to make Rotation editable - fixed a long-standing QPE bug: launcher expects AppLnk::file() to return QString::null for *all real* applnks (as opposed to doclnks) -- but AppLnk itself initializes this field to the name of the dir, where the applnk is stored. This is why qcop "QPE/System" "linkChanged(QString)" xyz.desktop cleared a whole launcher tab I hope I didn't break anything with this change ;)
Diffstat (limited to 'library/applnk.h') (more/less context) (ignore whitespace changes)
-rw-r--r--library/applnk.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/applnk.h b/library/applnk.h
index 71b62ef..b92ddba 100644
--- a/library/applnk.h
+++ b/library/applnk.h
@@ -1,171 +1,172 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef __APPLNK_H__
#define __APPLNK_H__
#include <qobject.h>
#include <qiconset.h>
#include <qlist.h>
#include <qdict.h>
#include <qstringlist.h>
class AppLnkSetPrivate;
class AppLnkPrivate;
class AppLnk
{
public:
AppLnk();
AppLnk( const QString &file );
AppLnk( const AppLnk &copy ); // copy constructor
virtual ~AppLnk();
bool isValid() const { return !mLinkFile.isNull(); }
static void setSmallIconSize(int);
static void setBigIconSize(int);
static int smallIconSize();
static int bigIconSize();
QString name() const { return mName; }
const QPixmap& pixmap() const;
const QPixmap& bigPixmap() const;
QString icon() const { return mIconFile; }
virtual QString exec() const { return mExec; }
QString type() const;
QString rotation() const { return mRotation; }
QString comment() const { return mComment; }
QString file() const;
QString linkFile() const;
QStringList mimeTypes() const { return mMimeTypes; }
QStringList mimeTypeIcons() const { return mMimeTypeIcons; }
const QArray<int> &categories() const;
int id() const { return mId; }
bool fileKnown() const { return !mFile.isNull(); }
bool linkFileKnown() const { return !mLinkFile.isNull(); }
void execute() const;
void execute(const QStringList& args) const;
void removeFiles();
void removeLinkFile();
void setName( const QString& docname );
void setExec( const QString& exec );
void setFile( const QString& filename );
void setLinkFile( const QString& filename );
void setComment( const QString& comment );
void setType( const QString& mimetype );
+ inline void setRotation ( const QString &rotation ) { mRotation = rot; } // inline for BC
void setIcon( const QString& iconname );
void setCategories( const QArray<int> &v );
bool writeLink() const;
void setProperty(const QString& key, const QString& value);
QString property(const QString& key) const;
#ifdef QTOPIA_INTERNAL_PRELOADACCESS
bool isPreloaded() const;
void setPreloaded(bool yesNo);
#endif
#ifdef QTOPIA_INTERNAL_APPLNKASSIGN
AppLnk &operator=(const AppLnk &other);
#endif
protected:
QString mName;
/* remove for Qtopia 3.0 -zecke */
QPixmap mPixmap;
/* remove for Qtopia 3.0 -zecke */
QPixmap mBigPixmap;
QString mExec;
QString mType;
QString mRotation;
QString mComment;
QString mFile;
QString mLinkFile;
QString mIconFile;
QStringList mMimeTypes;
QStringList mMimeTypeIcons;
int mId;
static int lastId;
AppLnkPrivate *d;
friend class AppLnkSet;
virtual void invoke(const QStringList& args) const;
bool ensureLinkExists() const;
void storeLink() const;
private:
const QPixmap& pixmap(int pos, int size) const;
};
class DocLnk : public AppLnk
{
public:
DocLnk();
DocLnk( const DocLnk &o ) : AppLnk(o) { }
DocLnk( const QString &file );
DocLnk( const QString &file, bool may_be_desktopfile );
virtual ~DocLnk();
#ifdef QTOPIA_INTERNAL_APPLNKASSIGN
DocLnk &operator=(const DocLnk &other) { AppLnk::operator=(other); return *this; }
#endif
QString exec() const;
protected:
void invoke(const QStringList& args) const;
private:
void init(const QString &file);
};
class AppLnkSet
{
public:
AppLnkSet();
AppLnkSet( const QString &dir );
~AppLnkSet();
const AppLnk *find( int id ) const;
const AppLnk *findExec( const QString& execname ) const;
QStringList types() const { return typs; }
QString typeName( const QString& ) const;
QPixmap typePixmap( const QString& ) const;
QPixmap typeBigPixmap( const QString& ) const;
void add(AppLnk*);
bool remove(AppLnk*);
void clear() {
QListIterator<AppLnk> it( mApps );
for ( ; it.current(); ) {
AppLnk* a = *it;
++it;
a->mId = 0;
delete a;
}
mApps.clear();