[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasmate/terietor/remoteinstallerV2] /: Implement the remote installer
From:       Giorgos Tsiapaliwkas <terietor () gmail ! com>
Date:       2012-07-01 16:27:36
Message-ID: 20120701162736.6D5DFA60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 9ef146149ef0be1a4acd5f04c92d649ba9d14423 by Giorgos Tsiapaliwkas.
Committed on 01/07/2012 at 18:24.
Pushed by tsiapaliwkas into branch 'terietor/remoteinstallerV2'.

Implement the remote installer

M  +42   -20   CMakeLists.txt
M  +31   -2    publisher/publisher.cpp
M  +2    -0    publisher/publisher.h
A  +87   -0    publisher/remoteinstaller/remoteinstaller.cpp     [License: GPL (v2+)]
A  +37   -0    publisher/remoteinstaller/remoteinstaller.h     [License: GPL (v2+)]
A  +150  -0    publisher/remoteinstaller/remoteinstaller.ui
A  +88   -0    publisher/remoteinstaller/remoteinstallerdialog.cpp     [License: GPL \
(v2+)] A  +42   -0    publisher/remoteinstaller/remoteinstallerdialog.h     [License: \
GPL (v2+)] A  +51   -0    publisher/remoteinstaller/standalone/main.cpp     [License: \
GPL (v2+)] A  +46   -0    \
publisher/remoteinstaller/standalone/plasmaremoteinstaller.cpp     [License: GPL \
(v2+)] A  +26   -0    publisher/remoteinstaller/standalone/plasmaremoteinstaller.h    \
[License: GPL (v2+)]

http://commits.kde.org/plasmate/9ef146149ef0be1a4acd5f04c92d649ba9d14423

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cd9fb1c..26b8af3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,18 +57,12 @@ set (PlasMate_SRC
     publisher/signingwidget.cpp
     publisher/signingdialog.cpp
     publisher/publisher.cpp
+    publisher/remoteinstaller/remoteinstaller.cpp
+    publisher/remoteinstaller/remoteinstallerdialog.cpp
     docbrowser/docbrowser.cpp
     projectmanager/projectmanager.cpp
-    )
-
-set (WindowSwitcherPreviewer_SRC
-    previewer/windowswitcher/windowswitcher.cpp
-    previewer/windowswitcher/thumbnailitem.cpp
-    previewer/windowswitcher/tabboxpreviewer.cpp
-    previewer/previewer.cpp
-    previewer/windowswitcher/standalone/main.cpp
-    previewer/windowswitcher/standalone/windowswitcherpreviewer.cpp
 )
