SVN: PLDLiveInstaller: . .kdev_include_paths branches branches/0.1 branches/0.1/CMakeLists.txt branc...

shadzik shadzik at pld-linux.org
Thu Nov 18 00:25:49 CET 2010


Author: shadzik
Date: Thu Nov 18 00:25:48 2010
New Revision: 11909

Added:
   PLDLiveInstaller/
   PLDLiveInstaller/.kdev_include_paths
   PLDLiveInstaller/branches/
   PLDLiveInstaller/branches/0.1/
   PLDLiveInstaller/branches/0.1/CMakeLists.txt
   PLDLiveInstaller/branches/0.1/DiskListWidget.cpp
   PLDLiveInstaller/branches/0.1/DiskListWidget.h
   PLDLiveInstaller/branches/0.1/PLDLiveInstaller.cpp
   PLDLiveInstaller/branches/0.1/PLDLiveInstaller.h
   PLDLiveInstaller/branches/0.1/PLDLiveInstaller.kdev4
   PLDLiveInstaller/branches/0.1/main.cpp
   PLDLiveInstaller/branches/0.2/
   PLDLiveInstaller/branches/0.2/CMakeLists.txt
   PLDLiveInstaller/branches/0.2/DiskListWidget.cpp
   PLDLiveInstaller/branches/0.2/DiskListWidget.h
   PLDLiveInstaller/branches/0.2/PLDLiveInstaller.cpp
   PLDLiveInstaller/branches/0.2/PLDLiveInstaller.h
   PLDLiveInstaller/branches/0.2/PLDLiveInstaller.kdev4
   PLDLiveInstaller/branches/0.2/Updater.cpp
   PLDLiveInstaller/branches/0.2/Updater.h
   PLDLiveInstaller/branches/0.2/Version.h
   PLDLiveInstaller/branches/0.2/installerUpdate.xml
   PLDLiveInstaller/branches/0.2/main.cpp
   PLDLiveInstaller/branches/0.2/scripts/
   PLDLiveInstaller/branches/0.2/scripts/getxatakmod.sh   (contents, props changed)
   PLDLiveInstaller/trunk/
   PLDLiveInstaller/trunk/.kdev4/
   PLDLiveInstaller/trunk/CMakeLists.txt
   PLDLiveInstaller/trunk/DiskListWidget.cpp
   PLDLiveInstaller/trunk/DiskListWidget.h
   PLDLiveInstaller/trunk/PLDLiveInstaller.cpp
   PLDLiveInstaller/trunk/PLDLiveInstaller.h
   PLDLiveInstaller/trunk/PLDLiveInstaller.kdev4
   PLDLiveInstaller/trunk/Updater.cpp
   PLDLiveInstaller/trunk/Updater.h
   PLDLiveInstaller/trunk/Version.h
   PLDLiveInstaller/trunk/installerUpdate.xml
   PLDLiveInstaller/trunk/main.cpp
   PLDLiveInstaller/trunk/scripts/
   PLDLiveInstaller/trunk/scripts/getxatakmod.sh   (contents, props changed)
Log:
- official PLDLiveInstaller source code
- feel free to contribute and contact me


Added: PLDLiveInstaller/.kdev_include_paths
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/.kdev_include_paths	Thu Nov 18 00:25:48 2010
@@ -0,0 +1 @@
+/usr/include/KDE

Added: PLDLiveInstaller/branches/0.1/CMakeLists.txt
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.1/CMakeLists.txt	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,17 @@
+project(PLDLiveInstaller)
+cmake_minimum_required(VERSION 2.6)
+find_package(Qt4 REQUIRED)
+find_package(KDE4 REQUIRED)
+include (KDE4Defaults)
+
+set(CMAKE_CXX_FLAGS "-O3 -g -fexceptions")
+
+include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${KDE4_INCLUDES})
+
+set(PLDLiveInstaller_SRCS PLDLiveInstaller.cpp DiskListWidget.cpp main.cpp)
+qt4_automoc(${PLDLiveInstaller_SRCS})
+add_executable(pldliveinstaller ${PLDLiveInstaller_SRCS})
+target_link_libraries(pldliveinstaller ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBS} 
+${KDE4_KDE3SUPPORT_LIBS} ${KDE4_KUTILS_LIBS} kworkspace crypt)
+
+install(TARGETS pldliveinstaller ${INSTALL_TARGETS_DEFAULT_ARGS})

Added: PLDLiveInstaller/branches/0.1/DiskListWidget.cpp
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.1/DiskListWidget.cpp	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,85 @@
+#include "DiskListWidget.h"
+
+#include <KDebug>
+
+#include <Solid/Device>
+#include <Solid/DeviceInterface>
+#include <Solid/StorageDrive>
+#include <Solid/Block>
+	
+DiskListWidget::DiskListWidget( QWidget *parent )
+  : QListWidget( parent )
+{
+
+}
+
+DiskListWidget::~DiskListWidget()
+{
+}
+
+void DiskListWidget::refresh()
+{
+    //setCurrentItem(NULL);
+    setSelectionMode(QAbstractItemView::SingleSelection);
+    
+    if (diskListAlreadyOnList.size() <= 0)
+    {
+      devhash = new QHash<QString,Solid::Device>;
+      parthash = new QHash<QString,Solid::Device>;
+    }
+    
+    QStringList solidDevice;
+    solidDevice.append(diskListAlreadyOnList);
+    
+    //get a list of all storage volumes
+    QList<Solid::Device> list = Solid::Device::listFromType(Solid::DeviceInterface::StorageDrive, QString());
+    foreach (Solid::Device device, list)
+    {
+      if(device.is<Solid::StorageDrive>())
+      {
+	QString dev = device.as<Solid::Block>()->device();
+	
+	if (solidDevice.contains(dev))
+	{
+	  solidDevice.removeOne(dev);
+	} else {
+	
+	Solid::StorageDrive *harddisk = device.as<Solid::StorageDrive>();
+	if(((harddisk->driveType()==Solid::StorageDrive::HardDisk) || (harddisk->driveType()==Solid::StorageDrive::MemoryStick)))
+	{
+	  QString text = device.product() + " (" + dev + ")"; 
+	  QListWidgetItem *listitem = new QListWidgetItem;
+	  if ((harddisk->driveType()==Solid::StorageDrive::MemoryStick) || harddisk->isRemovable())
+	    listitem->setIcon(KIcon("drive-removable-media-usb").pixmap(64));
+	  else
+	    listitem->setIcon(KIcon("drive-harddisk").pixmap(64));
+	  listitem->setText(text);
+	  listitem->setToolTip(dev);
+	  addItem(listitem);
+	  devhash->insert(text,device);
+	  diskListAlreadyOnList.append(dev);
+	  qDebug() << "Product: " << device.product() << "Vendor: " << device.vendor() 
+	  << "Description: " << device.description() << "Dev: " << dev
+	  << "Type: " << harddisk->driveType();
+	  
+	   foreach (Solid::Device partDev, Solid::Device::listFromType(Solid::DeviceInterface::Block, device.udi() ))
+	   {
+	    QString part = partDev.as<Solid::Block>()->device();
+	    parthash->insert(part, partDev);
+	    //qDebug() << "has partition: " << part;
+	  }
+	  
+	}
+      }
+      }
+    }
+    foreach(QString soldev, solidDevice) {
+      takeItem(row(findItems(".*"+soldev+".*",Qt::MatchRegExp)[0]));
+      foreach(QString devDescr, diskListAlreadyOnList) {
+	if (devDescr.contains(soldev))
+	  diskListAlreadyOnList.removeAll(devDescr);
+      }
+    }
+}
+
+#include "DiskListWidget.moc"

Added: PLDLiveInstaller/branches/0.1/DiskListWidget.h
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.1/DiskListWidget.h	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,34 @@
+#ifndef DiskListWidget_H
+#define DiskListWidget_H
+
+#include <QCheckBox>
+#include <QLineEdit>
+#include <QListWidgetItem>
+#include <QProgressBar>
+#include <KAssistantDialog>
+#include <KDialog>
+#include <KAboutData>
+#include <QHash>
+#include <Solid/Device>
+
+class DiskListWidget;
+
+class DiskListWidget : public QListWidget
+{
+
+    Q_OBJECT
+
+    QStringList diskList;
+    QStringList diskListAlreadyOnList;
+
+public:
+    DiskListWidget( QWidget * parent = 0 );
+    QListWidgetItem *listitem;
+    QHash<QString,Solid::Device> * devhash, * parthash;
+    virtual ~DiskListWidget();
+    
+public Q_SLOTS:
+    void refresh();
+};
+
+#endif // DiskListWidget_H

