522 } |
536 } |
523 |
537 |
524 return false; |
538 return false; |
525 } |
539 } |
526 |
540 |
|
541 QString QSystemDeviceInfoPrivate::model() |
|
542 { |
|
543 if(halAvailable()) { |
|
544 #if !defined(QT_NO_DBUS) |
|
545 QHalDeviceInterface iface("/org/freedesktop/Hal/devices/computer"); |
|
546 QString model; |
|
547 if (iface.isValid()) { |
|
548 model = iface.getPropertyString("system.kernel.machine"); |
|
549 if(!model.isEmpty()) |
|
550 model += " "; |
|
551 model += iface.getPropertyString("system.chassis.type"); |
|
552 if(!model.isEmpty()) |
|
553 return model; |
|
554 } |
|
555 #endif |
|
556 } |
|
557 QFile file("/proc/cpuinfo"); |
|
558 if (!file.open(QIODevice::ReadOnly)) { |
|
559 qDebug() << "Could not open /proc/cpuinfo"; |
|
560 } else { |
|
561 QTextStream cpuinfo(&file); |
|
562 QString line = cpuinfo.readLine(); |
|
563 while (!line.isNull()) { |
|
564 line = cpuinfo.readLine(); |
|
565 if(line.contains("model name")) { |
|
566 return line.split(": ").at(1).trimmed(); |
|
567 } |
|
568 } |
|
569 } |
|
570 return QString(); |
|
571 } |
|
572 |
|
573 QString QSystemDeviceInfoPrivate::productName() |
|
574 { |
|
575 if(halAvailable()) { |
|
576 #if !defined(QT_NO_DBUS) |
|
577 QHalDeviceInterface iface("/org/freedesktop/Hal/devices/computer"); |
|
578 QString productName; |
|
579 if (iface.isValid()) { |
|
580 productName = iface.getPropertyString("info.product"); |
|
581 if(productName.isEmpty()) { |
|
582 productName = iface.getPropertyString("system.product"); |
|
583 if(!productName.isEmpty()) |
|
584 return productName; |
|
585 } else { |
|
586 return productName; |
|
587 } |
|
588 } |
|
589 #endif |
|
590 } |
|
591 const QDir dir("/etc"); |
|
592 if(dir.exists()) { |
|
593 QStringList langList; |
|
594 QFileInfoList localeList = dir.entryInfoList(QStringList() << "*release", |
|
595 QDir::Files | QDir::NoDotAndDotDot, |
|
596 QDir::Name); |
|
597 foreach(const QFileInfo fileInfo, localeList) { |
|
598 const QString filepath = fileInfo.filePath(); |
|
599 QFile file(filepath); |
|
600 if (file.open(QIODevice::ReadOnly)) { |
|
601 QTextStream prodinfo(&file); |
|
602 QString line = prodinfo.readLine(); |
|
603 while (!line.isNull()) { |
|
604 if(filepath.contains("lsb.release")) { |
|
605 if(line.contains("DISTRIB_DESCRIPTION")) { |
|
606 return line.split("=").at(1).trimmed(); |
|
607 } |
|
608 } else { |
|
609 return line; |
|
610 } |
|
611 line = prodinfo.readLine(); |
|
612 } |
|
613 } |
|
614 } //end foreach |
|
615 } |
|
616 |
|
617 QFile file("/etc/issue"); |
|
618 if (!file.open(QIODevice::ReadOnly)) { |
|
619 qDebug() << "Could not open /proc/cpuinfo"; |
|
620 } else { |
|
621 QTextStream prodinfo(&file); |
|
622 QString line = prodinfo.readLine(); |
|
623 while (!line.isNull()) { |
|
624 line = prodinfo.readLine(); |
|
625 if(!line.isEmpty()) { |
|
626 QStringList lineList = line.split(" "); |
|
627 for(int i = 0; i < lineList.count(); i++) { |
|
628 if(lineList.at(i).toFloat()) { |
|
629 return lineList.at(i-1) + " "+ lineList.at(i); |
|
630 } |
|
631 } |
|
632 } |
|
633 } |
|
634 } |
|
635 return QString(); |
|
636 } |
|
637 |
527 QSystemScreenSaverPrivate::QSystemScreenSaverPrivate(QSystemScreenSaverLinuxCommonPrivate *parent) |
638 QSystemScreenSaverPrivate::QSystemScreenSaverPrivate(QSystemScreenSaverLinuxCommonPrivate *parent) |
528 : QSystemScreenSaverLinuxCommonPrivate(parent), currentPid(0) |
639 : QSystemScreenSaverLinuxCommonPrivate(parent), currentPid(0) |
529 { |
640 { |
530 kdeIsRunning = false; |
641 kdeIsRunning = false; |
531 gnomeIsRunning = false; |
642 gnomeIsRunning = false; |