summaryrefslogtreecommitdiffabout
path: root/microkde/kiconloader.cpp
blob: 4842d71a93db173b266f239e986472250ca6c75e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140

#include "kiconloader.h"
#include "kglobal.h"

#ifndef DESKTOP_VERSION_OEGEL
#include <qdir.h>
QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int,
                               int, QString *, bool ) const
{
    QPixmap pix; 
    QString file;
    file = iconPath() + name+".png";
    pix.load (  file );
    // qDebug("KIconLoader::loadIcon %s -----------",  file.latin1());
    return pix;
}
QIconSet KIconLoader::loadIconSet( const QString& name) const
{
    QPixmap pixmapLoader; 
    QString file;
    file = iconPath() + name+".png";
    pixmapLoader.load( file ); 
    //qDebug("KIconLoader::loadIconSet: %s ************", file.latin1() );
    QIconSet is ( pixmapLoader );
  return is;
}

QPixmap BarIcon( const QString &name )
{ 
    QPixmap pix;
    pix.load ( KGlobal::iconLoader()->iconPath()  + name +".png" );
    return pix;
}

QPixmap DesktopIcon( const QString &name, int )
{
    QPixmap pix;
    pix.load ( KGlobal::iconLoader()->iconPath()  + name +".png" );
    return pix;

}

QPixmap SmallIcon( const QString &name )
{ 
    QPixmap pixmapLoader; 
    QString file;
    file =KGlobal::iconLoader()->iconPath()  + name +".png";
    pixmapLoader.load( file );
    return pixmapLoader;
  
}

QPixmap SmallIconSet( const QString &name )
{
    QPixmap pixmapLoader; 
    QString file;
    file =KGlobal::iconLoader()->iconPath()  + name +".png";
    pixmapLoader.load( file ); 
    return pixmapLoader;
}


#else

#include <qpe/resource.h>
#include <kglobal.h>
QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int,
                               int, QString *, bool ) const
{
  QString px = this->iconPath() + "/" + name;
  
  QPixmap p = Resource::loadPixmap( px );
  QPixmap* pPtr = &p;
  if (pPtr == 0)
    qDebug("KIconLoader::loadIcon: %s not found", px.latin1());
  
  return p;
}

QIconSet KIconLoader::loadIconSet( const QString& name) const
{
  QString px = this->iconPath() + "/" + name;
  
  QIconSet is ;//= Resource::loadIconSet( px );
  QIconSet* isPtr = 0;//LR&is;
  if (isPtr == 0)
    qDebug("KIconLoader::loadIconSet: %s not foun", px.latin1());
  
  return is;
}

QPixmap BarIcon( const QString &name )
{
  QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop);
  return p;
}

QPixmap DesktopIcon( const QString &name, int )
{
  QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop);
  return p;
}

QPixmap SmallIcon( const QString &name )
{
  QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop);
  return p;
}

QPixmap SmallIconSet( const QString &name )
{
  QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop);
  return p;
}

#endif

//US    
QString KIconLoader::setIconPath( const QString &iconpath)
{
  QString _old = mIconpath;
  mIconpath = iconpath;

  return _old;
}
QString KIconLoader::iconPath(  const QString & name, int ) const
{
  return mIconpath + name + ".png";
}

QString KIconLoader::iconPath( /*US const QString &, int */) const
{
    // LR we set the path at startup
    // if (KGlobal::getDesktopSize() == KGlobal::Small)
    //return mIconpath + "/icons16";

  //Fall back to the defaultpath  
  return mIconpath;
}