Added: PLDLiveInstaller/branches/0.1/PLDLiveInstaller.cpp
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.1/PLDLiveInstaller.cpp	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,1489 @@
+#include "PLDLiveInstaller.h"
+#include "DiskListWidget.h"
+
+#include <QApplication>
+#include <QDir>
+#include <QFile>
+#include <QLabel>
+#include <QListWidget>
+#include <QMessageBox>
+#include <QProcess>
+#include <QProgressBar>
+#include <QRegExp>
+#include <QTabWidget>
+#include <QTextStream>
+#include <QVBoxLayout>
+
+#include <KActionMenu>
+#include <KCMultiDialog>
+#include <KComboBox>
+#include <KDebug>
+#include <KLocale>
+#include <KPushButton>
+#include <KServiceTypeTrader>
+#include <KStandardDirs>
+#include <KTitleWidget>
+#include <KVBox>
+#include <kworkspace/kworkspace.h>
+#include <kdesu/kdesu_export.h>
+#include <Solid/Device>
+#include <Solid/DeviceInterface>
+#include <Solid/StorageDrive>
+#include <Solid/StorageVolume>
+#include <Solid/StorageAccess>
+#include <Solid/Block>
+
+#define SOURCE "/"
+#define DESTINATION "/mnt/pldlivechroot/"
+#define LIVEUSER "plduser"
+
+PLDLiveInstaller::PLDLiveInstaller( QWidget *parent )
+  : KAssistantDialog( parent )
+{
+    setPlainCaption(i18n("PLD Live Installer"));
+    setFixedSize(640,480);
+    showButton(KDialog::Help, false);
+    showButton(KDialog::Cancel, false);
+    showButton(KDialog::User1, false);
+   
+    // Start
+    startPage = addPage(startWidget(), i18n(""));
+    
+    // Partition
+    partitionDialog = kcmDialog("kcm_partitionmanager", "kcm_partitionmanager");
+    partitionPage = addPage(kcmLayout(partitionDialog), i18n("Partition your hard drive"));
+    if (!partitionDialog)
+    {
+      setAppropriate(partitionPage, false);
+      partition_disk->setCheckable(false);
+      partition_disk->setDisabled(true);
+      QMessageBox::warning(this, "Can't partition your disk",
+			       "Sorry, the kcm_partitionmanager module couldn't be found. You won't "
+			       "be able to partition your disk.", QMessageBox::Ok);
+    }
+    setAppropriate(partitionPage, false);
+
+    // Select destination drive
+    selectDiskPage = addPage(selectDiskWidget(), i18n(""));
+    setValid(selectDiskPage, false);
+    
+    //Select partitions
+    selectPartitionsPage = addPage(selectPartitionsWidget(), i18n(""));
+    setValid(selectPartitionsPage, false);
+    
+    // Create user account
+    createUserPage = addPage(createUserWidget(), i18n(""));
+    setValid(createUserPage,false);
+    //if (password->text() != password2->text()) setValid(createUserPage, false);
+    
+    // Copy files to DEST root
+    installingPage = addPage(installingWidget(), i18n(""));
+    if (pbar->value()!=100) setValid(installingPage, false);
+    
+    // Finish
+    finishPage = addPage(finishWidget(), i18n(""));
+    setAppropriate(finishPage, false);
+    
+    // Fail
+    failedPage = addPage(failedWidget(), i18n(""));
+    setAppropriate(failedPage, false);
+
+}
+
+PLDLiveInstaller::~PLDLiveInstaller()
+{
+}
+
+QWidget * PLDLiveInstaller::startWidget()
+{
+    KTitleWidget *titleWidget = new KTitleWidget(this);
+    titleWidget->setText(i18n("<html><p align=\"center\"><font size=\"10\"><b>Install PLD Linux</b></font><br /><br />"
+	  "<font size=\"5\"><b>To set up the installation of PLD Linux, click Next</b></font>"
+	  "</p></html>"));
+	  
+    QLabel *text = new QLabel(this);
+    text->setText(i18n("<html><p align=\"justify\">"
+    "The content of this Live CD will be copied to your hard drive. You will be able to choose a disk, partition it<br />"
+    "and create a user. After the installtion is complete you can safely reboot your computer."
+    "</p></html>"
+    ));
+    
+    QVBoxLayout *textLayout = new QVBoxLayout;
+    textLayout->addWidget(text);
+    
+    partition_disk = new QCheckBox("I'd like to partition my disk");
+    partition_disk->setCheckState(Qt::Unchecked);
+    partition_disk->setChecked(false);    
+    connect(partition_disk, SIGNAL( stateChanged(int)), this, SLOT( isChecked(int)));
+    
+    QVBoxLayout *partLayout = new QVBoxLayout;
+    partLayout->addWidget(partition_disk);
+
+    QVBoxLayout *layout = new QVBoxLayout;
+    layout->addWidget(titleWidget);
+    layout->addLayout(textLayout);
+    layout->addLayout(partLayout);
+    layout->setMargin(0);
+    
+    QWidget *widget = new QWidget;
+    widget->setLayout(layout);
+    widget->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
+    //setMainWidget(widget);
+    return widget;
+}
+
+void PLDLiveInstaller::isChecked(int state)
+{
+  if (state == Qt::Checked)
+    setAppropriate(partitionPage, true);
+  else if (state == Qt::Unchecked)
+    setAppropriate(partitionPage, false);
+}
+
+void PLDLiveInstaller::isDiskItemSelected()
+{
+  qDebug() << diskListWidget->currentItem()->text() << "was selected";
+  setValid(selectDiskPage, true);
+  selectedDisk = diskListWidget->currentItem();
+  selectedBlockDev = diskListWidget->devhash->value(selectedDisk->text());
+  selHDDisRem = selectedBlockDev.as<Solid::StorageDrive>()->isRemovable();
+  qDebug() << "selHDD in isDIsk..." << selHDDisRem;
+  defimage->setVisible(false);
+  if (selHDDisRem)
+  {
+    image2->setVisible(true);
+    image->setVisible(false);
+  }
+  else
+  {
+    image->setVisible(true);
+    image2->setVisible(false);
+  }
+}
+
+void PLDLiveInstaller::isRootPartitionSelected(int pos)
+{
+  qDebug() << "rootPart Position: " << pos;
+  rootPartPos=pos;
+  if (pos!=0)
+  {
+    QString sizeText;
+    qlonglong minSize = 3072;
+    destPartition=diskListWidget->parthash->value(availablePartitions[pos-1]);
+    qlonglong curSize = destPartition.as<Solid::StorageVolume>()->size()/1024/1024; //MB
+    QString size = QString::number(curSize);
+    if(curSize < minSize)
+      sizeText = "Size: " + size + "MB<br /><b>The device is too small for installation.</b><br />You need at least "
+		  + QString::number(minSize) + "MB of free space to proceed with installation.";
+    else {
+      setValid(selectPartitionsPage, true);
+      sizeText = "Size: " + size + "MB<br />";
+    }
+    
+    selRoot=destPartition.as<Solid::Block>()->device();
+    
+    partDescr->setText("Partition details:<br />"
+		      "Device: " + selRoot + "<br />"
+		      //"File system type: " + destPartition.as<Solid::StorageVolume>()->fsType() + "<br />"
+		      + sizeText 
+		      //"Mountpoint: " + mountpoint + ""
+    );
+    //qDebug() << "DestPartition size" << destPartition.as<Solid::StorageVolume>()->size();
+   //}
+  }
+}
+
+void PLDLiveInstaller::isSwapPartitionSelected(int pos)
+{
+  qDebug() << "swapPart Position: " << pos;
+  swapPartPos=pos;
+  if (pos!=0)
+  {
+    destSwap=diskListWidget->parthash->value(availablePartitions[pos-1]);
+    selSwap=destSwap.as<Solid::Block>()->device();
+  }
+}
+
+void PLDLiveInstaller::isFsSelected(int pos)
+{
+  qDebug() << "FS type: " << fsTypes[pos];
+  selFS=fsTypes[pos];
+}
+
+void PLDLiveInstaller::reboot()
+{
+    KWorkSpace::ShutdownConfirm confirm = KWorkSpace::ShutdownConfirmYes;
+    KWorkSpace::ShutdownType type = KWorkSpace::ShutdownTypeReboot;
+    KWorkSpace::ShutdownMode mode = KWorkSpace::ShutdownModeForceNow;
+    KWorkSpace::requestShutDown(confirm, type, mode);
+    //QApplication::quit();
+    KDialog::delayedDestruct();
+}
+
+void PLDLiveInstaller::close()
+{
+  KDialog::delayedDestruct();
+}
+
+QWidget * PLDLiveInstaller::selectDiskWidget()
+{   
+    KTitleWidget *titleWidget = new KTitleWidget(this);
+    titleWidget->setText(i18n("<html><p align=\"center\"><font size=\"10\"><b>Install PLD Linux</b></font><br /><br />"
+	  "<font size=\"5\"><b>Select the disk where you want PLD Linux<br /> to install and click Next.</b></font>"
+	  "</p></html>"));
+	  
+    KHBox *buttonBox = new KHBox(this);
+
+    diskListWidget = new DiskListWidget(this);
+    connect(diskListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(isDiskItemSelected()));
+    diskListWidget->refresh();
+
+    KPushButton *refresh = new KPushButton(KIcon("view-refresh"), i18n("Refresh list"), buttonBox);
+    refresh->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
+    refresh->setToolTip("Refresh device list");
+    connect(refresh, SIGNAL(clicked()), diskListWidget, SLOT(refresh()));
+    
+    defimage = new QLabel;
+    defimage->setPixmap(KIcon("media-optical").pixmap(128));
+    defimage->setAlignment(Qt::AlignLeft);
+    defimage->setVisible(true);
+    
+    image = new QLabel;
+    image->setPixmap(KIcon("drive-harddisk").pixmap(128));
+    image->setAlignment(Qt::AlignLeft);
+    image->setVisible(false);
+    
+    image2 = new QLabel;
+    image2->setPixmap(KIcon("drive-removable-media-usb").pixmap(128));
+    image2->setAlignment(Qt::AlignLeft);
+    image2->setVisible(false);
+    
+    QHBoxLayout *imageLayout = new QHBoxLayout;
+    imageLayout->addWidget(defimage);
+    imageLayout->addWidget(image);
+    imageLayout->addWidget(image2);
+	  
+    QLabel *text = new QLabel(this);
+    text->setText(i18n("<html><p align=\"left\">"
+    "The following disks are available:"
+    "</p></html>"
+    ));
+    
+    QVBoxLayout *disksLayout = new QVBoxLayout;
+    disksLayout->addWidget(text);
+    disksLayout->addWidget(diskListWidget);
+    disksLayout->addWidget(buttonBox);
+    disksLayout->setSpacing(0);
+    
+    QHBoxLayout *midLayout = new QHBoxLayout;
+    midLayout->addLayout(imageLayout);
+    midLayout->addLayout(disksLayout);
+    midLayout->setMargin(50);
+    midLayout->setSpacing(20);
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(titleWidget);
+    layout->addLayout(midLayout);
+    layout->setMargin(0);
+    
+    QWidget *widget = new QWidget(this);
+    widget->setLayout(layout);
+    widget->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Maximum);
+    return widget;
+    
+}
+
+QWidget * PLDLiveInstaller::selectPartitionsWidget()
+{   
+    swapPartPos = 0;
+    rootPartPos = 0;
+    fsTypes << "ext4" << "ext3" << "ext2" << "xfs";
+    selFS=fsTypes[0];
+  
+    KTitleWidget *titleWidget = new KTitleWidget(this);
+    titleWidget->setText(i18n("<html><p align=\"center\"><font size=\"10\"><b>Install PLD Linux</b></font><br /><br />"
+	  "<font size=\"5\"><b>Select partitions where you want PLD Linux<br/> to install and click Next.</b></font>"
+	  "</p></html>"));
+	  
+    partImage = new QLabel;
+    partImage->setPixmap(KIcon("drive-harddisk").pixmap(128));
+    partImage->setAlignment(Qt::AlignLeft);
+    partImage->setVisible(false);
+    
+    partImage2 = new QLabel;
+    partImage2->setPixmap(KIcon("drive-removable-media-usb").pixmap(128));
+    partImage2->setAlignment(Qt::AlignLeft);
+    partImage2->setVisible(false);
+    
+    partDescr = new QLabel;
+    partDescr->setVisible(true);
+    partDescr->setAlignment(Qt::AlignLeft);
+    
+    QHBoxLayout *imageLayout = new QHBoxLayout;
+    imageLayout->addWidget(partImage);
+    imageLayout->addWidget(partImage2);
+    
+    QVBoxLayout *descrLayout = new QVBoxLayout;
+    descrLayout->addWidget(partDescr);
+	  
+    selectPartitionPageText = new QLabel(this);
+    rootPart = new KComboBox(this);
+    swapPart = new KComboBox(this);
+    connect(rootPart, SIGNAL(activated(int)), this, SLOT(isRootPartitionSelected(int)));
+    connect(swapPart, SIGNAL(activated(int)), this, SLOT(isSwapPartitionSelected(int)));
+    fs = new KComboBox(this);
+    fs->addItems(fsTypes);
+    fs->setCurrentItem("ext4");
+    connect(fs, SIGNAL(activated(int)), this, SLOT(isFsSelected(int)));
+    
+    QLabel *rootText = new QLabel();
+    rootText->setText("Root (/)");
+    
+    QLabel *swapText = new QLabel();
+    swapText->setText("Swap");
+    
+    QHBoxLayout *rootLayout = new QHBoxLayout;
+    rootLayout->addWidget(rootText);
+    rootLayout->addWidget(rootPart);
+    rootLayout->addWidget(fs);
+    
+    QHBoxLayout *swapLayout = new QHBoxLayout;
+    swapLayout->addWidget(swapText);
+    swapLayout->addWidget(swapPart);
+    
+    QVBoxLayout *disksLayout = new QVBoxLayout;
+    disksLayout->addWidget(selectPartitionPageText);
+    disksLayout->addLayout(rootLayout);
+    disksLayout->addLayout(swapLayout);
+    disksLayout->setSpacing(0);
+    
+    QHBoxLayout *midLayout = new QHBoxLayout;
+    midLayout->addLayout(imageLayout);
+    midLayout->addLayout(disksLayout);
+    midLayout->setMargin(50);
+    midLayout->setSpacing(20);
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(titleWidget);
+    layout->addLayout(midLayout);
+    layout->addLayout(descrLayout);
+    layout->setMargin(0);
+    
+    QWidget *widget = new QWidget(this);
+    widget->setLayout(layout);
+    widget->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Maximum);
+    return widget;
+    
+}
+
+void PLDLiveInstaller::isUserEntered(QString user)
+{
+  if(user!=username->text() || username->text().isEmpty()==false)
+    setValid(createUserPage,true);
+}
+
+QWidget * PLDLiveInstaller::createUserWidget()
+{   
+    KTitleWidget *titleWidget = new KTitleWidget(this);
+    titleWidget->setText(i18n("<html><p align=\"center\"><font size=\"10\"><b>Install PLD Linux</b></font><br /><br />"
+	  "<font size=\"5\"><b>Fill-in the forms below and click Next to continue.</b></font>"
+	  "</p></html>"));
+	  
+    QLabel *image = new QLabel;
+    image->setPixmap(KIcon("list-add-user").pixmap(128));
+    image->setAlignment(Qt::AlignLeft);
+    
+    QHBoxLayout *imageLayout = new QHBoxLayout;
+    imageLayout->addWidget(image);
+    
+    username = new QLineEdit;
+    username->setText("Username");
+    username->setEchoMode(QLineEdit::Normal);
+    connect(username, SIGNAL(textEdited(QString)), this, SLOT(isUserEntered(QString)));
+    
+    password = new QLineEdit;
+    password->setText("Password");
+    password->setEchoMode(QLineEdit::Password);
+    
+    password2 = new QLineEdit;
+    password2->setText("Re-type password");
+    password2->setEchoMode(QLineEdit::Password);
+    
+    hostname = new QLineEdit;
+    hostname->setText("pldmachine");
+    hostname->setEchoMode(QLineEdit::Normal);
+	  
+    QLabel *userText = new QLabel(this);
+    userText->setText(i18n("<html>"
+    "Username: "
+    "</html>"
+    ));
+    
+    QLabel *passwdText = new QLabel(this);
+    passwdText->setText(i18n("<html>"
+    "Password: "
+    "</html>"
+    ));
+    
+    QLabel *passwdText2 = new QLabel(this);
+    passwdText2->setText(i18n("<html>"
+    "Re-type password: "
+    "</html>"
+    ));
+    
+    QLabel *hostnameDesc = new QLabel(this);
+    hostnameDesc->setText(i18n("<html>"
+      "Set the name of your computer<br/>(if left empty \"pldmachine\" is taken, default \"pldmachine\")"
+      "</html>"
+    ));
+    
+    QLabel *hostnameText = new QLabel(this);
+    hostnameText->setText(i18n("<html>"
+      "Hostname: "
+      "</html>"
+    ));
+    
+    QHBoxLayout *usernameLayout = new QHBoxLayout;
+    usernameLayout->addWidget(userText);
+    usernameLayout->addWidget(username);
+    
+    QHBoxLayout *passwordLayout = new QHBoxLayout;
+    passwordLayout->addWidget(passwdText);
+    passwordLayout->addWidget(password);
+   
+    QHBoxLayout *passwordLayout2 = new QHBoxLayout;
+    passwordLayout2->addWidget(passwdText2);
+    passwordLayout2->addWidget(password2);
+    
+    QVBoxLayout *hostnameDescLayout = new QVBoxLayout;
+    hostnameDescLayout->addWidget(hostnameDesc);
+    
+    QHBoxLayout *hostnameLayout = new QHBoxLayout;
+    hostnameLayout->addWidget(hostnameText);
+    hostnameLayout->addWidget(hostname);
+    
+    QVBoxLayout *credLayout = new QVBoxLayout;
+    credLayout->addLayout(usernameLayout);
+    credLayout->addLayout(passwordLayout);
+    credLayout->addLayout(passwordLayout2);
+    credLayout->addLayout(hostnameDescLayout);
+    credLayout->addLayout(hostnameLayout);
+    
+    QHBoxLayout *midLayout = new QHBoxLayout;
+    midLayout->addLayout(imageLayout);
+    midLayout->addLayout(credLayout);
+    midLayout->setMargin(50);
+    midLayout->setSpacing(20);
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(titleWidget);
+    layout->addLayout(midLayout);
+    layout->setMargin(0);
+    
+    QWidget *widget = new QWidget(this);
+    widget->setLayout(layout);
+    widget->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
+    return widget;
+}
+
+QWidget * PLDLiveInstaller::installingWidget()
+{   
+    pbarVal = 0;
+  
+    KHBox *buttonBox = new KHBox(this);
+
+    install = new KPushButton(KIcon("continue-data-project"), i18n("Install"), buttonBox);
+    install->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
+    install->setToolTip("Start installation process now");
+    connect(install, SIGNAL(clicked()), this, SLOT(installation()));
+  
<<diff output has been trimmed to 500 lines, 990 line(s) remained.>>

Added: PLDLiveInstaller/branches/0.1/PLDLiveInstaller.h
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.1/PLDLiveInstaller.h	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,88 @@
+#ifndef PLDLiveInstaller_H
+#define PLDLiveInstaller_H
+
+#include <QCheckBox>
+#include <QLineEdit>
+#include <QListWidgetItem>
+#include <QProgressBar>
+#include <KComboBox>
+#include <KAssistantDialog>
+#include <KDialog>
+#include <KAboutData>
+#include <QHash>
+#include <Solid/Device>
+#include <Solid/StorageDrive>
+#include <Solid/StorageVolume>
+#include <QLabel>
+
+#include "DiskListWidget.h"
+
+class KCMultiDialog;
+
+class PLDLiveInstaller : public KAssistantDialog
+{
+
+    Q_OBJECT
+
+    KCMultiDialog *partitionDialog;
+    KPageWidgetItem *startPage;
+    KPageWidgetItem *partitionPage;
+    KPageWidgetItem *selectDiskPage;
+    KPageWidgetItem *selectPartitionsPage;
+    KPageWidgetItem *createUserPage;
+    KPageWidgetItem *installingPage;
+    KPageWidgetItem *finishPage;
+    KPageWidgetItem *failedPage;
+
+    QWidget * kcmLayout(KCMultiDialog* dialog);
+    QWidget * startWidget();
+    QWidget * selectDiskWidget();
+    QWidget * selectPartitionsWidget();
+    QWidget * createUserWidget();
+    QWidget * installingWidget();
+    QWidget * finishWidget();
+    QWidget * failedWidget();
+    KCMultiDialog* kcmDialog(const QString lib, const QString name = "", bool debug = false);
+    QProgressBar *pbar;
+    KPushButton *install;
+    QCheckBox *partition_disk;
+    QLineEdit *username, *password, *password2, *hostname;
+    DiskListWidget *diskListWidget;
+    QListWidgetItem * selectedDisk;
+    Solid::Device selectedBlockDev, destPartition, destSwap;
+    QLabel *selectPartitionPageText, *installationText, *installationHeader, *failText;
+    QStringList availablePartitions, fsTypes;
+    KComboBox * rootPart,* swapPart, * fs;
+    int rootPartPos, swapPartPos, pbarVal;
+    bool selHDDisRem;
+    QLabel *defimage, *image, *image2, *partImage, *partImage2, *partDescr;
+    QString selFS, selUser, selPasswd, selHostname, failReason, selRoot, selSwap;
+    int isMounted(Solid::Device partition);
+    int mountDev(Solid::Device partition), umountDev(Solid::Device partition);
+    void copyData(QString src,QString dest), getData(QString src, QString dest);
+    void makeFS(Solid::Device partition), makeSwap(Solid::Device partition);
+    void updateProgressBar(), createFstabEntries(), createUser(), copySettings(QString file), deleteLiveUser();
+    char * genPasswd();
+    void makeGrubConfig(), installGrub(), geninitrd(), mountProcSysDev(), umountProcSysDev(), delUtmpx();
+    void move2dest(QString from, QString to), renameConfigFiles(), createHostname();
+    
+public:
+    PLDLiveInstaller( QWidget * parent = 0 );
+    virtual ~PLDLiveInstaller();
+        
+public Q_SLOTS:
+    virtual void back();
+    virtual void next();
+    void reboot();
+    void close();
+    void installation();
+    void isChecked(int state);
+    void isDiskItemSelected();
+    void isRootPartitionSelected(int pos);
+    void isSwapPartitionSelected(int pos);
+    void isFsSelected(int pos);
+    void isUserEntered(QString user);
+    
+};
+
+#endif // PLDLiveInstaller_H

Added: PLDLiveInstaller/branches/0.1/PLDLiveInstaller.kdev4
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.1/PLDLiveInstaller.kdev4	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,3 @@
+[Project]
+Manager=KDevCMakeManager
+Name=PLDLiveInstaller

Added: PLDLiveInstaller/branches/0.1/main.cpp
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.1/main.cpp	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,34 @@
+#include <KApplication>
+#include <KCmdLineArgs>
+#include <KAboutData>
+#include <KLocale>
+#include "PLDLiveInstaller.h"
+
+#define	VERSION "0.1"
+#define VERSION_STR "Version " VERSION
+
+void fillAboutData(KAboutData& aboutData);
+
+int main(int argc, char** argv)
+{
+  
+    KAboutData aboutData( "PLDLiveInstaller", "PLD Live Installer", ki18n(VERSION_STR),
+			  VERSION, ki18n("Live Installer"), KAboutData::License_GPL);
+			  
+    fillAboutData(aboutData);
+  
+    KCmdLineArgs::init( argc, argv, &aboutData );
+  
+    KApplication app;
+    PLDLiveInstaller * start = new PLDLiveInstaller();
+    start->setCaption("PLD Live Installer");
+    start->show();
+    
+    return app.exec();
+}
+
+void fillAboutData(KAboutData& aboutData)
+{
+  aboutData.setProgramIconName("tools-wizard");
+  aboutData.addAuthor(ki18n("Bartosz Świątek"), ki18n("Maintainer, Qt4"), "shadzik at pld-linux.org");
+}
\ No newline at end of file

Added: PLDLiveInstaller/branches/0.2/CMakeLists.txt
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.2/CMakeLists.txt	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,24 @@
+project(PLDLiveInstaller)
+cmake_minimum_required(VERSION 2.6)
+set (QT_MIN_VERSION "4.7.0")
+find_package(Qt4 REQUIRED)
+find_package(KDE4 REQUIRED)
+find_package(KDE4Workspace REQUIRED)
+include (KDE4Defaults)
+
+set(CMAKE_CXX_FLAGS "-O2 -g -fexceptions")
+
+include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${KDE4_INCLUDES} ${KDE4WORKSPACE_INCLUDE_DIR})
+
+set(PLDLiveInstaller_SRCS
+    PLDLiveInstaller.cpp
+    DiskListWidget.cpp 
+    Updater.cpp
+    main.cpp
+)
+qt4_automoc(${PLDLiveInstaller_SRCS})
+add_executable(pldliveinstaller ${PLDLiveInstaller_SRCS})
+target_link_libraries(pldliveinstaller ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBS} 
+${KDE4_KDE3SUPPORT_LIBS} ${KDE4_KUTILS_LIBS} ${KDE4WORKSPACE_KWORKSPACE_LIBRARY} crypt)
+
+install(TARGETS pldliveinstaller ${INSTALL_TARGETS_DEFAULT_ARGS})

