00001 #ifndef _APPLNK_MANAGER_H_ 00002 #define _APPLNK_MANAGER_H_ 00003 00004 #include <qsize.h> 00005 00006 #include <qpe/applnk.h> 00007 #include <qpe/mimetype.h> 00008 00009 class AppLnkManager 00010 { 00011 public: 00012 AppLnkManager(){ 00013 } 00014 ~AppLnkManager(){ 00015 if(m_pLnkSet) delete m_pLnkSet; 00016 } 00017 static void init(bool force=false){ 00018 if(m_notfound || force){ 00019 if(m_pLnkSet){ 00020 delete m_pLnkSet; 00021 } 00022 qDebug("AppLnkManager::init()"); 00023 m_pLnkSet = new AppLnkSet(MimeType::appsFolderName()); 00024 m_notfound = false; 00025 } 00026 } 00027 static AppLnkSet* getInstance(){ 00028 if(m_pLnkSet == NULL){ 00029 init(true); 00030 } 00031 return(m_pLnkSet); 00032 } 00033 static const QSize& getIconSize(){ 00034 if(m_oIconSize.isValid()){ 00035 return(m_oIconSize); 00036 } 00037 const QList<AppLnk>& lnkList = getInstance()->children(); 00038 QListIterator<AppLnk> it(lnkList); 00039 for(; it.current(); ++it){ 00040 if((*it)->pixmap().isNull() == false){ 00041 m_oIconSize = (*it)->pixmap().size(); 00042 break; 00043 } 00044 } 00045 return(m_oIconSize); 00046 } 00047 static void notfound(){ 00048 m_notfound = true; 00049 } 00050 private: 00051 static bool m_notfound; 00052 static AppLnkSet* m_pLnkSet; 00053 static QSize m_oIconSize; 00054 }; 00055 00056 #endif /* _APPLNK_MANAGER_H_ */
1.4.2