Diffstat (limited to 'noncore/applets/keyhelper/keyhelperapplet/anylnk/AppLnkManager.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/applets/keyhelper/keyhelperapplet/anylnk/AppLnkManager.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/noncore/applets/keyhelper/keyhelperapplet/anylnk/AppLnkManager.h b/noncore/applets/keyhelper/keyhelperapplet/anylnk/AppLnkManager.h new file mode 100644 index 0000000..8446578 --- a/dev/null +++ b/noncore/applets/keyhelper/keyhelperapplet/anylnk/AppLnkManager.h | |||
@@ -0,0 +1,56 @@ | |||
1 | #ifndef _APPLNK_MANAGER_H_ | ||
2 | #define _APPLNK_MANAGER_H_ | ||
3 | |||
4 | #include <qsize.h> | ||
5 | |||
6 | #include <qpe/applnk.h> | ||
7 | #include <qpe/mimetype.h> | ||
8 | |||
9 | class AppLnkManager | ||
10 | { | ||
11 | public: | ||
12 | AppLnkManager(){ | ||
13 | } | ||
14 | ~AppLnkManager(){ | ||
15 | if(m_pLnkSet) delete m_pLnkSet; | ||
16 | } | ||
17 | static void init(bool force=false){ | ||
18 | if(m_notfound || force){ | ||
19 | if(m_pLnkSet){ | ||
20 | delete m_pLnkSet; | ||
21 | } | ||
22 | qDebug("AppLnkManager::init()"); | ||
23 | m_pLnkSet = new AppLnkSet(MimeType::appsFolderName()); | ||
24 | m_notfound = false; | ||
25 | } | ||
26 | } | ||
27 | static AppLnkSet* getInstance(){ | ||
28 | if(m_pLnkSet == NULL){ | ||
29 | init(true); | ||
30 | } | ||
31 | return(m_pLnkSet); | ||
32 | } | ||
33 | static const QSize& getIconSize(){ | ||
34 | if(m_oIconSize.isValid()){ | ||
35 | return(m_oIconSize); | ||
36 | } | ||
37 | const QList<AppLnk>& lnkList = getInstance()->children(); | ||
38 | QListIterator<AppLnk> it(lnkList); | ||
39 | for(; it.current(); ++it){ | ||
40 | if((*it)->pixmap().isNull() == false){ | ||
41 | m_oIconSize = (*it)->pixmap().size(); | ||
42 | break; | ||
43 | } | ||
44 | } | ||
45 | return(m_oIconSize); | ||
46 | } | ||
47 | static void notfound(){ | ||
48 | m_notfound = true; | ||
49 | } | ||
50 | private: | ||
51 | static bool m_notfound; | ||
52 | static AppLnkSet* m_pLnkSet; | ||
53 | static QSize m_oIconSize; | ||
54 | }; | ||
55 | |||
56 | #endif /* _APPLNK_MANAGER_H_ */ | ||