updated on Wed Jan 25 16:08:47 UTC 2012
[aur-mirror.git] / kio-sysinfo / kio-sysinfo-1.8.2-suse-10.3.patch
blob14aaa9fde4f432cc56bd45abf20881b005ee88f5
1 diff -u -r kio-sysinfo-1.8.2/src/ksysinfopart.cpp kio-sysinfo-10.3/src/ksysinfopart.cpp
2 --- kio-sysinfo-1.8.2/src/ksysinfopart.cpp 2006-05-20 14:21:16.000000000 -0300
3 +++ kio-sysinfo-10.3/src/ksysinfopart.cpp 2007-08-14 13:09:50.000000000 -0300
4 @@ -84,6 +84,10 @@
5 rescanTimer=new QTimer(this);
6 connect(rescanTimer, SIGNAL(timeout()), SLOT(rescan()));
7 rescanTimer->start(20000, true);
8 + setJScriptEnabled(false);
9 + setJavaEnabled(false);
10 + setPluginsEnabled(false);
11 + setMetaRefreshEnabled(false);
13 connectDCOPSignal("kded", "networkstatus", "statusChange(QString,int)", "rescan()", false);
14 installEventFilter( this );
15 Somente em kio-sysinfo-1.8.2/src: Makefile
16 diff -u -r kio-sysinfo-1.8.2/src/Makefile.am kio-sysinfo-10.3/src/Makefile.am
17 --- kio-sysinfo-1.8.2/src/Makefile.am 2006-05-20 14:21:16.000000000 -0300
18 +++ kio-sysinfo-10.3/src/Makefile.am 2007-08-14 13:07:17.000000000 -0300
19 @@ -1,10 +1,11 @@
20 +SUBDIRS = .
22 INCLUDES = $(all_includes) `pkg-config --cflags hal`
24 kde_module_LTLIBRARIES = kio_sysinfo.la libksysinfopart.la
26 kio_sysinfo_la_SOURCES = sysinfo.cpp
27 -kio_sysinfo_la_LIBADD = $(LIB_KIO) -lGL
28 +kio_sysinfo_la_LIBADD = $(LIB_KIO) -lhd -lGL
29 kio_sysinfo_la_LDFLAGS = -module -avoid-version $(all_libraries) $(KDE_PLUGIN) $$(pkg-config --libs hal)
31 kde_services_DATA = sysinfo.protocol ksysinfopart.desktop
32 @@ -15,13 +16,11 @@
34 xdg_apps_DATA = kfmclient_sysinfo.desktop
36 -podir=../po
37 -COMMAND=$(XGETTEXT) --foreign-user -C -ci18n -ki18n -ktr2i18n -kI18N_NOOP -kI18N_NOOP2 -kaliasLocale
38 messages:
39 - $(COMMAND) *.cpp -o $(podir)/kio_sysinfo.pot
40 + $(XGETTEXT) *.cpp -o $(podir)/kio_sysinfo.pot
42 METASOURCES = AUTO
44 apps_DATA = x-sysinfo.desktop
45 -appsdir = $(kde_mimedir)/applications
46 +appsdir = $(kde_mimedir)/application
48 Somente em kio-sysinfo-1.8.2/src: Makefile.in
49 diff -u -r kio-sysinfo-1.8.2/src/sysinfo.cpp kio-sysinfo-10.3/src/sysinfo.cpp
50 --- kio-sysinfo-1.8.2/src/sysinfo.cpp 2007-08-21 08:12:15.000000000 -0300
51 +++ kio-sysinfo-10.3/src/sysinfo.cpp 2007-09-21 13:41:53.000000000 -0300
52 @@ -25,7 +25,6 @@
54 #include <qfile.h>
55 #include <qdir.h>
56 -#include <qregexp.h>
58 #include <stdlib.h>
59 #include <math.h>
60 @@ -56,22 +55,22 @@
61 #include <kglobalsettings.h>
62 #include <ktempfile.h>
65 #include "sysinfo.h"
68 using namespace KIO;
69 #define BR "<br>"
71 -static QString formattedUnit( unsigned long long value, int post=1 )
72 +static QString formattedUnit( Q_UINT64 value, int post=1 )
74 - if (value > (1024 * 1024))
75 - if (value > (1024 * 1024 * 1024))
76 - return i18n("%1 GB").arg(KGlobal::locale()->formatNumber(value / (1024 * 1024 * (post == 0 ? 1024 : 1024.0)), post));
77 + if (value >= (1024 * 1024))
78 + if (value >= (1024 * 1024 * 1024))
79 + return i18n("%1 GB").arg(KGlobal::locale()->formatNumber(value / (1024 * 1024 * 1024.0),
80 + post));
81 else
82 - return i18n("%1 MB").arg(KGlobal::locale()->formatNumber(value / (1024 * (post == 0 ? 1024 : 1024.0)), post));
83 + return i18n("%1 MB").arg(KGlobal::locale()->formatNumber(value / (1024 * 1024.0), post));
84 else
85 - return i18n("%1 KB").arg(KGlobal::locale()->formatNumber(value / (post == 0 ? 1024 : 1024.0), post));
86 + return i18n("%1 KB").arg(KGlobal::locale()->formatNumber(value / 1024.0, post));
89 static QString htmlQuote(const QString& _s)
90 @@ -124,46 +123,39 @@
92 void kio_sysinfoProtocol::get( const KURL & /*url*/ )
94 - FILE *fp; //this pointer is used to open file
96 mimeType( "application/x-sysinfo" );
98 + // CPU info
99 + infoMessage( i18n( "Looking for CPU information..." ) );
100 + cpuInfo();
102 // header
103 QString location = locate( "data", "sysinfo/about/my-computer.html" );
104 QFile f( location );
105 f.open( IO_ReadOnly );
106 QTextStream t( &f );
108 - infoMessage(i18n("Looking for hardware information..."));
110 QString content = t.read();
111 - content = content.arg( i18n( "My Computer" ) ); // <title>
113 - content = content.arg( "file:" + locate( "data", "sysinfo/about/style.css" ) );
115 - content = content.arg( i18n( "My Computer" ) ); // <h1>
116 - content = content.arg( i18n( "Folders, Harddisks, Removable Devices, System Information and more..." ) ); // catchphrase
117 + content = content.arg( i18n( "My Computer" ),
118 + htmlQuote("file:" + locate( "data", "sysinfo/about/style.css" )),
119 + i18n( "My Computer"),
120 + i18n( "Folders, Harddisks, Removable Devices, System Information and more..." ));
122 QString sysInfo = "<div id=\"column2\">"; // table with 2 cols
123 QString dummy;
125 // disk info
126 - sysInfo += "<h2 id=\"hdds\">" + i18n( "Disks Information" ) + "</h2>";
127 + infoMessage( i18n( "Looking for disk information..." ) );
128 + sysInfo += "<h2 id=\"hdds\">" + i18n( "Disk Information" ) + "</h2>";
129 sysInfo += diskInfo();
131 osInfo();
132 sysInfo += "<h2 id=\"sysinfo\">" +i18n( "OS Information" ) + "</h2>";
133 sysInfo += "<table>";
134 - sysInfo += "<tr><td>" + i18n( "OS:" ) + "</td><td>" + m_info[OS_SYSNAME] + " " + m_info[OS_RELEASE] + " " + m_info[OS_MACHINE] + "</td></tr>";
135 - sysInfo += "<tr><td>" + i18n( "Current user:" ) + "</td><td>" + m_info[OS_USER] + "@" + m_info[OS_HOSTNAME] + "</td></tr>";
136 - sysInfo += "<tr><td>" + i18n( "System:" ) + "</td><td>" + m_info[OS_SYSTEM] + "</td></tr>";
138 - if((fp =fopen ("/etc/lsb-release", "r"))!=NULL) {
139 - fclose(fp);
140 - sysInfo += "<tr><td>" + i18n( "Version:" ) + "</td><td>" + m_info[OS_VERSION] + "</td></tr>";
144 + sysInfo += "<tr><td>" + i18n( "OS:" ) + "</td><td>" + htmlQuote(m_info[OS_SYSNAME]) + " " +
145 + htmlQuote(m_info[OS_RELEASE]) + " " + htmlQuote(m_info[OS_MACHINE]) + "</td></tr>";
146 + sysInfo += "<tr><td>" + i18n( "Current user:" ) + "</td><td>" + htmlQuote(m_info[OS_USER]) + "@"
147 + + htmlQuote(m_info[OS_HOSTNAME]) + "</td></tr>";
148 + sysInfo += "<tr><td>" + i18n( "System:" ) + "</td><td>" + htmlQuote(m_info[OS_SYSTEM]) + "</td></tr>";
149 sysInfo += "<tr><td>" + i18n( "KDE:" ) + "</td><td>" + KDE::versionString() + "</td></tr>";
150 sysInfo += "</table>";
152 @@ -172,34 +164,30 @@
154 sysInfo += "<h2 id=\"display\">" + i18n( "Display Info" ) + "</h2>";
155 sysInfo += "<table>";
156 - sysInfo += "<tr><td>" + i18n( "Vendor:" ) + "</td><td>" + m_info[GFX_VENDOR] + "</td></tr>";
157 - sysInfo += "<tr><td>" + i18n( "Model:" ) + "</td><td>" + m_info[GFX_MODEL] + "</td></tr>";
158 + sysInfo += "<tr><td>" + i18n( "Vendor:" ) + "</td><td>" + htmlQuote(m_info[GFX_VENDOR]) + "</td></tr>";
159 + sysInfo += "<tr><td>" + i18n( "Model:" ) + "</td><td>" + htmlQuote(m_info[GFX_MODEL]) + "</td></tr>";
160 if (!m_info[GFX_DRIVER].isNull())
161 - sysInfo += "<tr><td>" + i18n( "Driver:" ) + "</td><td>" + m_info[GFX_DRIVER] + "</td></tr>";
162 + sysInfo += "<tr><td>" + i18n( "Driver:" ) + "</td><td>" + htmlQuote(m_info[GFX_DRIVER]) + "</td></tr>";
163 sysInfo += "</table>";
166 sysInfo += "</div><div id=\"column1\">"; // second column
168 // OS info
169 + infoMessage( i18n( "Getting OS information...." ) );
171 // common folders
172 - sysInfo += "<h2 id=\"dirs\">" + i18n( "Common Folders" ) + "</h2>";
173 - sysInfo += "<ul>";
175 - sysInfo += QString( "<li><a href=\"file:%1\">" ).arg( QDir::homeDirPath() ) + i18n( "My Home Folder" ) + "</a></li>";
176 - sysInfo += QString( "<li><a href=\"file:%1\">" ).arg( QDir::rootDirPath() ) + i18n( "Root Folder" ) + "</a></li>";
178 - if((fp =fopen ("/usr/lib/kde3/kio_apt.so", "r"))!=NULL) {
179 - sysInfo += "<li><a href=\"apt:/\">" + i18n( "Repository" ) + "</a></li>";
180 - fclose(fp);
182 - //sysInfo += "<li><a href=\"programs:/\">" + i18n( "Application" ) + "</a></li>";
184 + sysInfo += "<h2 id=\"dirs\">" + i18n( "Common Folders" ) + "</h2>"; sysInfo += "<ul>";
185 + if ( KStandardDirs::exists( KGlobalSettings::documentPath() + "/" ) )
186 + sysInfo += QString( "<li><a href=\"file:%1\">" ).arg( htmlQuote(KGlobalSettings::documentPath()) )
187 + + i18n( "My Documents" ) + "</a></li>";
188 + sysInfo += QString( "<li><a href=\"file:%1\">" ).arg( htmlQuote(QDir::homeDirPath()) ) + i18n( "My Home Folder" ) + "</a></li>";
189 + sysInfo += QString( "<li><a href=\"file:%1\">" ).arg( htmlQuote(QDir::rootDirPath()) ) + i18n( "Root Folder" ) + "</a></li>";
190 sysInfo += "<li><a href=\"remote:/\">" + i18n( "Network Folders" ) + "</a></li>";
191 sysInfo += "</ul>";
193 // net info
194 + infoMessage( i18n( "Looking up network status..." ) );
195 int state = netInfo();
196 if (state > 1) { // assume no network manager / networkstatus
197 sysInfo += "<h2 id=\"net\">" + i18n( "Network Status" ) + "</h2>";
198 @@ -208,8 +196,6 @@
199 sysInfo += "</ul>";
202 - // CPU info
203 - cpuInfo();
204 if ( !m_info[CPU_MODEL].isNull() )
206 sysInfo += "<h2 id=\"cpu\">" + i18n( "CPU Information" ) + "</h2>";
207 @@ -231,30 +217,17 @@
210 // memory info
211 + infoMessage( i18n( "Looking for memory information..." ) );
212 memoryInfo();
213 sysInfo += "<h2 id=\"memory\">" + i18n( "Memory Information" ) + "</h2>";
214 sysInfo += "<table>";
215 sysInfo += "<tr><td>" + i18n( "Total memory (RAM):" ) + "</td><td>" + m_info[MEM_TOTALRAM] + "</td></tr>";
216 sysInfo += "<tr><td>" + i18n( "Free memory:" ) + "</td><td>" + m_info[MEM_FREERAM] + "</td></tr>";
217 dummy = i18n( "Used Memory" );
218 - sysInfo += "<tr><td>" + i18n( "Total Swap:" ) + "</td><td>" + m_info[MEM_TOTALSWAP] + "</td></tr>";
219 - sysInfo += "<tr><td>" + i18n( " Free Swap:" ) + "</td><td>" + m_info[MEM_FREESWAP] + "</td></tr>";
220 + dummy += "<tr><td>" + i18n( "Total swap:" ) + "</td><td>" + m_info[MEM_TOTALSWAP] + "</td></tr>";
221 + sysInfo += "<tr><td>" + i18n( "Free swap:" ) + "</td><td>" + m_info[MEM_FREESWAP] + "</td></tr>";
222 sysInfo += "</table>";
224 - // hw info
225 - if (!m_info[TYPE].isNull() || !m_info[MANUFACTURER].isNull() || !m_info[PRODUCT].isNull()
226 - || !m_info[BIOSVENDOR].isNull() || !m_info[ BIOSVERSION ].isNull())
228 - sysInfo += "<h2 id=\"hwinfo\">" +i18n( "Hardware Information" ) + "</h2>";
229 - sysInfo += "<table>";
230 - sysInfo += "<tr><td>" + i18n( "Type:" ) + "</td><td>" + m_info[ TYPE ] + "</td></tr>";
231 - sysInfo += "<tr><td>" + i18n( "Vendor:" ) + "</td><td>" + m_info[ MANUFACTURER ] + "</td></tr>";
232 - sysInfo += "<tr><td>" + i18n( "Model:" ) + "</td><td>" + m_info[ PRODUCT ] + "</td></tr>";
233 - sysInfo += "<tr><td>" + i18n( "Bios Vendor:" ) + "</td><td>" + m_info[ BIOSVENDOR ] + "</td></tr>";
234 - sysInfo += "<tr><td>" + i18n( "Bios Version:" ) + "</td><td>" + m_info[ BIOSVERSION ] + "</td></tr>";
235 - sysInfo += "</table>";
238 sysInfo += "</div>";
240 // Send the data
241 @@ -278,11 +251,11 @@
242 unsigned long int val = 0;
243 if ( sscanf( b + strlen( key ), ": %lu", &val ) != 1 )
244 return 0;
245 - kdDebug() << "scan_one " << key << " " << val << endl;
246 + kdDebug(1242) << "scan_one " << key << " " << val << endl;
247 return val;
250 -static unsigned long int calculateFreeRam()
251 +static Q_UINT64 calculateFreeRam()
253 FILE *fd = fopen( "/proc/meminfo", "rt" );
254 if ( !fd )
255 @@ -291,10 +264,10 @@
256 QTextIStream is( fd );
257 QString MemInfoBuf = is.read();
259 - unsigned long int MemFree = scan_one( MemInfoBuf.latin1(), "MemFree" );
260 - unsigned long int Buffers = scan_one( MemInfoBuf.latin1(), "Buffers" );
261 - unsigned long int Cached = scan_one( MemInfoBuf.latin1(), "Cached" );
262 - unsigned long int Slab = scan_one( MemInfoBuf.latin1(), "Slab" );
263 + Q_UINT64 MemFree = scan_one( MemInfoBuf.latin1(), "MemFree" );
264 + Q_UINT64 Buffers = scan_one( MemInfoBuf.latin1(), "Buffers" );
265 + Q_UINT64 Cached = scan_one( MemInfoBuf.latin1(), "Cached" );
266 + Q_UINT64 Slab = scan_one( MemInfoBuf.latin1(), "Slab" );
267 fclose( fd );
269 MemFree += Cached + Buffers + Slab;
270 @@ -310,19 +283,19 @@
272 if ( retval !=-1 )
274 - const int mem_unit = info.mem_unit;
275 + Q_UINT64 mem_unit = info.mem_unit;
277 - m_info[MEM_TOTALRAM] = formattedUnit( info.totalram * mem_unit );
278 - unsigned long int totalFree = calculateFreeRam() * 1024;
279 - kdDebug() << "total " << totalFree << " free " << info.freeram << " unit " << mem_unit << endl;
280 + m_info[MEM_TOTALRAM] = formattedUnit( Q_UINT64(info.totalram) * mem_unit );
281 + Q_UINT64 totalFree = calculateFreeRam() * 1024;
282 + kdDebug(1242) << "total " << totalFree << " free " << info.freeram << " unit " << mem_unit << endl;
283 if ( totalFree > info.freeram * info.mem_unit || true )
284 - m_info[MEM_FREERAM] = i18n("%1 (+ %2 Caches)").arg(formattedUnit( info.freeram * mem_unit ))
285 + m_info[MEM_FREERAM] = i18n("%1 (+ %2 Caches)").arg(formattedUnit( Q_UINT64(info.freeram) * mem_unit ))
286 .arg( formattedUnit( totalFree - info.freeram * mem_unit ));
287 else
288 - m_info[MEM_FREERAM] = formattedUnit( info.freeram * mem_unit );
289 + m_info[MEM_FREERAM] = formattedUnit( Q_UINT64(info.freeram) * mem_unit );
291 - m_info[MEM_TOTALSWAP] = formattedUnit( info.totalswap * mem_unit );
292 - m_info[MEM_FREESWAP] = formattedUnit( info.freeswap * mem_unit );
293 + m_info[MEM_TOTALSWAP] = formattedUnit( Q_UINT64(info.totalswap) * mem_unit );
294 + m_info[MEM_FREESWAP] = formattedUnit( Q_UINT64(info.freeswap) * mem_unit );
296 m_info[SYSTEM_UPTIME] = convertSeconds( info.uptime );
298 @@ -346,6 +319,7 @@
299 m_info[CPU_TEMP] =
300 readFromFile(QString("/proc/acpi/thermal_zone/%1/temperature").arg(names[i]), "temperature", ":");
301 m_info[CPU_TEMP] = m_info[CPU_TEMP].stripWhiteSpace();
302 + m_info[CPU_TEMP].replace(" C",QString::fromUtf8("°C"));
303 if (!m_info[CPU_TEMP].isEmpty())
304 break;
306 @@ -355,9 +329,12 @@
307 m_info[CPU_MODEL] = readFromFile( "/proc/cpuinfo", "cpu", ":" );
311 QString kio_sysinfoProtocol::diskInfo()
313 - QString result = "<table>";
314 + QString result = "<table><tr><th>" + i18n( "Device" ) + "</th><th>" + i18n( "Filesystem" ) + "</th><th>" +
315 + i18n( "Total space" ) + "</th><th>" + i18n( "Available space" ) + "</th></tr>";
317 if ( fillMediaDevices() )
319 for ( QValueList<DiskInfo>::ConstIterator it = m_devices.constBegin(); it != m_devices.constEnd(); ++it )
320 @@ -365,74 +342,72 @@
321 QString tooltip = i18n("Press the right mouse button for more options like Mount or Eject");
323 DiskInfo di = ( *it );
324 - QString label = di.userLabel.isEmpty() ? di.label : di.userLabel;
325 + unsigned int percent = 0;
326 + Q_UINT64 usage = di.total - di.avail;
327 + if (di.total)
328 + percent = usage / ( di.total / 100);
330 + KURL media;
331 + media.setProtocol("media");
332 + media.setPath("/" + di.name);
334 + result += QString( "<tr><td>%1 <a href=\"%2\" title=\"%7\">%3</a></td><td>%4</td><td>%5</td><td>%6</td></tr>\n" ).
335 + arg( icon( di.iconName ) ).arg( media.htmlURL() ).arg( htmlQuote(di.label) ).arg( di.fsType ).
336 + arg( di.total ? formattedUnit( di.total) : QString::null).arg(di.mounted ?
337 + formattedUnit (di.avail ) : QString::null).arg( htmlQuote(tooltip) );
338 + if (di.mounted) {
339 + QColor c;
340 + c.setHsv(100-percent, 180, 230);
341 + result += QString("<tr><td colspan=\"4\" class=\"bar\" width=\"100%\">"
342 + "<div class=\"filled\" style=\"width: %1%; height: 1em; background-color: %3\">"
343 + "%2</div></td></tr>\n")
344 + .arg(percent).arg(formattedUnit(usage).replace(" ", "&nbsp;")).arg(c.name());
348 + else // fall back to fstab parsing
350 + FILE * fp;
351 + if ( !( fp = setmntent( "/etc/fstab", "r" ) ) )
353 + kdDebug(1242) << k_funcinfo << "Failed to open /etc/fstab" << endl;
354 + return QString::null;
357 +#define FS_NAME mnt_ent->mnt_fsname // device-name
358 +#define FS_FILE mnt_ent->mnt_dir // mount-point
359 +#define FS_TYPE mnt_ent->mnt_type // fs-type
361 + struct statfs sfs;
362 + struct mntent *mnt_ent;
363 + unsigned long long total, avail;
365 - unsigned long long usage,percent,peer;
366 - usage = di.total - di.avail;
367 - peer = di.total / 100;
369 - peer == 0 ? percent = 0 : percent = usage / peer;
371 - if (percent < 20) {
372 - result += QString( "<tr>"
373 - " <td>%1</td>"
374 - " <td width=\"90%\">"
375 - " <table width=\"100%\">"
376 - " <tr>"
377 - " <a href=\"media:/%2\" title=\"%3\">%4</a> <b class=\"disk_text_color\"> [%5]"
378 - " " + i18n("Total") + ": <b>%6</b> " + i18n("Available") + ": <b>%7</b> </b>"
379 - " </td>"
380 - " <td width=\"40%\" class=\"bar\">"
381 - " <div style=\"width: %8%; height:10px;\"></div><span style=\"float:left; padding-top:2px\">&nbsp%9&nbsp</span>"
382 - " </tr>"
383 - " </table>"
384 - " </td>"
385 - "</tr>"
386 - "<tr></tr>" ).
388 - arg( icon( di.iconName, 32 ) ).
389 - arg( di.name ).
390 - arg( tooltip).
391 - arg( label ).
392 - arg( di.fsType ).
393 - arg( formattedUnit( di.total,0 ) ).
394 - arg( formattedUnit( di.avail,0 ) ).
395 - arg( di.mounted ? percent : 0).
396 - arg( di.mounted ? formattedUnit( usage ) : QString::null );
400 - else {
402 - result += QString( "<tr>"
403 - " <td>%1</td>"
404 - " <td width=\"90%\">"
405 - " <table width=\"100%\">"
406 - " <tr>"
407 - " <a href=\"media:/%2\" title=\"%3\">%4</a> <b class=\"disk_text_color\"> [%5]"
408 - " " + i18n("Total") + ": <b>%6</b> " + i18n("Available") + ": <b>%7</b> </b>"
409 - " </td>"
410 - " <td width=\"40%\" class=\"bar\">"
411 - " <div style=\"width: %8%; height:10px;\">%9&nbsp</div>"
412 - " </tr>"
413 - " </table>"
414 - " </td>"
415 - "</tr>"
416 - "<tr></tr>" ).
418 - arg( icon( di.iconName, 32 ) ).
419 - arg( di.name ).
420 - arg( tooltip).
421 - arg( label ).
422 - arg( di.fsType ).
423 - arg( formattedUnit( di.total,0 ) ).
424 - arg( formattedUnit( di.avail,0 ) ).
425 - arg( di.mounted ? percent : 0).
426 - arg( di.mounted ? formattedUnit( usage ) : QString::null );
428 + while ( ( mnt_ent = getmntent( fp ) ) != NULL )
430 + total = avail = 0;
431 + if ( statfs( FS_FILE, &sfs ) == 0 )
433 + total = ( unsigned long long )sfs.f_blocks * sfs.f_bsize;
434 + if ( total > 0 && strcmp( FS_TYPE, "subdomainfs" ) != 0 ) // discard empty or otherwise strange devices
436 + avail = ( unsigned long long )( getuid() ? sfs.f_bavail : sfs.f_bfree ) * sfs.f_bsize;
437 + int lastSlash = QString( FS_NAME ).findRev( '/' );
438 + QString deviceName = lastSlash != -1 ? QString( FS_NAME ).mid( lastSlash + 1 ) : QString( FS_NAME );
439 + //kdDebug(1242) << k_funcinfo << "Device name: " << deviceName << endl;
440 + QString model = deviceName.left( deviceName.length() - 1 );
441 + model = readFromFile( "/proc/ide/" + model + "/model" );
442 + QString devIcon = icon( iconForDevice( deviceName ), KIcon::SizeSmall );
443 + result += QString( "<tr><td>%1 <a href=\"file:%2\" title=\"%7\">%3</a></td><td>%4</td><td>%5</td><td>%6</td></tr>" )
444 + .arg( devIcon ).arg( FS_FILE ).arg( FS_FILE ).arg( FS_TYPE ).arg( formattedUnit( total ) )
445 + .arg( formattedUnit( avail ) ).arg( model );
449 + endmntent( fp );
452 result += "</table>";
454 return result;
457 @@ -442,12 +417,12 @@
458 // query kded.networkstatus.status(QString host)
459 DCOPRef nsd( "kded", "networkstatus" );
460 nsd.setDCOPClient( m_dcopClient );
461 - DCOPReply reply = nsd.call( "status", QString( "www.google.com" ) );
462 + DCOPReply reply = nsd.call( "status", QString( "www.mandriva.com" ) );
464 if ( reply.isValid() )
465 return reply;
467 - kdDebug() << k_funcinfo << "Reply is invalid" << endl;
468 + kdDebug(1242) << k_funcinfo << "Reply is invalid" << endl;
470 return 0;
472 @@ -539,7 +514,6 @@
473 #endif
476 -#define INFO_DRI "/proc/dri/0/name"
478 bool kio_sysinfoProtocol::glInfo()
480 @@ -621,7 +595,6 @@
481 return true;
485 QString kio_sysinfoProtocol::netStatus( int code ) const
487 if ( code == 1 || code == 2 )
488 @@ -641,7 +614,8 @@
489 QString kio_sysinfoProtocol::icon( const QString & name, int size ) const
491 QString path = KGlobal::iconLoader()->iconPath( name, -size );
492 - return QString( "<img src=\"file:%1\" width=\"%2\" height=\"%3\" valign=\"center\"/>" ).arg( path ).arg( size ).arg( size );
493 + return QString( "<img src=\"file:%1\" width=\"%2\" height=\"%3\" valign=\"bottom\"/>" ).arg(
494 + htmlQuote(path) ).arg( size ).arg( size );
497 QString kio_sysinfoProtocol::iconForDevice( const QString & name ) const
498 @@ -659,7 +633,6 @@
500 void kio_sysinfoProtocol::osInfo()
502 - FILE *fp;
503 struct utsname uts;
504 uname( &uts );
505 m_info[ OS_SYSNAME ] = uts.sysname;
506 @@ -670,14 +643,8 @@
508 m_info[ OS_USER ] = KUser().loginName();
510 - if((fp =fopen ("/etc/lsb-release", "r"))==NULL)
511 - m_info[ OS_SYSTEM ] = readFromFile( "/etc/issue" );
512 - else
513 - { fclose(fp);
514 - m_info[ OS_SYSTEM ] = readFromFile( "/etc/lsb-release", "DISTRIB_DESCRIPTION", "=" );
515 - m_info[ OS_VERSION ] = readFromFile( "/etc/lsb-release", "DISTRIB_CODENAME", "=" );
518 + m_info[ OS_SYSTEM ] = readFromFile( "/etc/mandriva-release" );
519 + m_info[ OS_SYSTEM ].replace("X86-64","x86_64");
522 static const KCmdLineOptions options[] =
523 @@ -698,10 +665,10 @@
524 KCmdLineArgs::addCmdLineOptions( options );
525 KApplication app( false, true );
527 - kdDebug(7101) << "*** Starting kio_sysinfo " << endl;
528 + kdDebug(1242) << "*** Starting kio_sysinfo " << endl;
530 if (argc != 4) {
531 - kdDebug(7101) << "Usage: kio_sysinfo protocol domain-socket1 domain-socket2" << endl;
532 + kdDebug(1242) << "Usage: kio_sysinfo protocol domain-socket1 domain-socket2" << endl;
533 exit(-1);
536 @@ -710,7 +677,7 @@
537 kio_sysinfoProtocol slave( args->arg(1), args->arg(2));
538 slave.dispatchLoop();
540 - kdDebug(7101) << "*** kio_sysinfo Done" << endl;
541 + kdDebug(1242) << "*** kio_sysinfo Done" << endl;
542 return 0;
545 @@ -723,15 +690,15 @@
546 if ( devices.isEmpty() )
547 return false;
549 - kdDebug() << devices << endl;
550 + kdDebug(1242) << devices << endl;
552 m_devices.clear();
554 LibHalContext *m_halContext = libhal_ctx_new();
555 if (!m_halContext)
557 - kdDebug(1219) << "Failed to initialize HAL!" << endl;
558 - return false;
559 + kdDebug(1242) << "Failed to initialize HAL!" << endl;
560 + return false;
563 DBusError error;
564 @@ -786,30 +753,26 @@
565 struct statfs sfs;
566 if ( di.mounted && statfs( QFile::encodeName( di.mountPoint ), &sfs ) == 0 )
568 - di.total = ( unsigned long long ) sfs.f_blocks * sfs.f_bsize;
569 + di.total = ( unsigned long long )sfs.f_blocks * sfs.f_bsize;
570 di.avail = ( unsigned long long )( getuid() ? sfs.f_bavail : sfs.f_bfree ) * sfs.f_bsize;
571 } else if (m_halContext && di.id.startsWith("/org/freedesktop/Hal/" ) )
573 - dbus_error_init(&error);
574 - di.total = libhal_device_get_property_uint64(m_halContext, di.id.latin1(), "volume.size", &error);
575 - if (dbus_error_is_set(&error))
576 - di.total = 0;
579 + dbus_error_init(&error);
580 + di.total = libhal_device_get_property_uint64(m_halContext, di.id.latin1(), "volume.size", &error);
581 + if (dbus_error_is_set(&error))
582 + di.total = 0;
585 - di.model = libhal_device_get_property_string( m_halContext, di.id.latin1( ), "block.storage_device", &error );
586 - di.model = libhal_device_get_property_string( m_halContext, di.model.latin1( ), "storage.model", &error );
587 + // guess the model
588 + QString ideName = di.name;
589 + ideName.truncate( 3 );
590 + di.model = readFromFile( "/proc/ide/" + ideName + "/model" );
592 - ++it; // skip separator
593 + ++it; // skip separator
595 - m_devices.append( di );
596 + m_devices.append( di );
599 - m_info[PRODUCT ] = libhal_device_get_property_string( m_halContext, "/org/freedesktop/Hal/devices/computer", "smbios.system.product", &error );
600 - m_info[MANUFACTURER ] = libhal_device_get_property_string( m_halContext, "/org/freedesktop/Hal/devices/computer", "smbios.system.manufacturer", &error );
601 - m_info[TYPE] = libhal_device_get_property_string( m_halContext, "/org/freedesktop/Hal/devices/computer", "smbios.chassis.type", &error );
602 - m_info[BIOSVENDOR] = libhal_device_get_property_string( m_halContext, "/org/freedesktop/Hal/devices/computer", "smbios.bios.vendor", &error );
603 - m_info[BIOSVERSION] = libhal_device_get_property_string( m_halContext, "/org/freedesktop/Hal/devices/computer", "smbios.bios.version", &error );
605 libhal_ctx_free(m_halContext);
607 return true;
608 diff -u -r kio-sysinfo-1.8.2/src/sysinfo.h kio-sysinfo-10.3/src/sysinfo.h
609 --- kio-sysinfo-1.8.2/src/sysinfo.h 2007-08-21 08:13:36.000000000 -0300
610 +++ kio-sysinfo-10.3/src/sysinfo.h 2007-08-14 13:10:29.000000000 -0300
611 @@ -51,7 +51,7 @@
612 QString iconName;
614 // own stuff
615 - unsigned long long total, avail; // space on device
616 + Q_UINT64 total, avail; // space on device
617 QString model; // physical device model (name)
620 @@ -78,12 +78,11 @@
621 MEM_FREERAM,
622 MEM_TOTALSWAP,
623 MEM_FREESWAP,
624 - STEPPING, //speedstep
625 SYSTEM_UPTIME, // in seconds
626 CPU_MODEL,
627 CPU_SPEED, // in MHz
628 - CPU_CORES,
629 - CPU_TEMP,
630 + CPU_CORES,
631 + CPU_TEMP,
632 OS_SYSNAME, // man 2 uname
633 OS_RELEASE,
634 OS_VERSION,
635 @@ -94,31 +93,16 @@
636 GFX_VENDOR, // Display stuff
637 GFX_MODEL,
638 GFX_DRIVER,
639 - SYSINFO_LAST,
640 - PRODUCT,
641 - MANUFACTURER,
642 - TYPE,
643 - BIOSVENDOR,
644 - BIOSVERSION
645 + SYSINFO_LAST
648 private:
650 - * Read sysinfo from (proc) filesystem. The data is assumed to be separated by newlines, with key:value pairs
652 - * @param filename file to read from
653 - * @param info requested field (if empty, return the first line from the file)
654 - * @param sep separator
655 - * NOT USED YET
656 - */
657 - // QString readFromFile( const QString & filename, const QString & info = QString::null, const char * sep = 0 ) const;
659 - /**
660 * Gather basic memory info
662 void memoryInfo();
664 - /**
665 + /**
666 * Gather CPU info
668 void cpuInfo();
669 diff -u -r kio-sysinfo-1.8.2/admin/acinclude.m4.in kio-sysinfo-10.3/admin/acinclude.m4.in
670 --- kio-sysinfo-1.8.2/admin/acinclude.m4.in 2006-08-31 15:56:03.000000000 -0300
671 +++ kio-sysinfo-10.3/admin/acinclude.m4.in 2007-03-19 13:45:09.000000000 -0300
672 @@ -983,7 +983,7 @@
673 X_INCLUDES="-I$x_includes"
676 -if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then
677 +if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE || test "$kde_x_libraries" = "/usr/lib"; then
678 X_LDFLAGS=""
679 x_libraries="/usr/lib"; dnl better than nothing :-
680 else
681 @@ -3198,7 +3198,7 @@
682 case $host in
683 *-*-linux-gnu)
684 CFLAGS="-std=iso9899:1990 -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS"
685 - CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts $CXXFLAGS"
686 + CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wchar-subscripts $CXXFLAGS"
687 KDE_CHECK_COMPILER_FLAG(Wmissing-format-attribute, [CXXFLAGS="$CXXFLAGS -Wformat-security -Wmissing-format-attribute"])
688 KDE_CHECK_C_COMPILER_FLAG(Wmissing-format-attribute, [CFLAGS="$CFLAGS -Wformat-security -Wmissing-format-attribute"])
690 @@ -4624,12 +4624,14 @@
692 AC_DEFUN([KDE_CHECK_PYTHON],
694 - KDE_CHECK_PYTHON_INTERN("2.4",
695 - [KDE_CHECK_PYTHON_INTERN("2.3",
696 - [KDE_CHECK_PYTHON_INTERN("2.2",
697 - [KDE_CHECK_PYTHON_INTERN("2.1",
698 - [KDE_CHECK_PYTHON_INTERN("2.0",
699 - [KDE_CHECK_PYTHON_INTERN($1, $2) ])
700 + KDE_CHECK_PYTHON_INTERN("2.5",
701 + [KDE_CHECK_PYTHON_INTERN("2.4",
702 + [KDE_CHECK_PYTHON_INTERN("2.3",
703 + [KDE_CHECK_PYTHON_INTERN("2.2",
704 + [KDE_CHECK_PYTHON_INTERN("2.1",
705 + [KDE_CHECK_PYTHON_INTERN("2.0",
706 + [KDE_CHECK_PYTHON_INTERN($1, $2) ])
707 + ])
711 @@ -5213,9 +5215,10 @@
712 for dir in $javadirs; do
713 dnl Check for the java executable
714 if test -x "$dir/java"; then
715 + sane_path=$(cd $dir; /bin/pwd)
716 dnl And also check for a libjvm.so somewhere under there
717 dnl Since we have to go to the parent dir, /usr/bin is excluded, /usr is too big.
718 - if test "$dir" != "/usr/bin"; then
719 + if test "$sane_path" != "/usr/bin"; then
720 libjvmdir=`find $dir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
721 if test ! -f $libjvmdir/libjvm.so; then continue; fi
722 jredirs="$jredirs $dir"
723 Somente em kio-sysinfo-1.8.2/admin: cvs-clean.pl
724 diff -u -r kio-sysinfo-1.8.2/admin/cvs.sh kio-sysinfo-10.3/admin/cvs.sh
725 --- kio-sysinfo-1.8.2/admin/cvs.sh 2006-08-31 15:56:03.000000000 -0300
726 +++ kio-sysinfo-10.3/admin/cvs.sh 2007-05-14 04:16:15.000000000 -0300
727 @@ -68,7 +68,7 @@
728 echo "*** KDE requires automake $required_automake_version"
729 exit 1
731 - automake*1.6.* | automake*1.7* | automake*1.8* | automake*1.9*)
732 + automake*1.6.* | automake*1.7* | automake*1.8* | automake*1.9* | automake*1.10*)
733 echo "*** $AUTOMAKE_STRING found."
734 UNSERMAKE=no
736 @@ -316,7 +316,7 @@
739 if test -z "$VERSION" || test "$VERSION" = "@VERSION@"; then
740 - VERSION="\"3.5.4\""
741 + VERSION="\"3.5.7\""
743 if test -z "$modulename" || test "$modulename" = "@MODULENAME@"; then
744 modulename=`pwd`;
745 diff -u -r kio-sysinfo-1.8.2/admin/detect-autoconf.pl kio-sysinfo-10.3/admin/detect-autoconf.pl
746 --- kio-sysinfo-1.8.2/admin/detect-autoconf.pl 2006-08-31 15:56:03.000000000 -0300
747 +++ kio-sysinfo-10.3/admin/detect-autoconf.pl 2007-08-14 10:26:09.000000000 -0300
748 @@ -46,6 +46,8 @@
750 ($version) = $file =~ /$prefix\/$program-?(.*)$/;
751 $version =~ s/-|\.//g;
752 + # Don't check the -wrapper ones
753 + next if $version eq "wrapper";
755 # Special case some programs to make sure it has a minimum version.
756 if (not $version and exists $minimumVersions{$program})
757 Somente em kio-sysinfo-1.8.2/admin: detect-autoconf.sh
758 diff -u -r kio-sysinfo-1.8.2/admin/libtool.m4.in kio-sysinfo-10.3/admin/libtool.m4.in
759 --- kio-sysinfo-1.8.2/admin/libtool.m4.in 2006-08-31 15:56:03.000000000 -0300
760 +++ kio-sysinfo-10.3/admin/libtool.m4.in 2007-04-23 16:19:55.000000000 -0300
761 @@ -1424,7 +1424,7 @@
762 libsuff=
763 if test "x$LINUX_64_MODE" = x64; then
764 # Some platforms are per default 64-bit, so there's no /lib64
765 - if test -d /lib64; then
766 + if test -d /lib64 -a ! -h /lib64; then
767 libsuff=64