Added: PLDLiveInstaller/branches/0.2/DiskListWidget.cpp
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.2/DiskListWidget.cpp	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,85 @@
+#include "DiskListWidget.h"
+
+#include <KDebug>
+
+#include <Solid/Device>
+#include <Solid/DeviceInterface>
+#include <Solid/StorageDrive>
+#include <Solid/Block>
+	
+DiskListWidget::DiskListWidget( QWidget *parent )
+  : QListWidget( parent )
+{
+
+}
+
+DiskListWidget::~DiskListWidget()
+{
+}
+
+void DiskListWidget::refresh()
+{
+    //setCurrentItem(NULL);
+    setSelectionMode(QAbstractItemView::SingleSelection);
+    
+    if (diskListAlreadyOnList.size() <= 0)
+    {
+      devhash = new QHash<QString,Solid::Device>;
+      parthash = new QHash<QString,Solid::Device>;
+    }
+    
+    QStringList solidDevice;
+    solidDevice.append(diskListAlreadyOnList);
+    
+    //get a list of all storage volumes
+    QList<Solid::Device> list = Solid::Device::listFromType(Solid::DeviceInterface::StorageDrive, QString());
+    foreach (Solid::Device device, list)
+    {
+      if(device.is<Solid::StorageDrive>())
+      {
+	QString dev = device.as<Solid::Block>()->device();
+	
+	if (solidDevice.contains(dev))
+	{
+	  solidDevice.removeOne(dev);
+	} else {
+	
+	Solid::StorageDrive *harddisk = device.as<Solid::StorageDrive>();
+	if(((harddisk->driveType()==Solid::StorageDrive::HardDisk) || (harddisk->driveType()==Solid::StorageDrive::MemoryStick)))
+	{
+	  QString text = device.product() + " (" + dev + ")"; 
+	  QListWidgetItem *listitem = new QListWidgetItem;
+	  if ((harddisk->driveType()==Solid::StorageDrive::MemoryStick) || harddisk->isRemovable())
+	    listitem->setIcon(KIcon("drive-removable-media-usb").pixmap(64));
+	  else
+	    listitem->setIcon(KIcon("drive-harddisk").pixmap(64));
+	  listitem->setText(text);
+	  listitem->setToolTip(dev);
+	  addItem(listitem);
+	  devhash->insert(text,device);
+	  diskListAlreadyOnList.append(dev);
+	  qDebug() << "Product: " << device.product() << "Vendor: " << device.vendor() 
+	  << "Description: " << device.description() << "Dev: " << dev
+	  << "Type: " << harddisk->driveType();
+	  
+	   foreach (Solid::Device partDev, Solid::Device::listFromType(Solid::DeviceInterface::Block, device.udi() ))
+	   {
+	    QString part = partDev.as<Solid::Block>()->device();
+	    parthash->insert(part, partDev);
+	    //qDebug() << "has partition: " << part;
+	  }
+	  
+	}
+      }
+      }
+    }
+    foreach(QString soldev, solidDevice) {
+      takeItem(row(findItems(".*"+soldev+".*",Qt::MatchRegExp)[0]));
+      foreach(QString devDescr, diskListAlreadyOnList) {
+	if (devDescr.contains(soldev))
+	  diskListAlreadyOnList.removeAll(devDescr);
+      }
+    }
+}
+
+#include "DiskListWidget.moc"

Added: PLDLiveInstaller/branches/0.2/DiskListWidget.h
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.2/DiskListWidget.h	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,34 @@
+#ifndef DiskListWidget_H
+#define DiskListWidget_H
+
+#include <QCheckBox>
+#include <QLineEdit>
+#include <QListWidgetItem>
+#include <QProgressBar>
+#include <KAssistantDialog>
+#include <KDialog>
+#include <KAboutData>
+#include <QHash>
+#include <Solid/Device>
+
+class DiskListWidget;
+
+class DiskListWidget : public QListWidget
+{
+
+    Q_OBJECT
+
+    QStringList diskList;
+    QStringList diskListAlreadyOnList;
+
+public:
+    DiskListWidget( QWidget * parent = 0 );
+    QListWidgetItem *listitem;
+    QHash<QString,Solid::Device> * devhash, * parthash;
+    virtual ~DiskListWidget();
+    
+public Q_SLOTS:
+    void refresh();
+};
+
+#endif // DiskListWidget_H

Added: PLDLiveInstaller/branches/0.2/PLDLiveInstaller.cpp
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.2/PLDLiveInstaller.cpp	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,1827 @@
+#include "PLDLiveInstaller.h"
+#include "DiskListWidget.h"
+
+#include <QApplication>
+#include <QDir>
+#include <QFile>
+#include <QLabel>
+#include <QListWidget>
+#include <QMessageBox>
+#include <QPalette>
+#include <QProcess>
+#include <QProgressBar>
+#include <QRegExp>
+#include <QTabWidget>
+#include <QTextStream>
+#include <QVBoxLayout>
+
+#include <KActionMenu>
+#include <KComboBox>
+#include <KDebug>
+#include <KLocale>
+#include <KPushButton>
+#include <KService>
+#include <KServiceTypeTrader>
+#include <KStandardDirs>
+#include <KTitleWidget>
+#include <KVBox>
+#include <kworkspace/kworkspace.h>
+#include <Solid/Device>
+#include <Solid/DeviceInterface>
+#include <Solid/StorageDrive>
+#include <Solid/StorageVolume>
+#include <Solid/StorageAccess>
+#include <Solid/Block>
+
+#define SOURCE "/"
+#define DESTINATION "/mnt/pldlivechroot/"
+#define LIVEUSER "plduser"
+
+PLDLiveInstaller::PLDLiveInstaller( QWidget *parent )
+  : KAssistantDialog( parent )
+{
+    setPlainCaption(i18n("PLD Live Installer"));
+    setFixedSize(800,600);
+    showButton(KDialog::Help, false);
+    showButton(KDialog::Cancel, false);
+    showButton(KDialog::User1, false);
+   
+    // Start
+    startPage = addPage(startWidget(), i18n(""));
+    
+    // Partition
+    setAppropriate(partitionPage, false);
+
+    // Select destination drive
+    selectDiskPage = addPage(selectDiskWidget(), i18n(""));
+    setValid(selectDiskPage, false);
+    
+    //Select partitions
+    selectPartitionsPage = addPage(selectPartitionsWidget(), i18n(""));
+    setValid(selectPartitionsPage, false);
+    
+    // Create user account
+    createUserPage = addPage(createUserWidget(), i18n(""));
+    setValid(createUserPage,false);
+    
+    // Copy files to DEST root
+    installingPage = addPage(installingWidget(), i18n(""));
+    if (pbar->value()!=100) setValid(installingPage, false);
+    
+    // Finish
+    finishPage = addPage(finishWidget(), i18n(""));
+    setAppropriate(finishPage, false);
+    
+    // Fail
+    failedPage = addPage(failedWidget(), i18n(""));
+    setAppropriate(failedPage, false);
+}
+
+PLDLiveInstaller::~PLDLiveInstaller()
+{
+}
+
+QWidget * PLDLiveInstaller::startWidget()
+{
+    KTitleWidget *titleWidget = new KTitleWidget(this);
+    titleWidget->setText(i18n("<html><p align=\"center\"><font size=\"10\"><b>Install PLD Linux</b></font><br /><br />"
+	  "<font size=\"5\"><b>To set up the installation of PLD Linux, click Next</b></font>"
+	  "</p></html>"));
+	  
+    QLabel *text = new QLabel(this);
+    text->setText(i18n("<html><p align=\"center\">"
+    "The content of this Live CD will be copied to your hard drive. You will be able to choose a disk or partition<br />"
+    "and create a user. After the installtion is complete you can safely reboot your computer."
+    "</p>"
+    "<p align=\"justify\">"
+    "<strong>Please note!</strong><br/>Partitioning is not yet available. It takes it's time to develop a clear and intuitive way "
+    "for the user to partition their disks. Please use a standalone partitioning tool like <i>partitionmanager</i> or <i>fdisk</i> before "
+    "running the installer."
+    "</p>"
+    "</html>"
+    ));
+    text->setAlignment(Qt::AlignCenter);
+    text->setWordWrap(true);
+    
+    QVBoxLayout *textLayout = new QVBoxLayout;
+    textLayout->addWidget(text);
+   
+    QVBoxLayout *layout = new QVBoxLayout;
+    layout->addWidget(titleWidget);
+    layout->addLayout(textLayout);
+    layout->setMargin(30);
+    
+    QWidget *widget = new QWidget;
+    widget->setLayout(layout);
+    widget->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
+    //setMainWidget(widget);
+    return widget;
+}
+
+void PLDLiveInstaller::isDiskItemSelected()
+{
+  qDebug() << diskListWidget->currentItem()->text() << "was selected";
+  setValid(selectDiskPage, true);
+  selectedDisk = diskListWidget->currentItem();
+  selectedBlockDev = diskListWidget->devhash->value(selectedDisk->text());
+  selHDDisRem = selectedBlockDev.as<Solid::StorageDrive>()->isRemovable();
+  qDebug() << "selHDD in isDIsk..." << selHDDisRem;
+  defimage->setVisible(false);
+  if (selHDDisRem)
+  {
+    image2->setVisible(true);
+    image->setVisible(false);
+  }
+  else
+  {
+    image->setVisible(true);
+    image2->setVisible(false);
+  }
+}
+
+void PLDLiveInstaller::isRootPartitionSelected(int pos)
+{
+  qDebug() << "rootPart Position: " << pos;
+  rootPartPos=pos;
+  if (pos!=0)
+  {
+    QString sizeText;
+    qlonglong minSize = 3072;
+    destPartition=diskListWidget->parthash->value(availablePartitions[pos-1]);
+    qlonglong curSize = destPartition.as<Solid::StorageVolume>()->size()/1024/1024; //MB
+    QString size = QString::number(curSize);
+    if(curSize < minSize)
+    {
+      setValid(selectPartitionsPage, false);
+      sizeText = "Size: " + size + "MB";
+      devSizeInfo->setText("<html>"
+      "<strong>The device is too small for installation.</strong><br/>"
+      "You need at least " + QString::number(minSize) + "MB of free space."
+      "</html>");
+      devSizeInfoIcon->setVisible(true);
+      devSizeInfo->setVisible(true);
+      isPartBigEnough = false;
+    }
+    else {
+      devSizeInfoIcon->setVisible(false);
+      devSizeInfo->setVisible(false);
+      setValid(selectPartitionsPage, true);
+      isPartBigEnough = true;
+      sizeText = "Size: " + size + "MB<br />";
+    }
+    
+    selRoot=destPartition.as<Solid::Block>()->device();
+    
+    partDescr->setText("Partition details:<br />"
+		      "Device: " + selRoot + "<br />"
+		      //"File system type: " + destPartition.as<Solid::StorageVolume>()->fsType() + "<br />"
+		      + sizeText 
+		      //"Mountpoint: " + mountpoint + ""
+    );
+    
+    if(swapPartPos==rootPartPos)
+    {
+      samePartTwiceIcon->setVisible(true);
+      samePartTwice->setVisible(true);
+      setValid(selectPartitionsPage, false);
+    }
+    else
+    {
+      samePartTwiceIcon->setVisible(false);
+      samePartTwice->setVisible(false);
+      if(isPartBigEnough)
+	setValid(selectPartitionsPage, true);
+    }
+  }
+  else
+  {
+    samePartTwiceIcon->setVisible(false);
+    samePartTwice->setVisible(false);
+    devSizeInfoIcon->setVisible(false);
+    devSizeInfo->setVisible(false);
+    setValid(selectPartitionsPage, false);
+  }
+}
+
+void PLDLiveInstaller::isSwapPartitionSelected(int pos)
+{
+  qDebug() << "swapPart Position: " << pos;
+  swapPartPos=pos;
+  if (pos!=0)
+  {
+    destSwap=diskListWidget->parthash->value(availablePartitions[pos-1]);
+    selSwap=destSwap.as<Solid::Block>()->device();
+    memInfoIcon2->setVisible(false);
+    memInfo2->setVisible(false);
+    if(swapPartPos==rootPartPos)
+    {
+      samePartTwiceIcon->setVisible(true);
+      samePartTwice->setVisible(true);
+      setValid(selectPartitionsPage, false);
+    }
+    else
+    {
+      samePartTwiceIcon->setVisible(false);
+      samePartTwice->setVisible(false);
+      if(isPartBigEnough)
+	setValid(selectPartitionsPage, true);
+    }
+  }
+  else
+  {
+    if(!isRamEnough)
+    {
+      memInfoIcon2->setVisible(true);
+      memInfo2->setVisible(true);
+    }
+    samePartTwiceIcon->setVisible(false);
+    samePartTwice->setVisible(false);
+  }
+}
+
+void PLDLiveInstaller::isFsSelected(int pos)
+{
+  qDebug() << "FS type: " << fsTypes[pos];
+  selFS=fsTypes[pos];
+}
+
+void PLDLiveInstaller::reboot()
+{
+    //KWorkSpace::ShutdownConfirm confirm = KWorkSpace::ShutdownConfirmYes;
+    //KWorkSpace::ShutdownType type = KWorkSpace::ShutdownTypeReboot;
+    //KWorkSpace::ShutdownMode mode = KWorkSpace::ShutdownModeForceNow;
+    //KWorkSpace::requestShutDown(confirm, type, mode);
+    QProcess * proc = new QProcess(this);
+    proc->start("reboot");
+    proc->waitForFinished();
+    if(proc->exitCode() == 0)
+      KDialog::delayedDestruct();
+}
+
+void PLDLiveInstaller::close()
+{
+  KDialog::delayedDestruct();
+}
+
+QWidget * PLDLiveInstaller::selectDiskWidget()
+{   
+    KTitleWidget *titleWidget = new KTitleWidget(this);
+    titleWidget->setText(i18n("<html><p align=\"center\"><font size=\"10\"><b>Install PLD Linux</b></font><br /><br />"
+	  "<font size=\"5\"><b>Select the disk where you want PLD Linux<br /> to install and click Next.</b></font>"
+	  "</p></html>"));
+	  
+    KHBox *buttonBox = new KHBox(this);
+
+    diskListWidget = new DiskListWidget(this);
+    diskListWidget->setIconSize(QSize::QSize(48,48));
+    connect(diskListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(isDiskItemSelected()));
+    diskListWidget->refresh();
+
+    KPushButton *refresh = new KPushButton(KIcon("view-refresh"), i18n("Refresh list"), buttonBox);
+    refresh->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
+    refresh->setToolTip("Refresh device list");
+    refresh->setIconSize(QSize::QSize(22,22));
+    refresh->setFixedHeight(33);
+    connect(refresh, SIGNAL(clicked()), diskListWidget, SLOT(refresh()));
+    
+    defimage = new QLabel;
+    defimage->setPixmap(KIcon("media-optical").pixmap(128));
+    defimage->setAlignment(Qt::AlignLeft);
+    defimage->setVisible(true);
+    
+    image = new QLabel;
+    image->setPixmap(KIcon("drive-harddisk").pixmap(128));
+    image->setAlignment(Qt::AlignLeft);
+    image->setVisible(false);
+    
+    image2 = new QLabel;
+    image2->setPixmap(KIcon("drive-removable-media-usb").pixmap(128));
+    image2->setAlignment(Qt::AlignLeft);
+    image2->setVisible(false);
+    
+    QHBoxLayout *imageLayout = new QHBoxLayout;
+    imageLayout->addWidget(defimage);
+    imageLayout->addWidget(image);
+    imageLayout->addWidget(image2);
+	  
+    QLabel *text = new QLabel(this);
+    text->setText(i18n("<html><p align=\"left\">"
+    "The following disks are available:"
+    "</p></html>"
+    ));
+    text->setFixedHeight(40);
+    
+    QVBoxLayout *disksLayout = new QVBoxLayout;
+    disksLayout->addWidget(text);
+    disksLayout->addWidget(diskListWidget);
+    disksLayout->addWidget(buttonBox);
+    disksLayout->setSpacing(0);
+    
+    QHBoxLayout *midLayout = new QHBoxLayout;
+    midLayout->addLayout(imageLayout);
+    midLayout->addLayout(disksLayout);
+    midLayout->setMargin(50);
+    midLayout->setSpacing(20);
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(titleWidget);
+    layout->addLayout(midLayout);
+    layout->setMargin(0);
+    
+    QWidget *widget = new QWidget(this);
+    widget->setLayout(layout);
+    widget->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Maximum);
+    return widget;
+    
+}
+
+void PLDLiveInstaller::instBootLoaderIsChecked(int state)
+{
+  qDebug() << "Install boot loader?" << state;
+  installBootLoader = state;
+  if(!installBootLoader)
+    qDebug() << "Boot loader will be installed";
+  else
+    qDebug() << "No boot loader";
+}
+
+QWidget * PLDLiveInstaller::selectPartitionsWidget()
+{   
+    swapPartPos = 0;
+    rootPartPos = 0;
+    installBootLoader = false;
+    fsTypes << "ext4" << "ext3" << "ext2" << "xfs";
+    selFS=fsTypes[0];
+  
+    KTitleWidget *titleWidget = new KTitleWidget(this);
+    titleWidget->setText(i18n("<html><p align=\"center\"><font size=\"10\"><b>Install PLD Linux</b></font><br /><br />"
+	  "<font size=\"5\"><b>Select partitions where you want PLD Linux<br/> to install and click Next.</b></font>"
+	  "</p></html>"));
+	  
+    partImage = new QLabel;
+    partImage->setPixmap(KIcon("drive-harddisk").pixmap(128));
+    partImage->setAlignment(Qt::AlignLeft);
+    partImage->setVisible(false);
+    
+    partImage2 = new QLabel;
+    partImage2->setPixmap(KIcon("drive-removable-media-usb").pixmap(128));
+    partImage2->setAlignment(Qt::AlignLeft);
+    partImage2->setVisible(false);
+    
+    partDescr = new QLabel;
+    partDescr->setVisible(true);
+    partDescr->setAlignment(Qt::AlignLeft);
+    
+    QVBoxLayout *imageLayout = new QVBoxLayout;
+    imageLayout->addWidget(partImage);
+    imageLayout->addWidget(partImage2);
+    imageLayout->addWidget(partDescr);
+    
+    selectPartitionPageText = new QLabel(this);
+    rootPart = new KComboBox(this);
+    rootPart->setFixedWidth(200);
+    swapPart = new KComboBox(this);
+    swapPart->setFixedWidth(200);
+    connect(rootPart, SIGNAL(activated(int)), this, SLOT(isRootPartitionSelected(int)));
+    connect(swapPart, SIGNAL(activated(int)), this, SLOT(isSwapPartitionSelected(int)));
+    fs = new KComboBox(this);
+    fs->addItems(fsTypes);
+    fs->setCurrentItem("ext4");
+    connect(fs, SIGNAL(activated(int)), this, SLOT(isFsSelected(int)));
+    
+    QLabel *rootText = new QLabel;
+    rootText->setText("Root (/):");
+    rootText->setAlignment(Qt::AlignRight);
+    rootText->setFixedWidth(150);
+    
+    QLabel *swapText = new QLabel;
+    swapText->setText("Swap:");
+    swapText->setAlignment(Qt::AlignRight);
+    swapText->setFixedWidth(150);
+    
+    memInfo = new QLabel;
+    memInfo->setText("<html>"
+	  "You seem to have >= 2GB of RAM installed.<br/>"
+	  "You don't have to select a swap partition!"
+	  "<html>");
+    memInfo->setAlignment(Qt::AlignLeft);
+    memInfo->setMargin(10);
+    memInfo->setVisible(false);
+    
+    memInfo2 = new QLabel;
+    memInfo2->setText("<html>"
+	  "You seem to have &lt; 2GB of RAM installed.<br/>"
+	  "It is recommended that you select a swap partition!"
+	  "<html>");
+    memInfo2->setAlignment(Qt::AlignLeft);
+    memInfo2->setMargin(10);
+    memInfo2->setVisible(false);
+    
+    memInfoIcon = new QLabel;
+    memInfoIcon->setPixmap(KIcon("dialog-information").pixmap(32));
+    memInfoIcon->setAlignment(Qt::AlignRight);
+    memInfoIcon->setVisible(false);
+    
+    memInfoIcon2 = new QLabel;
+    memInfoIcon2->setPixmap(KIcon("dialog-warning").pixmap(32));
+    memInfoIcon2->setAlignment(Qt::AlignRight);
+    memInfoIcon2->setVisible(false);
+    
+    devSizeInfo = new QLabel;
+    devSizeInfo->setAlignment(Qt::AlignLeft);
+    devSizeInfo->setMargin(10);
+    devSizeInfo->setVisible(false);
+    
+    devSizeInfoIcon = new QLabel;
+    devSizeInfoIcon->setPixmap(KIcon("dialog-error").pixmap(32));
+    devSizeInfoIcon->setAlignment(Qt::AlignRight);
+    devSizeInfoIcon->setVisible(false);
+    
+    samePartTwice = new QLabel;
+    samePartTwice->setText("<html>"
+    "You've selected the same partition twice!"
+    "</html>");
+    samePartTwice->setAlignment(Qt::AlignLeft);
+    samePartTwice->setMargin(10);
+    samePartTwice->setVisible(false);
+    
+    samePartTwiceIcon = new QLabel;
+    samePartTwiceIcon->setPixmap(KIcon("dialog-error").pixmap(32));
+    samePartTwiceIcon->setAlignment(Qt::AlignRight);
+    samePartTwiceIcon->setVisible(false);
+    
+    QCheckBox *instBootLoader = new QCheckBox("Don't install GRUB boot loader on the root device.");
+    instBootLoader->setCheckState(Qt::Unchecked);
+    instBootLoader->setChecked(false);    
+    connect(instBootLoader, SIGNAL(stateChanged(int)), this, SLOT(instBootLoaderIsChecked(int)));
+    
+    QHBoxLayout *instBlLayout = new QHBoxLayout;
+    instBlLayout->addWidget(instBootLoader);
+    instBlLayout->setMargin(0);
+    
+    QHBoxLayout *memInfoLayout = new QHBoxLayout;
+    memInfoLayout->addWidget(memInfoIcon);
+    memInfoLayout->addWidget(memInfo);
+    memInfoLayout->addWidget(memInfoIcon2);
+    memInfoLayout->addWidget(memInfo2);
+    memInfoLayout->setAlignment(Qt::AlignLeft);
+    memInfoLayout->setMargin(0);
+    
+    QHBoxLayout *devSizeLayout = new QHBoxLayout;
+    devSizeLayout->addWidget(devSizeInfoIcon);
+    devSizeLayout->addWidget(devSizeInfo);
+    devSizeLayout->setAlignment(Qt::AlignLeft);
+    devSizeLayout->setMargin(0);
+    
+    QHBoxLayout *samePartTwiceLayout = new QHBoxLayout;
+    samePartTwiceLayout->addWidget(samePartTwiceIcon);
+    samePartTwiceLayout->addWidget(samePartTwice);
+    samePartTwiceLayout->setAlignment(Qt::AlignLeft);
+    samePartTwiceLayout->setMargin(0);
+    
+    QHBoxLayout *rootLayout = new QHBoxLayout;
+    rootLayout->addWidget(rootText);
+    rootLayout->addWidget(rootPart);
+    rootLayout->addWidget(fs);
+    rootLayout->addStretch();
+    
+    QHBoxLayout *swapLayout = new QHBoxLayout;
+    swapLayout->addWidget(swapText);
+    swapLayout->addWidget(swapPart);
+    swapLayout->addStretch();
+    
+    QVBoxLayout *disksLayout = new QVBoxLayout;
+    disksLayout->addWidget(selectPartitionPageText);
+    disksLayout->addLayout(rootLayout);
+    disksLayout->addLayout(swapLayout);
+    disksLayout->addLayout(memInfoLayout);
+    disksLayout->addLayout(devSizeLayout);
+    disksLayout->addLayout(samePartTwiceLayout);
<<diff output has been trimmed to 500 lines, 1328 line(s) remained.>>

Added: PLDLiveInstaller/branches/0.2/PLDLiveInstaller.h
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.2/PLDLiveInstaller.h	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,95 @@
+#ifndef PLDLiveInstaller_H
+#define PLDLiveInstaller_H
+
+#include <QCheckBox>
+#include <QLineEdit>
+#include <QListWidgetItem>
+#include <QProgressBar>
+#include <KComboBox>
+#include <KAssistantDialog>
+#include <KDialog>
+#include <KAboutData>
+#include <QHash>
+#include <Solid/Device>
+#include <Solid/StorageDrive>
+#include <Solid/StorageVolume>
+#include <QLabel>
+#include <QPushButton>
+
+#include "DiskListWidget.h"
+
+class KCMultiDialog;
+
+class PLDLiveInstaller : public KAssistantDialog
+{
+
+    Q_OBJECT
+
+    KCMultiDialog *partitionDialog;
+    KPageWidgetItem *startPage;
+    KPageWidgetItem *partitionPage;
+    KPageWidgetItem *selectDiskPage;
+    KPageWidgetItem *selectPartitionsPage;
+    KPageWidgetItem *createUserPage;
+    KPageWidgetItem *installingPage;
+    KPageWidgetItem *finishPage;
+    KPageWidgetItem *failedPage;
+
+    QWidget * kcmLayout(KCMultiDialog* dialog);
+    QWidget * kcmLayout(QWidget* widget);
+    QWidget * startWidget();
+    QWidget * selectDiskWidget();
+    QWidget * selectPartitionsWidget();
+    QWidget * createUserWidget();
+    QWidget * installingWidget();
+    QWidget * finishWidget();
+    QWidget * failedWidget();
+    QProgressBar *pbar, *pwStrengthMeter;
+    QPushButton *install;
+    QLineEdit *username, *password, *password2, *hostname, *usercredentials;
+    DiskListWidget *diskListWidget;
+    QListWidgetItem * selectedDisk;
+    Solid::Device selectedBlockDev, destPartition, destSwap;
+    QLabel *selectPartitionPageText, *installationText, *installationHeader, *failText, *memInfo, *memInfoIcon;
+    QLabel *memInfo2, *memInfoIcon2, *devSizeInfo, *devSizeInfoIcon, *samePartTwice, *samePartTwiceIcon;
+    QStringList availablePartitions, fsTypes;
+    KComboBox * rootPart,* swapPart, * fs;
+    int rootPartPos, swapPartPos, pbarVal;
+    bool selHDDisRem, isPartBigEnough, isRamEnough, installBootLoader, pwMatch, userSet;
+    QLabel *defimage, *image, *image2, *partImage, *partImage2, *partDescr;
+    QString selFS, selUser, selPasswd, selHostname, failReason, selRoot, selSwap, selCred;
+    int isMounted(Solid::Device partition);
+    bool mountDev(Solid::Device partition), umountDev(Solid::Device partition);
+    bool copyData(QString src,QString dest);
+    void getData(QString src, QString dest);
+    bool makeFS(Solid::Device partition), makeSwap(Solid::Device partition);
+    void updateProgressBar();
+    char * genPasswd();
+    bool makeGrubConfig(), installGrub(), geninitrd(), mountProcSysDev(), umountProcSysDev();
+    void move2dest(QString from, QString to), renameConfigFiles(), delUtmpx();
+    bool createHostname(), createFstabEntries(), createUser(), copySettings(QString file), deleteLiveUser();
+    int getMemoryAmount();
+    int effectivePasswordLength(const QString& password);
+    
+public:
+    PLDLiveInstaller( QWidget * parent = 0 );
+    virtual ~PLDLiveInstaller();
+        
+public Q_SLOTS:
+    virtual void back();
+    virtual void next();
+    void reboot();
+    void close();
+    void installation();
+    void isDiskItemSelected();
+    void isRootPartitionSelected(int pos);
+    void isSwapPartitionSelected(int pos);
+    void isFsSelected(int pos);
+    void isUserEntered();
+    void instBootLoaderIsChecked(int state);
+    void checkPwStrength();
+    void checkPwMatch();
+    
+};
+
+#endif // PLDLiveInstaller_H

Added: PLDLiveInstaller/branches/0.2/PLDLiveInstaller.kdev4
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.2/PLDLiveInstaller.kdev4	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,3 @@
+[Project]
+Manager=KDevCMakeManager
+Name=PLDLiveInstaller

Added: PLDLiveInstaller/branches/0.2/Updater.cpp
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.2/Updater.cpp	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,351 @@
+#include "Updater.h"
+#include "PLDLiveInstaller.h"
+#include "Version.h"
+
+#include <KTitleWidget>
+#include <KLocale>
+
+#include <QDateTime>
+#include <QDebug>
+#include <QDir>
+#include <QLabel>
+#include <QMessageBox>
+#include <QString>
+#include <QTextEdit>
+#include <QTextStream>
+#include <QUrl>
+#include <QVBoxLayout>
+
+Updater::Updater(QWidget* parent) : QObject(parent)
+{
+}
+
+Updater::~Updater()
+{
+}
+
+bool Updater::shouldWeCheckForUpdate()
+{
+  QFile *lastChecked = new QFile(QDir::homePath() + "/.config/pliLastChecked");
+  QDateTime *datetime = new QDateTime;
+  if(lastChecked->exists())
+  {
+    if (!lastChecked->open(QIODevice::ReadWrite))
+    {
+      qDebug() << "Couldn't open last check file";
+      delete lastChecked;
+      lastChecked = 0;
+      return true;
+    }
+    else
+    {
+      QTextStream in(lastChecked);
+      qlonglong line = in.readLine().toLongLong();
+      //qDebug() << "line:" << line;
+      int difference = datetime->currentDateTime().toTime_t() - line;
+      if (difference >= 2592000) // about a month
+      {
+	lastChecked->close();
+	lastChecked->remove();
+	if(lastChecked->open(QIODevice::WriteOnly))
+	{
+	  QTextStream out(lastChecked);
+	  out << datetime->currentDateTime().toTime_t() << "\n";
+	  lastChecked->close();
+	  return true;
+	}
+      }
+      else
+      {
+	lastChecked->close();
+	return false;
+      }
+    }
+  }
+  else
+  {
+    if (lastChecked->open(QIODevice::WriteOnly))
+    {
+      QTextStream out(lastChecked);
+      out << datetime->currentDateTime().toTime_t() << "\n";
+      lastChecked->close();
+      qDebug() << "Wrote last checked";
+      return true;
+    }
+  }
+}
+
+void Updater::startInstaller()
+{
+  PLDLiveInstaller * start = new PLDLiveInstaller;
+  start->setCaption("PLD Live Installer");
+  start->exec();
+}
+
+void Updater::getLatestVersion()
+{
+  if(shouldWeCheckForUpdate())
+  {
+    QString fileName = "/tmp/installerUpdate.xml";
+    QUrl url("http://pldliveinstaller.pld-linux.org/installerUpdate.xml");
+    if (QFile::exists(fileName))
+      QFile::remove(fileName);
+    tmpfile = new QFile(fileName);
+    if (tmpfile->isOpen())
+      tmpfile->close();
+    if (!tmpfile->open(QIODevice::WriteOnly)) {
+      qDebug() << "Couldn't save XML file";
+      delete tmpfile;
+      tmpfile = 0;
+      return;
+    }
+    
+    http = new QHttp;
+    http->setHost(url.host(), url.port(80));
+    httpRequestAborted = false;
+    httpGetId = http->get(url.path(), tmpfile);
+    connect(http, SIGNAL(requestFinished(int,bool)), this, SLOT(httpGetFinished(int, bool)));
+    connect(http, SIGNAL(readyRead(QHttpResponseHeader)), this, SLOT(readResponseHeader(const QHttpResponseHeader &)));
+    qDebug() << "httpGetId: " << httpGetId;
+  }
+  else
+    startInstaller();
+}
+
+void Updater::httpGetFinished(int requestId, bool error)
+{
+  if (requestId != httpGetId)
+    return;
+  
+  tmpfile->close();
+  if(error)
+    tmpfile->remove();
+  qDebug() << "Closed connection";
+  checkForUpdate();
+}
+
+void Updater::readResponseHeader(const QHttpResponseHeader &responseHeader)
+{
+  if(responseHeader.statusCode() != 200)
+  {
+    http->abort();
+    qDebug() << "response header:" << responseHeader.statusCode();
+  }
+}
+
+void Updater::checkForUpdate()
+{
+  int pos = 0;
+  updateAvailable = false;
+    qDebug() << "Start checking for update";
+    if (!tmpfile->open(QIODevice::ReadOnly | QIODevice::Text))
+    {
+	qDebug() << "Couldn't read update XML";
+	return;
+    }
+    QXmlStreamReader xml(tmpfile);
+    if(xml.hasError()) {
+      qDebug() << "Has error" << xml.errorString(); 
+    }
+    while(!xml.atEnd())
+    {
+      xml.readNext();
+      if(xml.isStartDocument())
+	continue;
+      if(xml.isStartElement() && xml.name() == "file")
+      {
+	QXmlStreamAttributes attrs = xml.attributes();
+	versions.append(attrs.value("version").toString());
+	kdevers.append(attrs.value("kdever").toString());
+	hashes.append(attrs.value("hash").toString());
+      }
+      if(xml.isStartElement() && xml.name() == "changelog")
+      {
+	while(!xml.isEndElement())
+	{
+	  xml.readNext();
+	  if(xml.isCDATA())
+	    changeLogs.append(xml.text().toString());
+	}
+      }
+    }
+    xml.clear();
+    tmpfile->close();
+    tmpfile->remove();
+    foreach (QString v, versions)
+    {
+      if((v.toDouble() > QString(VERSION).toDouble()) && 
+	(kdevers.value(pos).toDouble() == QString(KDEVER).toDouble()))
+      {
+	latestVer = v;
+	kdeBuildVer = kdevers.value(pos);
+	md5sum = hashes.value(pos);
+	changeLogText = changeLogs.value(pos);
+	qDebug() << v << kdevers.value(pos);
+	updateAvailable = true;
+      }
+      pos++;
+    }
+    if(updateAvailable)
+      updateDialog();
+    else
+      startInstaller();
+}
+
+void Updater::updateDialog()
+{
+  UpdateNotification * notify = new UpdateNotification;
+  notify->setCaption("Update Available");
+  notify->setVersion(latestVer);
+  notify->setMd5(md5sum);
+  notify->setKdever(kdeBuildVer);
+  notify->setChangeLog(changeLogText);
+  notify->start();
+}
+
+UpdateNotification::UpdateNotification(QWidget* parent) : KDialog(parent)
+{
+  
+}
+
+UpdateNotification::~UpdateNotification()
+{
+}
+
+void UpdateNotification::setVersion(QString v)
+{
+  latestVer = v;
+}
+
+void UpdateNotification::setMd5(QString h)
+{
+  md5sum = h;
+}
+
+void UpdateNotification::setChangeLog(QString c)
+{
+  changeLogText = c;
+}
+
+void UpdateNotification::setKdever(QString v)
+{
+  kdever = v;
+}
+
+QString UpdateNotification::getVersion()
+{
+  return latestVer;
+}
+
+QString UpdateNotification::getMd5()
+{
+  return md5sum;
+}
+
+QString UpdateNotification::getKdever()
+{
+  return kdever;
+}
+
+void UpdateNotification::startInstaller()
+{
+  delayedDestruct();
+  PLDLiveInstaller * start = new PLDLiveInstaller;
+  start->setCaption("PLD Live Installer");
+  start->exec();
+}
+
+QWidget * UpdateNotification::start()
+{
+  setFixedSize(300,240);
+  setButtons(User1 | Cancel);
+  setButtonGuiItem(User1 , KGuiItem( i18n( "Download and Update" ), "task-recurring", i18n("Download and Update")));
+  connect(this, SIGNAL(cancelClicked()), this, SLOT(startInstaller()));
+  connect(this, SIGNAL(user1Clicked()), this, SLOT(getUpdate()));
+  showButtonSeparator(true);
+
+  KTitleWidget *titleWidget = new KTitleWidget(this);
+  titleWidget->setText("<html><font size=\"3\">"
+    "Version " + getVersion() + " is available for update.<br/>"
+    "Release Notes:"
+    "</font></html>");
+  
+  QTextEdit * changeLog = new QTextEdit;
+  changeLog->setReadOnly(true);
+  changeLog->insertHtml(changeLogText);
+    
+  QVBoxLayout *mainLayout = new QVBoxLayout;
+  mainLayout->addWidget(titleWidget);
+  mainLayout->addWidget(changeLog);
+  mainLayout->setMargin(0);
+
+  QWidget *mainWidget = new QWidget;
+  mainWidget->setLayout(mainLayout);
+  mainWidget->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
+
+  setMainWidget(mainWidget);
+  this->exec();
+}
+
+void UpdateNotification::getUpdate()
+{
+  QString fileName = "/sbin/pldliveinstaller";
+  QString uurl = "http://pldliveinstaller.pld-linux.org/updates/" + getKdever() + "/" + getVersion() + "/pldliveinstaller";
+  QUrl url(uurl);
+  if (QFile::exists(fileName))
+    QFile::remove(fileName);
+  binfile = new QFile(fileName);
+  if (binfile->isOpen())
+    binfile->close();
+  if (!binfile->open(QIODevice::WriteOnly)) {
+    qDebug() << "Couldn't save installer binary file";
+    delete binfile;
+    binfile = 0;
+    return;
+  }
+    
+  http = new QHttp;
+  http->setHost(url.host(), url.port(80));
+  httpRequestAborted = false;
+  httpGetId = http->get(url.path(), binfile);
+  connect(http, SIGNAL(requestFinished(int,bool)), this, SLOT(httpGetFinished(int, bool)));
+  connect(http, SIGNAL(readyRead(QHttpResponseHeader)), this, SLOT(readResponseHeader(const QHttpResponseHeader &)));
+  qDebug() << "httpGetId: " << httpGetId;
+}
+
+void UpdateNotification::httpGetFinished(int requestId, bool error)
+{
+  if (requestId != httpGetId)
+    return;
+  
+  binfile->close();
+  if(error)
+  {
+    binfile->remove();
+    QMessageBox::information(this, "The update failed!",
+			 "The update failed!"
+			 "<br />No internet connection to update server!<br />",
+			 QMessageBox::Close);
+  }
+  else
+  {
+    delayedDestruct();
+    binfile->setPermissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner | QFile::ReadGroup | QFile::ReadOther);
+    QMessageBox::information(this, "The update was successful!",
+			 "The update was successful!"
+			 "<br />Please restart the installer.",
+			 QMessageBox::Close);
+  }
+  qDebug() << "Closed connection";
+}
+
+void UpdateNotification::readResponseHeader(const QHttpResponseHeader &responseHeader)
+{
+  if(responseHeader.statusCode() != 200)
+  {
+    http->abort();
+    qDebug() << "response header:" << responseHeader.statusCode();
+  }
+}
+
+#include "Updater.moc"
\ No newline at end of file