+
 if (DEBUG_MODEL)
       set (PlasMate_SRC
          ${PlasMate_SRC}
@@ -81,6 +75,7 @@ kde4_add_ui_files (PlasMate_SRC
    startpage.ui
    editors/metadata/metadata.ui
    publisher/publisher.ui
+   publisher/remoteinstaller/remoteinstaller.ui
 )
 
 include_directories(${KDE4_INCLUDES}
@@ -109,21 +104,10 @@ target_link_libraries(plasmate
                       ${KDECLARATIVE_LIBRARIES}
 )
 
-kde4_add_executable(windowswitcherpreviewer ${WindowSwitcherPreviewer_SRC})
-target_link_libraries(windowswitcherpreviewer
-                      ${KDE4_KDEUI_LIBS}
-                      ${KDE4_KIO_LIBRARY}
-                      ${QT_QTDECLARATIVE_LIBRARIES}
-                      ${KDECLARATIVE_LIBRARIES}
-)
-
-
-
 if (DEBUG_MODEL)
    target_link_libraries(plasmate ${QT_QTTEST_LIBRARY})
 endif (DEBUG_MODEL)
 
-install(TARGETS windowswitcherpreviewer ${INSTALL_TARGETS_DEFAULT_ARGS})
 install(TARGETS plasmate ${INSTALL_TARGETS_DEFAULT_ARGS})
 install(FILES plasmate.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
 install(FILES plasmateui.rc  DESTINATION ${DATA_INSTALL_DIR}/plasmate)
@@ -136,4 +120,42 @@ previewer/windowswitcher/thumbnails/systemsettings.png
 previewer/windowswitcher/thumbnails/dolphin.png
 DESTINATION ${DATA_INSTALL_DIR}/plasmate)
 install( FILES previewer/windowswitcher/tabboxdelegate.qml DESTINATION \
${DATA_INSTALL_DIR}/plasmate) +
+##standalone applications
+#plasmaremoteinstaller
+set (PlasmaRemoteInstaller_SRC
+    publisher/remoteinstaller/remoteinstallerdialog.cpp
+    publisher/remoteinstaller/remoteinstaller.cpp
+    publisher/remoteinstaller/standalone/main.cpp
+    publisher/remoteinstaller/standalone/plasmaremoteinstaller.cpp
+)
+
+kde4_add_executable(plasmaremoteinstaller ${PlasmaRemoteInstaller_SRC})
+target_link_libraries(plasmaremoteinstaller
+                      ${KDE4_KDEUI_LIBS}
+                      ${KDE4_KIO_LIBRARY}
+)
+
+install(TARGETS plasmaremoteinstaller ${INSTALL_TARGETS_DEFAULT_ARGS})
+
+#windowswitcherpreviewer
+set (WindowSwitcherPreviewer_SRC
+    previewer/windowswitcher/windowswitcher.cpp
+    previewer/windowswitcher/thumbnailitem.cpp
+    previewer/windowswitcher/tabboxpreviewer.cpp
+    previewer/previewer.cpp
+    previewer/windowswitcher/standalone/main.cpp
+    previewer/windowswitcher/standalone/windowswitcherpreviewer.cpp
+)
+
+kde4_add_executable(windowswitcherpreviewer ${WindowSwitcherPreviewer_SRC})
+target_link_libraries(windowswitcherpreviewer
+                      ${KDE4_KDEUI_LIBS}
+                      ${KDE4_KIO_LIBRARY}
+                      ${QT_QTDECLARATIVE_LIBRARIES}
+                      ${KDECLARATIVE_LIBRARIES}
+)
+
+install(TARGETS windowswitcherpreviewer ${INSTALL_TARGETS_DEFAULT_ARGS})
+
 macro_display_feature_log()
diff --git a/publisher/publisher.cpp b/publisher/publisher.cpp
index 853d19a..e08c3fb 100644
--- a/publisher/publisher.cpp
+++ b/publisher/publisher.cpp
@@ -1,5 +1,6 @@
 /*
   Copyright 2009 Lim Yuen Hoe <yuenhoe@hotmail.com>
+  Copyright 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -9,6 +10,9 @@
 
 #include <QDBusInterface>
 #include <QVBoxLayout>
+#include <QCheckBox>
+#include <QComboBox>
+#include <QScopedPointer>
 
 #include <KConfigGroup>
 #include <KIO/DeleteJob>
@@ -25,6 +29,7 @@
 #include "signingwidget.h"
 #include "../packagemodel.h"
 #include "../projectmanager/projectmanager.h"
+#include "remoteinstaller/remoteinstallerdialog.h"
 
 Publisher::Publisher(QWidget *parent, const KUrl &path, const QString& type)
         : QDialog(parent),
@@ -54,6 +59,7 @@ Publisher::Publisher(QWidget *parent, const KUrl &path, const \
QString& type)  m_ui.installerButton->addItem("");
     m_ui.installerButton->addItem("Use PlasmaPkg");
     m_ui.installerButton->addItem("Use cmake");
+    m_ui.installerButton->addItem("Remote Install");
 
     connect(m_ui.exporterUrl, SIGNAL(urlSelected(const KUrl&)), this, \
                SLOT(addSuffix()));
     connect(m_ui.exporterButton, SIGNAL(clicked()), this, SLOT(doExport()));
@@ -112,6 +118,9 @@ void Publisher::checkInstallButtonState(int comboBoxCurrentIndex)
     } else if (comboBoxCurrentIndex == 2) {
         m_ui.installButton->setEnabled(true);
         m_comboBoxIndex = 2;
+    } else if (comboBoxCurrentIndex == 3) {
+        m_ui.installButton->setEnabled(true);
+        m_comboBoxIndex = 3;
     } else {
         m_ui.installButton->setEnabled(false);
         m_comboBoxIndex = 0;
@@ -126,6 +135,8 @@ void Publisher::doInstall()
         doPlasmaPkg();
     } else if (m_comboBoxIndex == 2) {
         doCMake();
+    } else if (m_comboBoxIndex == 3) {
+        doRemoteInstall();
     }
 }
 
@@ -167,8 +178,7 @@ void Publisher::doCMake()
     cmakeListsSourceFile.close();
 
     //we need the last loaded package which also is the current package.
-    KConfigGroup cg(KGlobal::config(), "PackageModel::package");
-    QString packagePath(cg.readEntry("lastLoadedPackage", QString()));
+    QString packagePath = currentPackagePath();
 
     //create a temporary build dir
     QDir dir(packagePath);
@@ -327,6 +337,19 @@ void Publisher::doPlasmaPkg()
     }
 }
 
+void Publisher::doRemoteInstall()
+{
+    QScopedPointer<RemoteInstallerDialog> dialog(new RemoteInstallerDialog());
+
+    //get the source directory from plasmaterc
+    KConfigGroup c(KGlobal::config(), "PackageModel::package");
+    QString path = currentPackagePath();
+
+    dialog->setPackagePath(path);
+
+    dialog->exec();
+}
+
 const QString Publisher::tempPackagePath()
 {
     QDir d(m_projectPath.pathOrUrl());
@@ -368,3 +391,9 @@ bool Publisher::exportToFile(const KUrl& url)
     }
     return ProjectManager::exportPackage(m_projectPath, url); // will overwrite if \
exists!  }
+
+QString Publisher::currentPackagePath() const
+{
+    KConfigGroup cg(KGlobal::config(), "PackageModel::package");
+    return cg.readEntry("lastLoadedPackage", QString());
+}
diff --git a/publisher/publisher.h b/publisher/publisher.h
index 5f40ae0..c0ff6fb 100644
--- a/publisher/publisher.h
+++ b/publisher/publisher.h
@@ -34,12 +34,14 @@ private slots:
     void doPublish();
     void doCMake();
     void doInstall();
+    void doRemoteInstall();
     void checkInstallButtonState(int comboBoxCurrentIndex);
 
 private:
     bool cmakeProcessStatus(QProcess::ProcessError error);
     bool exportToFile(const KUrl& url);
     const QString tempPackagePath();
+    QString currentPackagePath() const;
 
     SigningWidget* m_signingWidget;
 
diff --git a/publisher/remoteinstaller/remoteinstaller.cpp \
b/publisher/remoteinstaller/remoteinstaller.cpp new file mode 100644
index 0000000..2f089ec
--- /dev/null
+++ b/publisher/remoteinstaller/remoteinstaller.cpp
@@ -0,0 +1,87 @@
+/*
+ *  Copyright 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ */
+
+#include "remoteinstaller.h"
+
+#include <KIO/NetAccess>
+#include <KIO/CopyJob>
+#include <KMessageBox>
+#include <KLocalizedString>
+
+#include <QWidget>
+#include <QDir>
+
+RemoteInstaller::RemoteInstaller(const QString& username, const QString& hostname,
+                                 const QString& source, QWidget* parent)
+        : QObject(parent),
+        m_widget(parent)
+{
+    //like fish://username@192.123.23.1
+    m_execUrl.setUrl("fish://" + hostname + ":22");
+    m_execUrl.setUserName(username);
+
+    //this will be out temp directory
+    const QString temporaryDirectory("/var/tmp/plasmaremoteinstaller/");
+    //we need a temporary directory
+    //all users have access into /var/tmp
+    KUrl tmpUrl = m_execUrl;
+    tmpUrl.addPath(temporaryDirectory);
+    if (!KIO::NetAccess::exists(tmpUrl, KIO::NetAccess::DestinationSide, m_widget)) \
{ +        const bool ok = KIO::NetAccess::mkdir(tmpUrl, m_widget);
+        if (!ok) {
+            QString text = i18n("Plasma Remote Installer wasn't able to create a \
temp dir at" +                "%1, please check the rights into \
%1").arg(temporaryDirectory); +            KMessageBox::error(m_widget, text);
+            return;
+        }
+    }
+
+    //our destination path
+    m_destinationPath = m_execUrl;
+    m_destinationPath.setPath(temporaryDirectory);
+
+    //we need the name of the package and the directory
+    QDir packageDir(source);
+    //NOTE our path isn't a directory it is a metadata.desktop,
+    //that's plasmate's way to validate packages
+    packageDir.cdUp();
+    m_sourcePath = packageDir.path();
+
+    m_plasmaPkgUrl.append("plasmapkg -u " + temporaryDirectory + \
packageDir.dirName() + '/'); +
+    //now do the installation
+    doInstall();
+}
+
+void RemoteInstaller::doInstall()
+{
+    //copy the project in the target's plasmate data directory
+    KIO::CopyJob *copy = KIO::copy(m_sourcePath, m_destinationPath);
+
+    connect(copy, SIGNAL(result(KJob*)), this, SLOT(doPlasmaPkg(KJob*)));
+}
+
+void RemoteInstaller::doPlasmaPkg(KJob* job)
+{
+    if (job->error() != 0) {
+        //an error has occured from the previous job.
+        //show the error to the user.
+        KMessageBox::error(m_widget, job->errorText());
+    }
+
+    KIO::NetAccess::fish_execute(m_execUrl, m_plasmaPkgUrl, m_widget);
+
+    //an error has occured.
+    if (KIO::NetAccess::lastError()) {
+        //show the error
+        KMessageBox::error(m_widget, KIO::NetAccess::lastErrorString());
+    }
+}
+
+
diff --git a/publisher/remoteinstaller/remoteinstaller.h \
b/publisher/remoteinstaller/remoteinstaller.h new file mode 100644
index 0000000..8f68117
--- /dev/null
+++ b/publisher/remoteinstaller/remoteinstaller.h
@@ -0,0 +1,37 @@
+/*
+ *  Copyright 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ */
+
+#ifndef REMOTEINSTALLERCORE_H
+#define REMOTEINSTALLERCORE_H
+
+#include <QObject>
+#include <KUrl>
+
+class KJob;
+
+class RemoteInstaller : public QObject
+{
+    Q_OBJECT
+public:
+    RemoteInstaller(const QString& username, const QString& hostname,
+                    const QString& source, QWidget* parent = 0);
+
+private Q_SLOTS:
+    void doPlasmaPkg(KJob* job);
+
+private:
+    void doInstall();
+    KUrl m_execUrl;
+    QString m_plasmaPkgUrl;
+    QString m_sourcePath;
+    KUrl m_destinationPath;
+    QWidget *m_widget;
+};
+
+#endif // PUBLISHER_H
diff --git a/publisher/remoteinstaller/remoteinstaller.ui \
b/publisher/remoteinstaller/remoteinstaller.ui new file mode 100644
index 0000000..57772d8
--- /dev/null
+++ b/publisher/remoteinstaller/remoteinstaller.ui
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>RemoteInstaller</class>
+ <widget class="QWidget" name="RemoteInstaller">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>629</width>
+    <height>540</height>
+   </rect>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>620</width>
+    <height>540</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <widget class="QWidget" name="verticalLayoutWidget_2">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>10</y>
+     <width>611</width>
+     <height>501</height>
+    </rect>
+   </property>
+   <layout class="QVBoxLayout" name="verticalLayout_2">
+    <item>
+     <widget class="QLabel" name="label_4">
+      <property name="text">
+       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; \
font-size:12pt; font-weight:600;&quot;&gt;Before you use the remote installer please \
check that:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> +      \
</property> +     </widget>
+    </item>
+    <item>
+     <widget class="KSeparator" name="kseparator_4"/>
+    </item>
+    <item>
+     <widget class="QLabel" name="label_9">
+      <property name="text">
+       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; \
font-size:10pt; font-weight:600;&quot;&gt;the sshd daemon has started in the target \
pc&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt; \
font-weight:600;&quot;&gt;the ssh port is \
opened&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> +      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QLabel" name="srcLabel1">
+      <property name="text">
+       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; \
font-size:12pt; font-weight:600;&quot;&gt;Source&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
 +      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="KSeparator" name="srcSeparator"/>
+    </item>
+    <item>
+     <widget class="QLabel" name="srcLabel2">
+      <property name="text">
+       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Choose the source \
directory of your package.&lt;/p&gt;&lt;p&gt;Your url must end in a metadata.desktop \
file&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> +      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="KUrlRequester" name="srcDirUrl"/>
+    </item>
+    <item>
+     <widget class="QLabel" name="label_5">
+      <property name="text">
+       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; \
font-size:12pt; font-weight:600;&quot;&gt;Username&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
 +      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="KSeparator" name="kseparator"/>
+    </item>
+    <item>
+     <widget class="QLabel" name="label_3">
+      <property name="text">
+       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter the username of \
the target pc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> +      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="KLineEdit" name="usernameLineEdit"/>
+    </item>
+    <item>
+     <widget class="QLabel" name="label_6">
+      <property name="text">
+       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; \
font-size:12pt; font-weight:600;&quot;&gt;Hostname&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
 +      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="KSeparator" name="kseparator_2"/>
+    </item>
+    <item>
+     <widget class="QLabel" name="label_7">
+      <property name="text">
+       <string>Enter the hostname of the target pc</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="KLineEdit" name="hostnameLineEdit"/>
+    </item>
+    <item>
+     <widget class="QLabel" name="label">
+      <property name="text">
+       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; \
font-size:12pt;&quot;&gt;Install \
Package&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> +      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="KPushButton" name="installButton">
+      <property name="text">
+       <string>Install the package</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KLineEdit</class>
+   <extends>QLineEdit</extends>
+   <header>klineedit.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KSeparator</class>
+   <extends>QFrame</extends>
+   <header>kseparator.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KPushButton</class>
+   <extends>QPushButton</extends>
+   <header>kpushbutton.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KUrlRequester</class>
+   <extends>QFrame</extends>
+   <header>kurlrequester.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/publisher/remoteinstaller/remoteinstallerdialog.cpp \
b/publisher/remoteinstaller/remoteinstallerdialog.cpp new file mode 100644
index 0000000..aed72db
--- /dev/null
+++ b/publisher/remoteinstaller/remoteinstallerdialog.cpp
@@ -0,0 +1,88 @@
+/*
+ *  Copyright 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ */
+
+#include "remoteinstallerdialog.h"
+#include "remoteinstaller.h"
+
+#include <QFile>
+#include <QPointer>
+#include <QVBoxLayout>
+#include <QLabel>
+
+#include <KMessageBox>
+
+RemoteInstallerDialog::RemoteInstallerDialog(QWidget* parent)
+        : QDialog(parent),
+        m_installer(0)
+{
+    QWidget *widget = new QWidget();
+
+    m_ui.setupUi(widget);
+
+    QVBoxLayout *layout = new QVBoxLayout();
+    layout->addWidget(widget);
+    setLayout(layout);
+
+    //we don't want the ok button to be enabled
+    //before we get all the necessary informations
+    m_ui.installButton->setEnabled(false);
+
+    connect(m_ui.usernameLineEdit, SIGNAL(textChanged(QString)), this, \
SLOT(checkInformations())); +    connect(m_ui.hostnameLineEdit, \
SIGNAL(textChanged(QString)), this, SLOT(checkInformations())); +    \
connect(m_ui.installButton, SIGNAL(clicked()), this, SLOT(install())); +
+    //we don't want the source relative ui to be visible.
+    //We will get this information from plasmate.
+    m_ui.srcLabel1->setVisible(false);
+    m_ui.srcLabel2->setVisible(false);
+    m_ui.srcDirUrl->setVisible(false);
+    m_ui.srcSeparator->setVisible(false);
+}
+
+void RemoteInstallerDialog::checkInformations()
+{
+    QString username = m_ui.usernameLineEdit->text();
+
+    //we don't want spaces
+    username = username.replace(' ', "");
+
+    QString hostname = m_ui.hostnameLineEdit->text();
+
+    //we don't want spaces
+    hostname = hostname.replace(' ', "");
+
+    QFile metadateDesktopFile(m_packagePath);
+    if (!metadateDesktopFile.exists()) {
+        return;
+    }
+
+    if (!username.isEmpty() && !hostname.isEmpty()) {
+        m_username = username;
+        m_hostname = hostname;
+
+        //now enable the install button
+        m_ui.installButton->setEnabled(true);
+    }
+}
+
+
+void RemoteInstallerDialog::install()
+{
+    m_installer = new RemoteInstaller(m_username, m_hostname, m_packagePath, this);
+}
+
+QString RemoteInstallerDialog::packagePath() const
+{
+    return m_packagePath;
+}
+
+void RemoteInstallerDialog::setPackagePath(const QString& path)
+{
+    m_packagePath = path;
+}
diff --git a/publisher/remoteinstaller/remoteinstallerdialog.h \
b/publisher/remoteinstaller/remoteinstallerdialog.h new file mode 100644
index 0000000..89c9a84
--- /dev/null
+++ b/publisher/remoteinstaller/remoteinstallerdialog.h
@@ -0,0 +1,42 @@
+/*
+ *  Copyright 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ */
+
+#ifndef REMOTEINSTALLERDIALOG_H
+#define REMOTEINSTALLERDIALOG_H
+
+#include <KDialog>
+
+#include "ui_remoteinstaller.h"
+
+class RemoteInstaller;
+
+class RemoteInstallerDialog : public QDialog
+{
+    Q_OBJECT;
+public:
+    RemoteInstallerDialog(QWidget* parent = 0);
+
+    QString packagePath() const;
+    void setPackagePath(const QString& path);
+
+private Q_SLOTS:
+    void install();
+    void checkInformations();
+
+protected:
+    Ui::RemoteInstaller m_ui;
+
+private:
+    RemoteInstaller *m_installer;
+    QString m_packagePath;
+    QString m_username;
+    QString m_hostname;
+};
+
+#endif // PUBLISHER_H
diff --git a/publisher/remoteinstaller/standalone/main.cpp \
b/publisher/remoteinstaller/standalone/main.cpp new file mode 100644
index 0000000..9c940d3
--- /dev/null
+++ b/publisher/remoteinstaller/standalone/main.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <KApplication>
+#include <KAboutData>
+#include <KLocale>
+#include <KCmdLineArgs>
+
+#include <QPointer>
+
+#include "plasmaremoteinstaller.h"
+
+int main(int argc, char *argv[])
+{
+    KAboutData aboutData("plasmaremoteinstaller", 0, ki18n("Plasma Remote \
installer"), +                         "0.1alpha3", ki18n("Plasma Remote Installer"),
+                         KAboutData::License_GPL,
+                         ki18n("Copyright 2012 Plasma Development Team"),
+                         KLocalizedString(), "", "plasma-devel@kde.org");
+
+    aboutData.addAuthor(ki18n("Giorgos Tsiapaliwkas"), ki18n("Author"), \
"terietor@gmail.com"); +    aboutData.setProgramIconName("plasmagik");
+
+    KCmdLineArgs::init(argc, argv, &aboutData);
+
+    KCmdLineOptions options;
+    KCmdLineArgs::addCmdLineOptions(options);
+    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+    KApplication app;
+
+    QPointer<PlasmaRemoteInstaller> dialog = new PlasmaRemoteInstaller();
+    dialog->exec();
+    delete dialog;
+
+    return app.exec();
+}
+
diff --git a/publisher/remoteinstaller/standalone/plasmaremoteinstaller.cpp \
b/publisher/remoteinstaller/standalone/plasmaremoteinstaller.cpp new file mode 100644
index 0000000..68554d4
--- /dev/null
+++ b/publisher/remoteinstaller/standalone/plasmaremoteinstaller.cpp
@@ -0,0 +1,46 @@
+/*
+ *  Copyright 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ */
+
+#include "plasmaremoteinstaller.h"
+
+PlasmaRemoteInstaller::PlasmaRemoteInstaller(QWidget* parent)
+        : RemoteInstallerDialog(parent)
+{
+    connect(m_ui.srcDirUrl, SIGNAL(textChanged(QString)), this, \
SLOT(checkProjectPath(QString))); +
+
+    //disable the buttons. The user hasn't give a path yet.
+    m_ui.usernameLineEdit->setEnabled(false);
+    m_ui.hostnameLineEdit->setEnabled(false);
+
+    //we want the source relative ui to be visible.
+    m_ui.srcLabel1->setVisible(true);
+    m_ui.srcLabel2->setVisible(true);
+    m_ui.srcDirUrl->setVisible(true);
+    m_ui.srcSeparator->setVisible(true);
+}
+
+void PlasmaRemoteInstaller::checkProjectPath(const QString& path)
+{
+    if (path.isEmpty()) {
+        return;
+    }
+
+    //check if projectName/metadata.desktop exists
+    if(path.endsWith("metadata.desktop")) {
+        setPackagePath(path);
+        m_ui.usernameLineEdit->setEnabled(true);
+        m_ui.hostnameLineEdit->setEnabled(true);
+    } else {
+        m_ui.usernameLineEdit->setEnabled(false);
+        m_ui.hostnameLineEdit->setEnabled(false);
+    }
+}
+
+#include "moc_plasmaremoteinstaller.cpp"
\ No newline at end of file
diff --git a/publisher/remoteinstaller/standalone/plasmaremoteinstaller.h \
b/publisher/remoteinstaller/standalone/plasmaremoteinstaller.h new file mode 100644
index 0000000..dfe10ed
--- /dev/null
+++ b/publisher/remoteinstaller/standalone/plasmaremoteinstaller.h
@@ -0,0 +1,26 @@
+/*
+ *  Copyright 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ */
+
+#ifndef PLASMAREMOTEINSTALLER_H
+#define PLASMAREMOTEINSTALLER_H
+
+#include "../remoteinstallerdialog.h"
+
+class PlasmaRemoteInstaller : public RemoteInstallerDialog
+{
+    Q_OBJECT;
+public:
+    PlasmaRemoteInstaller(QWidget* parent = 0);
+
+public Q_SLOTS:
+    void checkProjectPath(const QString& path);
+private:
+};
+
+#endif // PUBLISHER_H


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic