-rw-r--r-- | microkde/kiconloader.cpp | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/microkde/kiconloader.cpp b/microkde/kiconloader.cpp new file mode 100644 index 0000000..4842d71 --- a/dev/null +++ b/microkde/kiconloader.cpp | |||
@@ -0,0 +1,140 @@ | |||
1 | |||
2 | #include "kiconloader.h" | ||
3 | #include "kglobal.h" | ||
4 | |||
5 | #ifndef DESKTOP_VERSION_OEGEL | ||
6 | #include <qdir.h> | ||
7 | QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int, | ||
8 | int, QString *, bool ) const | ||
9 | { | ||
10 | QPixmap pix; | ||
11 | QString file; | ||
12 | file = iconPath() + name+".png"; | ||
13 | pix.load ( file ); | ||
14 | // qDebug("KIconLoader::loadIcon %s -----------", file.latin1()); | ||
15 | return pix; | ||
16 | } | ||
17 | QIconSet KIconLoader::loadIconSet( const QString& name) const | ||
18 | { | ||
19 | QPixmap pixmapLoader; | ||
20 | QString file; | ||
21 | file = iconPath() + name+".png"; | ||
22 | pixmapLoader.load( file ); | ||
23 | //qDebug("KIconLoader::loadIconSet: %s ************", file.latin1() ); | ||
24 | QIconSet is ( pixmapLoader ); | ||
25 | return is; | ||
26 | } | ||
27 | |||
28 | QPixmap BarIcon( const QString &name ) | ||
29 | { | ||
30 | QPixmap pix; | ||
31 | pix.load ( KGlobal::iconLoader()->iconPath() + name +".png" ); | ||
32 | return pix; | ||
33 | } | ||
34 | |||
35 | QPixmap DesktopIcon( const QString &name, int ) | ||
36 | { | ||
37 | QPixmap pix; | ||
38 | pix.load ( KGlobal::iconLoader()->iconPath() + name +".png" ); | ||
39 | return pix; | ||
40 | |||
41 | } | ||
42 | |||
43 | QPixmap SmallIcon( const QString &name ) | ||
44 | { | ||
45 | QPixmap pixmapLoader; | ||
46 | QString file; | ||
47 | file =KGlobal::iconLoader()->iconPath() + name +".png"; | ||
48 | pixmapLoader.load( file ); | ||
49 | return pixmapLoader; | ||
50 | |||
51 | } | ||
52 | |||
53 | QPixmap SmallIconSet( const QString &name ) | ||
54 | { | ||
55 | QPixmap pixmapLoader; | ||
56 | QString file; | ||
57 | file =KGlobal::iconLoader()->iconPath() + name +".png"; | ||
58 | pixmapLoader.load( file ); | ||
59 | return pixmapLoader; | ||
60 | } | ||
61 | |||
62 | |||
63 | #else | ||
64 | |||
65 | #include <qpe/resource.h> | ||
66 | #include <kglobal.h> | ||
67 | QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int, | ||
68 | int, QString *, bool ) const | ||
69 | { | ||
70 | QString px = this->iconPath() + "/" + name; | ||
71 | |||
72 | QPixmap p = Resource::loadPixmap( px ); | ||
73 | QPixmap* pPtr = &p; | ||
74 | if (pPtr == 0) | ||
75 | qDebug("KIconLoader::loadIcon: %s not found", px.latin1()); | ||
76 | |||
77 | return p; | ||
78 | } | ||
79 | |||
80 | QIconSet KIconLoader::loadIconSet( const QString& name) const | ||
81 | { | ||
82 | QString px = this->iconPath() + "/" + name; | ||
83 | |||
84 | QIconSet is ;//= Resource::loadIconSet( px ); | ||
85 | QIconSet* isPtr = 0;//LR&is; | ||
86 | if (isPtr == 0) | ||
87 | qDebug("KIconLoader::loadIconSet: %s not foun", px.latin1()); | ||
88 | |||
89 | return is; | ||
90 | } | ||
91 | |||
92 | QPixmap BarIcon( const QString &name ) | ||
93 | { | ||
94 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); | ||
95 | return p; | ||
96 | } | ||
97 | |||
98 | QPixmap DesktopIcon( const QString &name, int ) | ||
99 | { | ||
100 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); | ||
101 | return p; | ||
102 | } | ||
103 | |||
104 | QPixmap SmallIcon( const QString &name ) | ||
105 | { | ||
106 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); | ||
107 | return p; | ||
108 | } | ||
109 | |||
110 | QPixmap SmallIconSet( const QString &name ) | ||
111 | { | ||
112 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); | ||
113 | return p; | ||
114 | } | ||
115 | |||
116 | #endif | ||
117 | |||
118 | //US | ||
119 | QString KIconLoader::setIconPath( const QString &iconpath) | ||
120 | { | ||
121 | QString _old = mIconpath; | ||
122 | mIconpath = iconpath; | ||
123 | |||
124 | return _old; | ||
125 | } | ||
126 | QString KIconLoader::iconPath( const QString & name, int ) const | ||
127 | { | ||
128 | return mIconpath + name + ".png"; | ||
129 | } | ||
130 | |||
131 | QString KIconLoader::iconPath( /*US const QString &, int */) const | ||
132 | { | ||
133 | // LR we set the path at startup | ||
134 | // if (KGlobal::getDesktopSize() == KGlobal::Small) | ||
135 | //return mIconpath + "/icons16"; | ||
136 | |||
137 | //Fall back to the defaultpath | ||
138 | return mIconpath; | ||
139 | } | ||
140 | |||