Added: PLDLiveInstaller/branches/0.2/Updater.h
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.2/Updater.h	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,73 @@
+#ifndef UPDATER_H
+#define UPDATER_H
+
+#include <KDialog>
+
+#include <QProgressBar>
+#include <QFile>
+#include <QHttp>
+#include <QHttpResponseHeader>
+#include <QList>
+#include <QXmlStreamReader>
+#include <QMap>
+
+class Updater : QObject
+{
+  Q_OBJECT
+  
+  QProgressBar * updateBar;
+  void checkForUpdate();
+  
+  public:
+    void getLatestVersion();
+    Updater( QWidget * parent = 0 );
+    virtual ~Updater();
+  
+  public Q_SLOTS:
+    void startInstaller();
+    void httpGetFinished(int requestId, bool error);
+    void readResponseHeader(const QHttpResponseHeader &responseHeader);
+    
+  private:
+    QHttp * http;
+    QFile * tmpfile;
+    QStringList versions, kdevers, hashes, changeLogs;
+    QString latestVer, kdeBuildVer, md5sum, changeLogText;
+    int httpGetId;
+    bool httpRequestAborted, updateAvailable;
+    void updateDialog();
+    bool shouldWeCheckForUpdate();
+  
+};
+
+class UpdateNotification : public KDialog
+{
+  Q_OBJECT
+  
+  public:
+    UpdateNotification(QWidget* parent = 0);
+    virtual ~UpdateNotification();
+    void setVersion(QString);
+    void setMd5(QString);
+    void setChangeLog(QString);
+    void setKdever(QString);
+    QString getVersion();
+    QString getMd5();
+    QString getKdever();
+    QWidget * start();
+    
+  public Q_SLOTS:
+    void startInstaller();
+    void getUpdate();
+    void httpGetFinished(int requestId, bool error);
+    void readResponseHeader(const QHttpResponseHeader &responseHeader);
+    
+  private:
+    QString latestVer, md5sum, changeLogText, kdever;
+    QHttp *http;
+    QFile * binfile;
+    int httpGetId;
+    bool httpRequestAborted;
+};
+
+#endif // UPDATER_H

Added: PLDLiveInstaller/branches/0.2/Version.h
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.2/Version.h	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,3 @@
+#define	VERSION "0.2"
+#define VERSION_STR "Version " VERSION
+#define KDEVER "4.5"

Added: PLDLiveInstaller/branches/0.2/installerUpdate.xml
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.2/installerUpdate.xml	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<pldliveinstaller>
+	<app>	
+		<file name="pldliveinstaller" version="0.2" kdever="4.5" hash="6a82c37ea0a5be5d0a08aa987d540b96"></file>
+		<changelog>
+<![CDATA[
+<html>
+Version 0.2 adresses the following issues:<br>
+Bug fixes:
+<ul>
+<li>costam 1</li>
+<li>costam 2</li>
+</ul>
+<html>
+]]>
+		</changelog>
+	</app>
+	<app>
+		<file name="pldliveinstaller" version="0.3" kdever="4.6" hash="6a82c37ea0a5be5d0a08aa987d540b96"></file>
+		<changelog>
+<![CDATA[
+<html>
+Version 0.3 adresses the following issues:<br>
+Bug fixes:
+<ul>
+<li>costam 3</li>
+<li>costam 4</li>
+</ul>
+<html>
+]]>
+		</changelog>
+	</app>
+</pldliveinstaller>

Added: PLDLiveInstaller/branches/0.2/main.cpp
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.2/main.cpp	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,35 @@
+#include <KApplication>
+#include <KCmdLineArgs>
+#include <KAboutData>
+#include <KLocale>
+#include "PLDLiveInstaller.h"
+#include "Updater.h"
+#include "Version.h"
+
+void fillAboutData(KAboutData& aboutData);
+
+int main(int argc, char** argv)
+{
+  
+    KAboutData aboutData( "PLDLiveInstaller", "PLD Live Installer", ki18n(VERSION_STR),
+			  VERSION, ki18n("Live Installer"), KAboutData::License_GPL);
+			  
+    fillAboutData(aboutData);
+  
+    KCmdLineArgs::init( argc, argv, &aboutData );
+  
+    KApplication app;
+    //PLDLiveInstaller * start = new PLDLiveInstaller();
+    //start->setCaption("PLD Live Installer");
+    //start->show();
+    Updater * update = new Updater;
+    update->getLatestVersion();
+    
+    return app.exec();
+}
+
+void fillAboutData(KAboutData& aboutData)
+{
+  aboutData.setProgramIconName("tools-wizard");
+  aboutData.addAuthor(ki18n("Bartosz Świątek"), ki18n("Maintainer, Qt4"), "shadzik at pld-linux.org");
+}
\ No newline at end of file

