author | zecke <zecke> | 2002-09-10 14:21:14 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-10 14:21:14 (UTC) |
commit | 8b59b498892b0e345d977ccd520087b660a91437 (patch) (side-by-side diff) | |
tree | 4b9fef30cc51cce8e50c072038d15d8e10b29fb2 | |
parent | 4aad041a733e2478ff29330e1544e5fefcfb5cde (diff) | |
download | opie-8b59b498892b0e345d977ccd520087b660a91437.zip opie-8b59b498892b0e345d977ccd520087b660a91437.tar.gz opie-8b59b498892b0e345d977ccd520087b660a91437.tar.bz2 |
AppLnk fix QArray -> QMAp
-rw-r--r-- | library/applnk.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp index 298581a..41b3008 100644 --- a/library/applnk.cpp +++ b/library/applnk.cpp @@ -18,134 +18,137 @@ ** **********************************************************************/ #define QTOPIA_INTERNAL_MIMEEXT #define QTOPIA_INTERNAL_PRELOADACCESS #define QTOPIA_INTERNAL_APPLNKASSIGN #include "applnk.h" #include <qpe/qpeapplication.h> #include <qpe/categories.h> #include <qpe/categoryselect.h> #ifdef QWS #include <qpe/qcopenvelope_qws.h> #endif #include <qpe/global.h> #include <qpe/mimetype.h> #include <qpe/config.h> #include <qpe/storage.h> #include <qpe/resource.h> #include <qdict.h> #include <qdir.h> #include <qregexp.h> #ifdef Q_WS_QWS #include <qgfx_qws.h> #endif #include <stdlib.h> int AppLnk::lastId = 5000; static int smallSize = 14; static int bigSize = 32; static QString safeFileName(const QString& n) { QString safename=n; safename.replace(QRegExp("[^0-9A-Za-z.]"),"_"); safename.replace(QRegExp("^[^A-Za-z]*"),""); if ( safename.isEmpty() ) safename = "_"; return safename; } static bool prepareDirectories(const QString& lf) { if ( !QFile::exists(lf) ) { // May need to create directories QFileInfo fi(lf); if ( system(("mkdir -p "+fi.dirPath(TRUE))) ) return FALSE; } return TRUE; } class AppLnkPrivate { public: /* the size of the Pixmap */ enum Size {Normal = 0, Big }; AppLnkPrivate() { /* we want one normal and one big item */ - mPixmaps = QArray<QPixmap>(2); + + QPixmap pix; + mPixmaps.insert(0, pix ); + mPixmaps.insert(1, pix); } QStringList mCatList; // always correct QArray<int> mCat; // cached value; correct if not empty - QArray<QPixmap> mPixmaps; + QMap<int, QPixmap> mPixmaps; void updateCatListFromArray() { Categories cat( 0 ); cat.load( categoryFileName() ); mCatList = cat.labels("Document View",mCat); } void setCatArrayDirty() { mCat.resize(0); } void ensureCatArray() { if ( mCat.count() > 0 || mCatList.count()==0 ) return; Categories cat( 0 ); cat.load( categoryFileName() ); mCat.resize( mCatList.count() ); int i; QStringList::ConstIterator it; for ( i = 0, it = mCatList.begin(); it != mCatList.end(); ++it, i++ ) { bool number; int id = (*it).toInt( &number ); if ( !number ) { id = cat.id( "Document View", *it ); if ( id == 0 ) id = cat.addCategory( "Document View", *it ); } mCat[i] = id; } } }; /*! \class AppLnk applnk.h \brief The AppLnk class represents an application available on the system. Every Qtopia application \e app has a corresponding \e app.desktop file. When one of these files is read its data is stored as an AppLnk object. The AppLnk class introduces some Qtopia-specific concepts, and provides a variety of functions, as described in the following sections. \tableofcontents \target Types \section1 Types Every AppLnk object has a \e type. For applications, games and settings the type is \c Application; for documents the type is the document's MIME type. \target files-and-links \section1 Files and Links When you create an AppLnk (or more likely, a \link doclnk.html DocLnk\endlink), you don't deal directly with filenames in the filesystem. Instead you do this: |