Added: PLDLiveInstaller/branches/0.2/scripts/getxatakmod.sh
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/branches/0.2/scripts/getxatakmod.sh	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+for class in 0106 0107 0100 0101; do
+	module="$module $(lspci -n |grep $class |sed 's/:/ /g' |while read junk junk class vendor device junk; do grep "0x0000$vendor 0x0000$device" /lib/modules/$(uname -r)/modules.pcimap |awk '{print $1}'; done |uniq)"
+done
+
+echo $module

Added: PLDLiveInstaller/trunk/CMakeLists.txt
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/trunk/CMakeLists.txt	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,24 @@
+project(PLDLiveInstaller)
+cmake_minimum_required(VERSION 2.6)
+set (QT_MIN_VERSION "4.7.0")
+find_package(Qt4 REQUIRED)
+find_package(KDE4 REQUIRED)
+find_package(KDE4Workspace REQUIRED)
+include (KDE4Defaults)
+
+set(CMAKE_CXX_FLAGS "-O2 -g -fexceptions")
+
+include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${KDE4_INCLUDES} ${KDE4WORKSPACE_INCLUDE_DIR})
+
+set(PLDLiveInstaller_SRCS
+    PLDLiveInstaller.cpp
+    DiskListWidget.cpp 
+    Updater.cpp
+    main.cpp
+)
+qt4_automoc(${PLDLiveInstaller_SRCS})
+add_executable(pldliveinstaller ${PLDLiveInstaller_SRCS})
+target_link_libraries(pldliveinstaller ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBS} 
+${KDE4_KDE3SUPPORT_LIBS} ${KDE4_KUTILS_LIBS} ${KDE4WORKSPACE_KWORKSPACE_LIBRARY} crypt)
+
+install(TARGETS pldliveinstaller ${INSTALL_TARGETS_DEFAULT_ARGS})

Added: PLDLiveInstaller/trunk/DiskListWidget.cpp
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/trunk/DiskListWidget.cpp	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,85 @@
+#include "DiskListWidget.h"
+
+#include <KDebug>
+
+#include <Solid/Device>
+#include <Solid/DeviceInterface>
+#include <Solid/StorageDrive>
+#include <Solid/Block>
+	
+DiskListWidget::DiskListWidget( QWidget *parent )
+  : QListWidget( parent )
+{
+
+}
+
+DiskListWidget::~DiskListWidget()
+{
+}
+
+void DiskListWidget::refresh()
+{
+    //setCurrentItem(NULL);
+    setSelectionMode(QAbstractItemView::SingleSelection);
+    
+    if (diskListAlreadyOnList.size() <= 0)
+    {
+      devhash = new QHash<QString,Solid::Device>;
+      parthash = new QHash<QString,Solid::Device>;
+    }
+    
+    QStringList solidDevice;
+    solidDevice.append(diskListAlreadyOnList);
+    
+    //get a list of all storage volumes
+    QList<Solid::Device> list = Solid::Device::listFromType(Solid::DeviceInterface::StorageDrive, QString());
+    foreach (Solid::Device device, list)
+    {
+      if(device.is<Solid::StorageDrive>())
+      {
+	QString dev = device.as<Solid::Block>()->device();
+	
+	if (solidDevice.contains(dev))
+	{
+	  solidDevice.removeOne(dev);
+	} else {
+	
+	Solid::StorageDrive *harddisk = device.as<Solid::StorageDrive>();
+	if(((harddisk->driveType()==Solid::StorageDrive::HardDisk) || (harddisk->driveType()==Solid::StorageDrive::MemoryStick)))
+	{
+	  QString text = device.product() + " (" + dev + ")"; 
+	  QListWidgetItem *listitem = new QListWidgetItem;
+	  if ((harddisk->driveType()==Solid::StorageDrive::MemoryStick) || harddisk->isRemovable())
+	    listitem->setIcon(KIcon("drive-removable-media-usb").pixmap(64));
+	  else
+	    listitem->setIcon(KIcon("drive-harddisk").pixmap(64));
+	  listitem->setText(text);
+	  listitem->setToolTip(dev);
+	  addItem(listitem);
+	  devhash->insert(text,device);
+	  diskListAlreadyOnList.append(dev);
+	  qDebug() << "Product: " << device.product() << "Vendor: " << device.vendor() 
+	  << "Description: " << device.description() << "Dev: " << dev
+	  << "Type: " << harddisk->driveType();
+	  
+	   foreach (Solid::Device partDev, Solid::Device::listFromType(Solid::DeviceInterface::Block, device.udi() ))
+	   {
+	    QString part = partDev.as<Solid::Block>()->device();
+	    parthash->insert(part, partDev);
+	    //qDebug() << "has partition: " << part;
+	  }
+	  
+	}
+      }
+      }
+    }
+    foreach(QString soldev, solidDevice) {
+      takeItem(row(findItems(".*"+soldev+".*",Qt::MatchRegExp)[0]));
+      foreach(QString devDescr, diskListAlreadyOnList) {
+	if (devDescr.contains(soldev))
+	  diskListAlreadyOnList.removeAll(devDescr);
+      }
+    }
+}
+
+#include "DiskListWidget.moc"

Added: PLDLiveInstaller/trunk/DiskListWidget.h
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/trunk/DiskListWidget.h	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,34 @@
+#ifndef DiskListWidget_H
+#define DiskListWidget_H
+
+#include <QCheckBox>
+#include <QLineEdit>
+#include <QListWidgetItem>
+#include <QProgressBar>
+#include <KAssistantDialog>
+#include <KDialog>
+#include <KAboutData>
+#include <QHash>
+#include <Solid/Device>
+
+class DiskListWidget;
+
+class DiskListWidget : public QListWidget
+{
+
+    Q_OBJECT
+
+    QStringList diskList;
+    QStringList diskListAlreadyOnList;
+
+public:
+    DiskListWidget( QWidget * parent = 0 );
+    QListWidgetItem *listitem;
+    QHash<QString,Solid::Device> * devhash, * parthash;
+    virtual ~DiskListWidget();
+    
+public Q_SLOTS:
+    void refresh();
+};
+
+#endif // DiskListWidget_H

Added: PLDLiveInstaller/trunk/PLDLiveInstaller.cpp
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/trunk/PLDLiveInstaller.cpp	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,1827 @@
+#include "PLDLiveInstaller.h"
+#include "DiskListWidget.h"
+
+#include <QApplication>
+#include <QDir>
+#include <QFile>
+#include <QLabel>
+#include <QListWidget>
+#include <QMessageBox>
+#include <QPalette>
+#include <QProcess>
+#include <QProgressBar>
+#include <QRegExp>
+#include <QTabWidget>
+#include <QTextStream>
+#include <QVBoxLayout>
+
+#include <KActionMenu>
+#include <KComboBox>
+#include <KDebug>
+#include <KLocale>
+#include <KPushButton>
+#include <KService>
+#include <KServiceTypeTrader>
+#include <KStandardDirs>
+#include <KTitleWidget>
+#include <KVBox>
+#include <kworkspace/kworkspace.h>
+#include <Solid/Device>
+#include <Solid/DeviceInterface>
+#include <Solid/StorageDrive>
+#include <Solid/StorageVolume>
+#include <Solid/StorageAccess>
+#include <Solid/Block>
+
+#define SOURCE "/"
+#define DESTINATION "/mnt/pldlivechroot/"
+#define LIVEUSER "plduser"
+
+PLDLiveInstaller::PLDLiveInstaller( QWidget *parent )
+  : KAssistantDialog( parent )
+{
+    setPlainCaption(i18n("PLD Live Installer"));
+    setFixedSize(800,600);
+    showButton(KDialog::Help, false);
+    showButton(KDialog::Cancel, false);
+    showButton(KDialog::User1, false);
+   
+    // Start
+    startPage = addPage(startWidget(), i18n(""));
+    
+    // Partition
+    setAppropriate(partitionPage, false);
+
+    // Select destination drive
+    selectDiskPage = addPage(selectDiskWidget(), i18n(""));
+    setValid(selectDiskPage, false);
+    
+    //Select partitions
+    selectPartitionsPage = addPage(selectPartitionsWidget(), i18n(""));
+    setValid(selectPartitionsPage, false);
+    
+    // Create user account
+    createUserPage = addPage(createUserWidget(), i18n(""));
+    setValid(createUserPage,false);
+    
+    // Copy files to DEST root
+    installingPage = addPage(installingWidget(), i18n(""));
+    if (pbar->value()!=100) setValid(installingPage, false);
+    
+    // Finish
+    finishPage = addPage(finishWidget(), i18n(""));
+    setAppropriate(finishPage, false);
+    
+    // Fail
+    failedPage = addPage(failedWidget(), i18n(""));
+    setAppropriate(failedPage, false);
+}
+
+PLDLiveInstaller::~PLDLiveInstaller()
+{
+}
+
+QWidget * PLDLiveInstaller::startWidget()
+{
+    KTitleWidget *titleWidget = new KTitleWidget(this);
+    titleWidget->setText(i18n("<html><p align=\"center\"><font size=\"10\"><b>Install PLD Linux</b></font><br /><br />"
+	  "<font size=\"5\"><b>To set up the installation of PLD Linux, click Next</b></font>"
+	  "</p></html>"));
+	  
+    QLabel *text = new QLabel(this);
+    text->setText(i18n("<html><p align=\"center\">"
+    "The content of this Live CD will be copied to your hard drive. You will be able to choose a disk or partition<br />"
+    "and create a user. After the installtion is complete you can safely reboot your computer."
+    "</p>"
+    "<p align=\"justify\">"
+    "<strong>Please note!</strong><br/>Partitioning is not yet available. It takes it's time to develop a clear and intuitive way "
+    "for the user to partition their disks. Please use a standalone partitioning tool like <i>partitionmanager</i> or <i>fdisk</i> before "
+    "running the installer."
+    "</p>"
+    "</html>"
+    ));
+    text->setAlignment(Qt::AlignCenter);
+    text->setWordWrap(true);
+    
+    QVBoxLayout *textLayout = new QVBoxLayout;
+    textLayout->addWidget(text);
+   
+    QVBoxLayout *layout = new QVBoxLayout;
+    layout->addWidget(titleWidget);
+    layout->addLayout(textLayout);
+    layout->setMargin(30);
+    
+    QWidget *widget = new QWidget;
+    widget->setLayout(layout);
+    widget->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
+    //setMainWidget(widget);
+    return widget;
+}
+
+void PLDLiveInstaller::isDiskItemSelected()
+{
+  qDebug() << diskListWidget->currentItem()->text() << "was selected";
+  setValid(selectDiskPage, true);
+  selectedDisk = diskListWidget->currentItem();
+  selectedBlockDev = diskListWidget->devhash->value(selectedDisk->text());
+  selHDDisRem = selectedBlockDev.as<Solid::StorageDrive>()->isRemovable();
+  qDebug() << "selHDD in isDIsk..." << selHDDisRem;
+  defimage->setVisible(false);
+  if (selHDDisRem)
+  {
+    image2->setVisible(true);
+    image->setVisible(false);
+  }
+  else
+  {
+    image->setVisible(true);
+    image2->setVisible(false);
+  }
+}
+
+void PLDLiveInstaller::isRootPartitionSelected(int pos)
+{
+  qDebug() << "rootPart Position: " << pos;
+  rootPartPos=pos;
+  if (pos!=0)
+  {
+    QString sizeText;
+    qlonglong minSize = 3072;
+    destPartition=diskListWidget->parthash->value(availablePartitions[pos-1]);
+    qlonglong curSize = destPartition.as<Solid::StorageVolume>()->size()/1024/1024; //MB
+    QString size = QString::number(curSize);
+    if(curSize < minSize)
+    {
+      setValid(selectPartitionsPage, false);
+      sizeText = "Size: " + size + "MB";
+      devSizeInfo->setText("<html>"
+      "<strong>The device is too small for installation.</strong><br/>"
+      "You need at least " + QString::number(minSize) + "MB of free space."
+      "</html>");
+      devSizeInfoIcon->setVisible(true);
+      devSizeInfo->setVisible(true);
+      isPartBigEnough = false;
+    }
+    else {
+      devSizeInfoIcon->setVisible(false);
+      devSizeInfo->setVisible(false);
+      setValid(selectPartitionsPage, true);
+      isPartBigEnough = true;
+      sizeText = "Size: " + size + "MB<br />";
+    }
+    
+    selRoot=destPartition.as<Solid::Block>()->device();
+    
+    partDescr->setText("Partition details:<br />"
+		      "Device: " + selRoot + "<br />"
+		      //"File system type: " + destPartition.as<Solid::StorageVolume>()->fsType() + "<br />"
+		      + sizeText 
+		      //"Mountpoint: " + mountpoint + ""
+    );
+    
+    if(swapPartPos==rootPartPos)
+    {
+      samePartTwiceIcon->setVisible(true);
+      samePartTwice->setVisible(true);
+      setValid(selectPartitionsPage, false);
+    }
+    else
+    {
+      samePartTwiceIcon->setVisible(false);
+      samePartTwice->setVisible(false);
+      if(isPartBigEnough)
+	setValid(selectPartitionsPage, true);
+    }
+  }
+  else
+  {
+    samePartTwiceIcon->setVisible(false);
+    samePartTwice->setVisible(false);
+    devSizeInfoIcon->setVisible(false);
+    devSizeInfo->setVisible(false);
+    setValid(selectPartitionsPage, false);
+  }
+}
+
+void PLDLiveInstaller::isSwapPartitionSelected(int pos)
+{
+  qDebug() << "swapPart Position: " << pos;
+  swapPartPos=pos;
+  if (pos!=0)
+  {
+    destSwap=diskListWidget->parthash->value(availablePartitions[pos-1]);
+    selSwap=destSwap.as<Solid::Block>()->device();
+    memInfoIcon2->setVisible(false);
+    memInfo2->setVisible(false);
+    if(swapPartPos==rootPartPos)
+    {
+      samePartTwiceIcon->setVisible(true);
+      samePartTwice->setVisible(true);
+      setValid(selectPartitionsPage, false);
+    }
+    else
+    {
+      samePartTwiceIcon->setVisible(false);
+      samePartTwice->setVisible(false);
+      if(isPartBigEnough)
+	setValid(selectPartitionsPage, true);
+    }
+  }
+  else
+  {
+    if(!isRamEnough)
+    {
+      memInfoIcon2->setVisible(true);
+      memInfo2->setVisible(true);
+    }
+    samePartTwiceIcon->setVisible(false);
+    samePartTwice->setVisible(false);
+  }
+}
+
+void PLDLiveInstaller::isFsSelected(int pos)
+{
+  qDebug() << "FS type: " << fsTypes[pos];
+  selFS=fsTypes[pos];
+}
+
+void PLDLiveInstaller::reboot()
+{
+    //KWorkSpace::ShutdownConfirm confirm = KWorkSpace::ShutdownConfirmYes;
+    //KWorkSpace::ShutdownType type = KWorkSpace::ShutdownTypeReboot;
+    //KWorkSpace::ShutdownMode mode = KWorkSpace::ShutdownModeForceNow;
+    //KWorkSpace::requestShutDown(confirm, type, mode);
+    QProcess * proc = new QProcess(this);
+    proc->start("reboot");
+    proc->waitForFinished();
+    if(proc->exitCode() == 0)
+      KDialog::delayedDestruct();
+}
+
+void PLDLiveInstaller::close()
+{
+  KDialog::delayedDestruct();
+}
+
+QWidget * PLDLiveInstaller::selectDiskWidget()
+{   
+    KTitleWidget *titleWidget = new KTitleWidget(this);
+    titleWidget->setText(i18n("<html><p align=\"center\"><font size=\"10\"><b>Install PLD Linux</b></font><br /><br />"
+	  "<font size=\"5\"><b>Select the disk where you want PLD Linux<br /> to install and click Next.</b></font>"
+	  "</p></html>"));
+	  
+    KHBox *buttonBox = new KHBox(this);
+
+    diskListWidget = new DiskListWidget(this);
+    diskListWidget->setIconSize(QSize::QSize(48,48));
+    connect(diskListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(isDiskItemSelected()));
+    diskListWidget->refresh();
+
+    KPushButton *refresh = new KPushButton(KIcon("view-refresh"), i18n("Refresh list"), buttonBox);
+    refresh->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
+    refresh->setToolTip("Refresh device list");
+    refresh->setIconSize(QSize::QSize(22,22));
+    refresh->setFixedHeight(33);
+    connect(refresh, SIGNAL(clicked()), diskListWidget, SLOT(refresh()));
+    
+    defimage = new QLabel;
+    defimage->setPixmap(KIcon("media-optical").pixmap(128));
+    defimage->setAlignment(Qt::AlignLeft);
+    defimage->setVisible(true);
+    
+    image = new QLabel;
+    image->setPixmap(KIcon("drive-harddisk").pixmap(128));
+    image->setAlignment(Qt::AlignLeft);
+    image->setVisible(false);
+    
+    image2 = new QLabel;
+    image2->setPixmap(KIcon("drive-removable-media-usb").pixmap(128));
+    image2->setAlignment(Qt::AlignLeft);
+    image2->setVisible(false);
+    
+    QHBoxLayout *imageLayout = new QHBoxLayout;
+    imageLayout->addWidget(defimage);
+    imageLayout->addWidget(image);
+    imageLayout->addWidget(image2);
+	  
+    QLabel *text = new QLabel(this);
+    text->setText(i18n("<html><p align=\"left\">"
+    "The following disks are available:"
+    "</p></html>"
+    ));
+    text->setFixedHeight(40);
+    
+    QVBoxLayout *disksLayout = new QVBoxLayout;
+    disksLayout->addWidget(text);
+    disksLayout->addWidget(diskListWidget);
+    disksLayout->addWidget(buttonBox);
+    disksLayout->setSpacing(0);
+    
+    QHBoxLayout *midLayout = new QHBoxLayout;
+    midLayout->addLayout(imageLayout);
+    midLayout->addLayout(disksLayout);
+    midLayout->setMargin(50);
+    midLayout->setSpacing(20);
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(titleWidget);
+    layout->addLayout(midLayout);
+    layout->setMargin(0);
+    
+    QWidget *widget = new QWidget(this);
+    widget->setLayout(layout);
+    widget->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Maximum);
+    return widget;
+    
+}
+
+void PLDLiveInstaller::instBootLoaderIsChecked(int state)
+{
+  qDebug() << "Install boot loader?" << state;
+  installBootLoader = state;
+  if(!installBootLoader)
+    qDebug() << "Boot loader will be installed";
+  else
+    qDebug() << "No boot loader";
+}
+
+QWidget * PLDLiveInstaller::selectPartitionsWidget()
+{   
+    swapPartPos = 0;
+    rootPartPos = 0;
+    installBootLoader = false;
+    fsTypes << "ext4" << "ext3" << "ext2" << "xfs";
+    selFS=fsTypes[0];
+  
+    KTitleWidget *titleWidget = new KTitleWidget(this);
+    titleWidget->setText(i18n("<html><p align=\"center\"><font size=\"10\"><b>Install PLD Linux</b></font><br /><br />"
+	  "<font size=\"5\"><b>Select partitions where you want PLD Linux<br/> to install and click Next.</b></font>"
+	  "</p></html>"));
+	  
+    partImage = new QLabel;
+    partImage->setPixmap(KIcon("drive-harddisk").pixmap(128));
+    partImage->setAlignment(Qt::AlignLeft);
+    partImage->setVisible(false);
+    
+    partImage2 = new QLabel;
+    partImage2->setPixmap(KIcon("drive-removable-media-usb").pixmap(128));
+    partImage2->setAlignment(Qt::AlignLeft);
+    partImage2->setVisible(false);
+    
+    partDescr = new QLabel;
+    partDescr->setVisible(true);
+    partDescr->setAlignment(Qt::AlignLeft);
+    
+    QVBoxLayout *imageLayout = new QVBoxLayout;
+    imageLayout->addWidget(partImage);
+    imageLayout->addWidget(partImage2);
+    imageLayout->addWidget(partDescr);
+    
+    selectPartitionPageText = new QLabel(this);
+    rootPart = new KComboBox(this);
+    rootPart->setFixedWidth(200);
+    swapPart = new KComboBox(this);
+    swapPart->setFixedWidth(200);
+    connect(rootPart, SIGNAL(activated(int)), this, SLOT(isRootPartitionSelected(int)));
+    connect(swapPart, SIGNAL(activated(int)), this, SLOT(isSwapPartitionSelected(int)));
+    fs = new KComboBox(this);
+    fs->addItems(fsTypes);
+    fs->setCurrentItem("ext4");
+    connect(fs, SIGNAL(activated(int)), this, SLOT(isFsSelected(int)));
+    
+    QLabel *rootText = new QLabel;
+    rootText->setText("Root (/):");
+    rootText->setAlignment(Qt::AlignRight);
+    rootText->setFixedWidth(150);
+    
+    QLabel *swapText = new QLabel;
+    swapText->setText("Swap:");
+    swapText->setAlignment(Qt::AlignRight);
+    swapText->setFixedWidth(150);
+    
+    memInfo = new QLabel;
+    memInfo->setText("<html>"
+	  "You seem to have >= 2GB of RAM installed.<br/>"
+	  "You don't have to select a swap partition!"
+	  "<html>");
+    memInfo->setAlignment(Qt::AlignLeft);
+    memInfo->setMargin(10);
+    memInfo->setVisible(false);
+    
+    memInfo2 = new QLabel;
+    memInfo2->setText("<html>"
+	  "You seem to have &lt; 2GB of RAM installed.<br/>"
+	  "It is recommended that you select a swap partition!"
+	  "<html>");
+    memInfo2->setAlignment(Qt::AlignLeft);
+    memInfo2->setMargin(10);
+    memInfo2->setVisible(false);
+    
+    memInfoIcon = new QLabel;
+    memInfoIcon->setPixmap(KIcon("dialog-information").pixmap(32));
+    memInfoIcon->setAlignment(Qt::AlignRight);
+    memInfoIcon->setVisible(false);
+    
+    memInfoIcon2 = new QLabel;
+    memInfoIcon2->setPixmap(KIcon("dialog-warning").pixmap(32));
+    memInfoIcon2->setAlignment(Qt::AlignRight);
+    memInfoIcon2->setVisible(false);
+    
+    devSizeInfo = new QLabel;
+    devSizeInfo->setAlignment(Qt::AlignLeft);
+    devSizeInfo->setMargin(10);
+    devSizeInfo->setVisible(false);
+    
+    devSizeInfoIcon = new QLabel;
+    devSizeInfoIcon->setPixmap(KIcon("dialog-error").pixmap(32));
+    devSizeInfoIcon->setAlignment(Qt::AlignRight);
+    devSizeInfoIcon->setVisible(false);
+    
+    samePartTwice = new QLabel;
+    samePartTwice->setText("<html>"
+    "You've selected the same partition twice!"
+    "</html>");
+    samePartTwice->setAlignment(Qt::AlignLeft);
+    samePartTwice->setMargin(10);
+    samePartTwice->setVisible(false);
+    
+    samePartTwiceIcon = new QLabel;
+    samePartTwiceIcon->setPixmap(KIcon("dialog-error").pixmap(32));
+    samePartTwiceIcon->setAlignment(Qt::AlignRight);
+    samePartTwiceIcon->setVisible(false);
+    
+    QCheckBox *instBootLoader = new QCheckBox("Don't install GRUB boot loader on the root device.");
+    instBootLoader->setCheckState(Qt::Unchecked);
+    instBootLoader->setChecked(false);    
+    connect(instBootLoader, SIGNAL(stateChanged(int)), this, SLOT(instBootLoaderIsChecked(int)));
+    
+    QHBoxLayout *instBlLayout = new QHBoxLayout;
+    instBlLayout->addWidget(instBootLoader);
+    instBlLayout->setMargin(0);
+    
+    QHBoxLayout *memInfoLayout = new QHBoxLayout;
+    memInfoLayout->addWidget(memInfoIcon);
+    memInfoLayout->addWidget(memInfo);
+    memInfoLayout->addWidget(memInfoIcon2);
+    memInfoLayout->addWidget(memInfo2);
+    memInfoLayout->setAlignment(Qt::AlignLeft);
+    memInfoLayout->setMargin(0);
+    
+    QHBoxLayout *devSizeLayout = new QHBoxLayout;
+    devSizeLayout->addWidget(devSizeInfoIcon);
+    devSizeLayout->addWidget(devSizeInfo);
+    devSizeLayout->setAlignment(Qt::AlignLeft);
+    devSizeLayout->setMargin(0);
+    
+    QHBoxLayout *samePartTwiceLayout = new QHBoxLayout;
+    samePartTwiceLayout->addWidget(samePartTwiceIcon);
+    samePartTwiceLayout->addWidget(samePartTwice);
+    samePartTwiceLayout->setAlignment(Qt::AlignLeft);
+    samePartTwiceLayout->setMargin(0);
+    
+    QHBoxLayout *rootLayout = new QHBoxLayout;
+    rootLayout->addWidget(rootText);
+    rootLayout->addWidget(rootPart);
+    rootLayout->addWidget(fs);
+    rootLayout->addStretch();
+    
+    QHBoxLayout *swapLayout = new QHBoxLayout;
+    swapLayout->addWidget(swapText);
+    swapLayout->addWidget(swapPart);
+    swapLayout->addStretch();
+    
+    QVBoxLayout *disksLayout = new QVBoxLayout;
+    disksLayout->addWidget(selectPartitionPageText);
+    disksLayout->addLayout(rootLayout);
+    disksLayout->addLayout(swapLayout);
+    disksLayout->addLayout(memInfoLayout);
+    disksLayout->addLayout(devSizeLayout);
+    disksLayout->addLayout(samePartTwiceLayout);
<<diff output has been trimmed to 500 lines, 1328 line(s) remained.>>

Added: PLDLiveInstaller/trunk/PLDLiveInstaller.h
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/trunk/PLDLiveInstaller.h	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,95 @@
+#ifndef PLDLiveInstaller_H
+#define PLDLiveInstaller_H
+
+#include <QCheckBox>
+#include <QLineEdit>
+#include <QListWidgetItem>
+#include <QProgressBar>
+#include <KComboBox>
+#include <KAssistantDialog>
+#include <KDialog>
+#include <KAboutData>
+#include <QHash>
+#include <Solid/Device>
+#include <Solid/StorageDrive>
+#include <Solid/StorageVolume>
+#include <QLabel>
+#include <QPushButton>
+
+#include "DiskListWidget.h"
+
+class KCMultiDialog;
+
+class PLDLiveInstaller : public KAssistantDialog
+{
+
+    Q_OBJECT
+
+    KCMultiDialog *partitionDialog;
+    KPageWidgetItem *startPage;
+    KPageWidgetItem *partitionPage;
+    KPageWidgetItem *selectDiskPage;
+    KPageWidgetItem *selectPartitionsPage;
+    KPageWidgetItem *createUserPage;
+    KPageWidgetItem *installingPage;
+    KPageWidgetItem *finishPage;
+    KPageWidgetItem *failedPage;
+
+    QWidget * kcmLayout(KCMultiDialog* dialog);
+    QWidget * kcmLayout(QWidget* widget);
+    QWidget * startWidget();
+    QWidget * selectDiskWidget();
+    QWidget * selectPartitionsWidget();
+    QWidget * createUserWidget();
+    QWidget * installingWidget();
+    QWidget * finishWidget();
+    QWidget * failedWidget();
+    QProgressBar *pbar, *pwStrengthMeter;
+    QPushButton *install;
+    QLineEdit *username, *password, *password2, *hostname, *usercredentials;
+    DiskListWidget *diskListWidget;
+    QListWidgetItem * selectedDisk;
+    Solid::Device selectedBlockDev, destPartition, destSwap;
+    QLabel *selectPartitionPageText, *installationText, *installationHeader, *failText, *memInfo, *memInfoIcon;
+    QLabel *memInfo2, *memInfoIcon2, *devSizeInfo, *devSizeInfoIcon, *samePartTwice, *samePartTwiceIcon;
+    QStringList availablePartitions, fsTypes;
+    KComboBox * rootPart,* swapPart, * fs;
+    int rootPartPos, swapPartPos, pbarVal;
+    bool selHDDisRem, isPartBigEnough, isRamEnough, installBootLoader, pwMatch, userSet;
+    QLabel *defimage, *image, *image2, *partImage, *partImage2, *partDescr;
+    QString selFS, selUser, selPasswd, selHostname, failReason, selRoot, selSwap, selCred;
+    int isMounted(Solid::Device partition);
+    bool mountDev(Solid::Device partition), umountDev(Solid::Device partition);
+    bool copyData(QString src,QString dest);
+    void getData(QString src, QString dest);
+    bool makeFS(Solid::Device partition), makeSwap(Solid::Device partition);
+    void updateProgressBar();
+    char * genPasswd();
+    bool makeGrubConfig(), installGrub(), geninitrd(), mountProcSysDev(), umountProcSysDev();
+    void move2dest(QString from, QString to), renameConfigFiles(), delUtmpx();
+    bool createHostname(), createFstabEntries(), createUser(), copySettings(QString file), deleteLiveUser();
+    int getMemoryAmount();
+    int effectivePasswordLength(const QString& password);
+    
+public:
+    PLDLiveInstaller( QWidget * parent = 0 );
+    virtual ~PLDLiveInstaller();
+        
+public Q_SLOTS:
+    virtual void back();
+    virtual void next();
+    void reboot();
+    void close();
+    void installation();
+    void isDiskItemSelected();
+    void isRootPartitionSelected(int pos);
+    void isSwapPartitionSelected(int pos);
+    void isFsSelected(int pos);
+    void isUserEntered();
+    void instBootLoaderIsChecked(int state);
+    void checkPwStrength();
+    void checkPwMatch();
+    
+};
+
+#endif // PLDLiveInstaller_H

Added: PLDLiveInstaller/trunk/PLDLiveInstaller.kdev4
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/trunk/PLDLiveInstaller.kdev4	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,3 @@
+[Project]
+Manager=KDevCMakeManager
+Name=PLDLiveInstaller

Added: PLDLiveInstaller/trunk/Updater.cpp
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/trunk/Updater.cpp	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,351 @@
+#include "Updater.h"
+#include "PLDLiveInstaller.h"
+#include "Version.h"
+
+#include <KTitleWidget>
+#include <KLocale>
+
+#include <QDateTime>
+#include <QDebug>
+#include <QDir>
+#include <QLabel>
+#include <QMessageBox>
+#include <QString>
+#include <QTextEdit>
+#include <QTextStream>
+#include <QUrl>
+#include <QVBoxLayout>
+
+Updater::Updater(QWidget* parent) : QObject(parent)
+{
+}
+
+Updater::~Updater()
+{
+}
+
+bool Updater::shouldWeCheckForUpdate()
+{
+  QFile *lastChecked = new QFile(QDir::homePath() + "/.config/pliLastChecked");
+  QDateTime *datetime = new QDateTime;
+  if(lastChecked->exists())
+  {
+    if (!lastChecked->open(QIODevice::ReadWrite))
+    {
+      qDebug() << "Couldn't open last check file";
+      delete lastChecked;
+      lastChecked = 0;
+      return true;
+    }
+    else
+    {
+      QTextStream in(lastChecked);
+      qlonglong line = in.readLine().toLongLong();
+      //qDebug() << "line:" << line;
+      int difference = datetime->currentDateTime().toTime_t() - line;
+      if (difference >= 2592000) // about a month
+      {
+	lastChecked->close();
+	lastChecked->remove();
+	if(lastChecked->open(QIODevice::WriteOnly))
+	{
+	  QTextStream out(lastChecked);
+	  out << datetime->currentDateTime().toTime_t() << "\n";
+	  lastChecked->close();
+	  return true;
+	}
+      }
+      else
+      {
+	lastChecked->close();
+	return false;
+      }
+    }
+  }
+  else
+  {
+    if (lastChecked->open(QIODevice::WriteOnly))
+    {
+      QTextStream out(lastChecked);
+      out << datetime->currentDateTime().toTime_t() << "\n";
+      lastChecked->close();
+      qDebug() << "Wrote last checked";
+      return true;
+    }
+  }
+}
+
+void Updater::startInstaller()
+{
+  PLDLiveInstaller * start = new PLDLiveInstaller;
+  start->setCaption("PLD Live Installer");
+  start->exec();
+}
+
+void Updater::getLatestVersion()
+{
+  if(shouldWeCheckForUpdate())
+  {
+    QString fileName = "/tmp/installerUpdate.xml";
+    QUrl url("http://pldliveinstaller.pld-linux.org/installerUpdate.xml");
+    if (QFile::exists(fileName))
+      QFile::remove(fileName);
+    tmpfile = new QFile(fileName);
+    if (tmpfile->isOpen())
+      tmpfile->close();
+    if (!tmpfile->open(QIODevice::WriteOnly)) {
+      qDebug() << "Couldn't save XML file";
+      delete tmpfile;
+      tmpfile = 0;
+      return;
+    }
+    
+    http = new QHttp;
+    http->setHost(url.host(), url.port(80));
+    httpRequestAborted = false;
+    httpGetId = http->get(url.path(), tmpfile);
+    connect(http, SIGNAL(requestFinished(int,bool)), this, SLOT(httpGetFinished(int, bool)));
+    connect(http, SIGNAL(readyRead(QHttpResponseHeader)), this, SLOT(readResponseHeader(const QHttpResponseHeader &)));
+    qDebug() << "httpGetId: " << httpGetId;
+  }
+  else
+    startInstaller();
+}
+
+void Updater::httpGetFinished(int requestId, bool error)
+{
+  if (requestId != httpGetId)
+    return;
+  
+  tmpfile->close();
+  if(error)
+    tmpfile->remove();
+  qDebug() << "Closed connection";
+  checkForUpdate();
+}
+
+void Updater::readResponseHeader(const QHttpResponseHeader &responseHeader)
+{
+  if(responseHeader.statusCode() != 200)
+  {
+    http->abort();
+    qDebug() << "response header:" << responseHeader.statusCode();
+  }
+}
+
+void Updater::checkForUpdate()
+{
+  int pos = 0;
+  updateAvailable = false;
+    qDebug() << "Start checking for update";
+    if (!tmpfile->open(QIODevice::ReadOnly | QIODevice::Text))
+    {
+	qDebug() << "Couldn't read update XML";
+	return;
+    }
+    QXmlStreamReader xml(tmpfile);
+    if(xml.hasError()) {
+      qDebug() << "Has error" << xml.errorString(); 
+    }
+    while(!xml.atEnd())
+    {
+      xml.readNext();
+      if(xml.isStartDocument())
+	continue;
+      if(xml.isStartElement() && xml.name() == "file")
+      {
+	QXmlStreamAttributes attrs = xml.attributes();
+	versions.append(attrs.value("version").toString());
+	kdevers.append(attrs.value("kdever").toString());
+	hashes.append(attrs.value("hash").toString());
+      }
+      if(xml.isStartElement() && xml.name() == "changelog")
+      {
+	while(!xml.isEndElement())
+	{
+	  xml.readNext();
+	  if(xml.isCDATA())
+	    changeLogs.append(xml.text().toString());
+	}
+      }
+    }
+    xml.clear();
+    tmpfile->close();
+    tmpfile->remove();
+    foreach (QString v, versions)
+    {
+      if((v.toDouble() > QString(VERSION).toDouble()) && 
+	(kdevers.value(pos).toDouble() == QString(KDEVER).toDouble()))
+      {
+	latestVer = v;
+	kdeBuildVer = kdevers.value(pos);
+	md5sum = hashes.value(pos);
+	changeLogText = changeLogs.value(pos);
+	qDebug() << v << kdevers.value(pos);
+	updateAvailable = true;
+      }
+      pos++;
+    }
+    if(updateAvailable)
+      updateDialog();
+    else
+      startInstaller();
+}
+
+void Updater::updateDialog()
+{
+  UpdateNotification * notify = new UpdateNotification;
+  notify->setCaption("Update Available");
+  notify->setVersion(latestVer);
+  notify->setMd5(md5sum);
+  notify->setKdever(kdeBuildVer);
+  notify->setChangeLog(changeLogText);
+  notify->start();
+}
+
+UpdateNotification::UpdateNotification(QWidget* parent) : KDialog(parent)
+{
+  
+}
+
+UpdateNotification::~UpdateNotification()
+{
+}
+
+void UpdateNotification::setVersion(QString v)
+{
+  latestVer = v;
+}
+
+void UpdateNotification::setMd5(QString h)
+{
+  md5sum = h;
+}
+
+void UpdateNotification::setChangeLog(QString c)
+{
+  changeLogText = c;
+}
+
+void UpdateNotification::setKdever(QString v)
+{
+  kdever = v;
+}
+
+QString UpdateNotification::getVersion()
+{
+  return latestVer;
+}
+
+QString UpdateNotification::getMd5()
+{
+  return md5sum;
+}
+
+QString UpdateNotification::getKdever()
+{
+  return kdever;
+}
+
+void UpdateNotification::startInstaller()
+{
+  delayedDestruct();
+  PLDLiveInstaller * start = new PLDLiveInstaller;
+  start->setCaption("PLD Live Installer");
+  start->exec();
+}
+
+QWidget * UpdateNotification::start()
+{
+  setFixedSize(300,240);
+  setButtons(User1 | Cancel);
+  setButtonGuiItem(User1 , KGuiItem( i18n( "Download and Update" ), "task-recurring", i18n("Download and Update")));
+  connect(this, SIGNAL(cancelClicked()), this, SLOT(startInstaller()));
+  connect(this, SIGNAL(user1Clicked()), this, SLOT(getUpdate()));
+  showButtonSeparator(true);
+
+  KTitleWidget *titleWidget = new KTitleWidget(this);
+  titleWidget->setText("<html><font size=\"3\">"
+    "Version " + getVersion() + " is available for update.<br/>"
+    "Release Notes:"
+    "</font></html>");
+  
+  QTextEdit * changeLog = new QTextEdit;
+  changeLog->setReadOnly(true);
+  changeLog->insertHtml(changeLogText);
+    
+  QVBoxLayout *mainLayout = new QVBoxLayout;
+  mainLayout->addWidget(titleWidget);
+  mainLayout->addWidget(changeLog);
+  mainLayout->setMargin(0);
+
+  QWidget *mainWidget = new QWidget;
+  mainWidget->setLayout(mainLayout);
+  mainWidget->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
+
+  setMainWidget(mainWidget);
+  this->exec();
+}
+
+void UpdateNotification::getUpdate()
+{
+  QString fileName = "/sbin/pldliveinstaller";
+  QString uurl = "http://pldliveinstaller.pld-linux.org/updates/" + getKdever() + "/" + getVersion() + "/pldliveinstaller";
+  QUrl url(uurl);
+  if (QFile::exists(fileName))
+    QFile::remove(fileName);
+  binfile = new QFile(fileName);
+  if (binfile->isOpen())
+    binfile->close();
+  if (!binfile->open(QIODevice::WriteOnly)) {
+    qDebug() << "Couldn't save installer binary file";
+    delete binfile;
+    binfile = 0;
+    return;
+  }
+    
+  http = new QHttp;
+  http->setHost(url.host(), url.port(80));
+  httpRequestAborted = false;
+  httpGetId = http->get(url.path(), binfile);
+  connect(http, SIGNAL(requestFinished(int,bool)), this, SLOT(httpGetFinished(int, bool)));
+  connect(http, SIGNAL(readyRead(QHttpResponseHeader)), this, SLOT(readResponseHeader(const QHttpResponseHeader &)));
+  qDebug() << "httpGetId: " << httpGetId;
+}
+
+void UpdateNotification::httpGetFinished(int requestId, bool error)
+{
+  if (requestId != httpGetId)
+    return;
+  
+  binfile->close();
+  if(error)
+  {
+    binfile->remove();
+    QMessageBox::information(this, "The update failed!",
+			 "The update failed!"
+			 "<br />No internet connection to update server!<br />",
+			 QMessageBox::Close);
+  }
+  else
+  {
+    delayedDestruct();
+    binfile->setPermissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner | QFile::ReadGroup | QFile::ReadOther);
+    QMessageBox::information(this, "The update was successful!",
+			 "The update was successful!"
+			 "<br />Please restart the installer.",
+			 QMessageBox::Close);
+  }
+  qDebug() << "Closed connection";
+}
+
+void UpdateNotification::readResponseHeader(const QHttpResponseHeader &responseHeader)
+{
+  if(responseHeader.statusCode() != 200)
+  {
+    http->abort();
+    qDebug() << "response header:" << responseHeader.statusCode();
+  }
+}
+
+#include "Updater.moc"
\ No newline at end of file

Added: PLDLiveInstaller/trunk/Updater.h
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/trunk/Updater.h	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,73 @@
+#ifndef UPDATER_H
+#define UPDATER_H
+
+#include <KDialog>
+
+#include <QProgressBar>
+#include <QFile>
+#include <QHttp>
+#include <QHttpResponseHeader>
+#include <QList>
+#include <QXmlStreamReader>
+#include <QMap>
+
+class Updater : QObject
+{
+  Q_OBJECT
+  
+  QProgressBar * updateBar;
+  void checkForUpdate();
+  
+  public:
+    void getLatestVersion();
+    Updater( QWidget * parent = 0 );
+    virtual ~Updater();
+  
+  public Q_SLOTS:
+    void startInstaller();
+    void httpGetFinished(int requestId, bool error);
+    void readResponseHeader(const QHttpResponseHeader &responseHeader);
+    
+  private:
+    QHttp * http;
+    QFile * tmpfile;
+    QStringList versions, kdevers, hashes, changeLogs;
+    QString latestVer, kdeBuildVer, md5sum, changeLogText;
+    int httpGetId;
+    bool httpRequestAborted, updateAvailable;
+    void updateDialog();
+    bool shouldWeCheckForUpdate();
+  
+};
+
+class UpdateNotification : public KDialog
+{
+  Q_OBJECT
+  
+  public:
+    UpdateNotification(QWidget* parent = 0);
+    virtual ~UpdateNotification();
+    void setVersion(QString);
+    void setMd5(QString);
+    void setChangeLog(QString);
+    void setKdever(QString);
+    QString getVersion();
+    QString getMd5();
+    QString getKdever();
+    QWidget * start();
+    
+  public Q_SLOTS:
+    void startInstaller();
+    void getUpdate();
+    void httpGetFinished(int requestId, bool error);
+    void readResponseHeader(const QHttpResponseHeader &responseHeader);
+    
+  private:
+    QString latestVer, md5sum, changeLogText, kdever;
+    QHttp *http;
+    QFile * binfile;
+    int httpGetId;
+    bool httpRequestAborted;
+};
+
+#endif // UPDATER_H

Added: PLDLiveInstaller/trunk/Version.h
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/trunk/Version.h	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,3 @@
+#define	VERSION "0.2"
+#define VERSION_STR "Version " VERSION
+#define KDEVER "4.5"

Added: PLDLiveInstaller/trunk/installerUpdate.xml
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/trunk/installerUpdate.xml	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<pldliveinstaller>
+	<app>	
+		<file name="pldliveinstaller" version="0.2" kdever="4.5" hash="6a82c37ea0a5be5d0a08aa987d540b96"></file>
+		<changelog>
+<![CDATA[
+<html>
+Version 0.2 adresses the following issues:<br>
+Bug fixes:
+<ul>
+<li>costam 1</li>
+<li>costam 2</li>
+</ul>
+<html>
+]]>
+		</changelog>
+	</app>
+	<app>
+		<file name="pldliveinstaller" version="0.3" kdever="4.6" hash="6a82c37ea0a5be5d0a08aa987d540b96"></file>
+		<changelog>
+<![CDATA[
+<html>
+Version 0.3 adresses the following issues:<br>
+Bug fixes:
+<ul>
+<li>costam 3</li>
+<li>costam 4</li>
+</ul>
+<html>
+]]>
+		</changelog>
+	</app>
+</pldliveinstaller>

Added: PLDLiveInstaller/trunk/main.cpp
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/trunk/main.cpp	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,35 @@
+#include <KApplication>
+#include <KCmdLineArgs>
+#include <KAboutData>
+#include <KLocale>
+#include "PLDLiveInstaller.h"
+#include "Updater.h"
+#include "Version.h"
+
+void fillAboutData(KAboutData& aboutData);
+
+int main(int argc, char** argv)
+{
+  
+    KAboutData aboutData( "PLDLiveInstaller", "PLD Live Installer", ki18n(VERSION_STR),
+			  VERSION, ki18n("Live Installer"), KAboutData::License_GPL);
+			  
+    fillAboutData(aboutData);
+  
+    KCmdLineArgs::init( argc, argv, &aboutData );
+  
+    KApplication app;
+    //PLDLiveInstaller * start = new PLDLiveInstaller();
+    //start->setCaption("PLD Live Installer");
+    //start->show();
+    Updater * update = new Updater;
+    update->getLatestVersion();
+    
+    return app.exec();
+}
+
+void fillAboutData(KAboutData& aboutData)
+{
+  aboutData.setProgramIconName("tools-wizard");
+  aboutData.addAuthor(ki18n("Bartosz Świątek"), ki18n("Maintainer, Qt4"), "shadzik at pld-linux.org");
+}
\ No newline at end of file

Added: PLDLiveInstaller/trunk/scripts/getxatakmod.sh
==============================================================================
--- (empty file)
+++ PLDLiveInstaller/trunk/scripts/getxatakmod.sh	Thu Nov 18 00:25:48 2010
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+for class in 0106 0107 0100 0101; do
+	module="$module $(lspci -n |grep $class |sed 's/:/ /g' |while read junk junk class vendor device junk; do grep "0x0000$vendor 0x0000$device" /lib/modules/$(uname -r)/modules.pcimap |awk '{print $1}'; done |uniq)"
+done
+
+echo $module


More information about the pld-cvs-commit mailing list