Git commit db3923496fcc1b72d72f4422942b0f382a367e0f by Giorgos Tsiapaliwkas. Committed on 24/05/2012 at 18:40. Pushed by tsiapaliwkas into branch 'terietor/remoteinstaller'. Populate the remoteinstaller M +2 -5 CMakeLists.txt M +9 -0 publisher/publisher.cpp M +14 -16 publisher/remoteinstaller/remoteinstaller.cpp M +3 -2 publisher/remoteinstaller/remoteinstaller.h M +117 -69 publisher/remoteinstaller/remoteinstaller.ui M +55 -7 publisher/remoteinstaller/remoteinstallerdialog.cpp M +17 -6 publisher/remoteinstaller/remoteinstallerdialog.h M +1 -0 publisher/remoteinstaller/standalone/main.cpp M +12 -21 publisher/remoteinstaller/standalone/plasmaremoteinstaller.c= pp M +3 -7 publisher/remoteinstaller/standalone/plasmaremoteinstaller.h D +0 -120 publisher/remoteinstaller/standalone/plasmaremoteinstaller.ui http://commits.kde.org/plasmate/db3923496fcc1b72d72f4422942b0f382a367e0f diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bffc9e..5113adf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,7 +77,7 @@ kde4_add_ui_files (PlasMate_SRC include_directories(${KDE4_INCLUDES} ${QT_QTWEBKIT_INCLUDE_DIR} ${QGPGME_INCLUDE_DIR} - ${GPGME_INCLUDES} + ${GPGME_INCLUDES} ) = add_subdirectory( editors ) @@ -108,15 +108,12 @@ install(FILES plasmate.knsrc DESTINATION ${CONFIG_INS= TALL_DIR}) = #standalone applications set (PlasmaRemoteInstaller_SRC + publisher/remoteinstaller/remoteinstallerdialog.cpp publisher/remoteinstaller/remoteinstaller.cpp publisher/remoteinstaller/standalone/main.cpp publisher/remoteinstaller/standalone/plasmaremoteinstaller.cpp ) = -kde4_add_ui_files (PlasmaRemoteInstaller_SRC - publisher/remoteinstaller/standalone/plasmaremoteinstaller.ui -) - kde4_add_executable(plasmaremoteinstaller ${PlasmaRemoteInstaller_SRC}) target_link_libraries(plasmaremoteinstaller ${KDE4_KDEUI_LIBS} diff --git a/publisher/publisher.cpp b/publisher/publisher.cpp index bcace17..202239e 100644 --- a/publisher/publisher.cpp +++ b/publisher/publisher.cpp @@ -282,6 +282,15 @@ void Publisher::doRemoteInstall(int index) } = QPointer dialog =3D new RemoteInstallerDialog(); + + //get the source directory from plasmaterc + KConfigGroup c(KGlobal::config(), "PackageModel::package"); + QString path =3D c.readEntry("lastLoadedPackage", QString()); + + //our path must end with metadata.desktop file + path.append("metadata.desktop"); + dialog->setPackagePath(path); + dialog->exec(); delete dialog; } diff --git a/publisher/remoteinstaller/remoteinstaller.cpp b/publisher/remo= teinstaller/remoteinstaller.cpp index 9c3729e..01280cb 100644 --- a/publisher/remoteinstaller/remoteinstaller.cpp +++ b/publisher/remoteinstaller/remoteinstaller.cpp @@ -10,11 +10,10 @@ #include "remoteinstaller.h" = #include -#include -#include -#include +#include = #include +#include = RemoteInstaller::RemoteInstaller(QObject* parent) : QObject(parent) @@ -22,26 +21,25 @@ RemoteInstaller::RemoteInstaller(QObject* parent) } = #include -void RemoteInstaller::install(const QString& username, const QString& ip, = QWidget *window) +void RemoteInstaller::install(const QString& username, const QString& ip, + const QString& source, const QString& tempor= aryDirectory, QWidget *window) { //like fish://username@192.123.23.1 - KUrl execUrl =3D "fish://" + username + "@" + ip; + QString execUrl =3D "fish://" + username + "@" + ip; = - //now we need the src - KConfigGroup c(KGlobal::config(), "PackageModel::package"); - QString src =3D c.readEntry("lastLoadedPackage", QString()); + //we need the url of the src + QString destinationPath; + destinationPath.append(execUrl); + destinationPath.append(temporaryDirectory); = - //now we need the destination in the target pc - QString destination =3D KIO::NetAccess::fish_execute(execUrl, "kde4-co= nfig --path data > ~/a", window); - - qDebug() << "dest" << destination; //copy the project in the target's plasmate data directory - //KIO::NetAccess::dircopy(src, destination, window); + KIO::copy(source, temporaryDirectory); + + //we need the name of the package + QDir packageDir(source); = - //TODO we need both but this isn't a good solution //execute plasmapkg - //KIO::NetAccess::fish_execute(execUrl, "plasmapkg -i + projectPath, w= indow); - // KIO::NetAccess::fish_execute(execUrl, "plasmapkg -u + projectPath, = window); + KIO::NetAccess::fish_execute(execUrl, "plasmapkg -u" + destinationPat= h + packageDir.dirName(), window); = //execute kbuildsycoca4 KIO::NetAccess::fish_execute(execUrl, "kbuildsycoca4", window); diff --git a/publisher/remoteinstaller/remoteinstaller.h b/publisher/remote= installer/remoteinstaller.h index 07eecf5..88117ed 100644 --- a/publisher/remoteinstaller/remoteinstaller.h +++ b/publisher/remoteinstaller/remoteinstaller.h @@ -1,6 +1,6 @@ /* * Copyright 2012 Giorgos Tsiapaliwkas - * = + * * 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 @@ -21,7 +21,8 @@ class RemoteInstaller : public QObject public: RemoteInstaller(QObject* parent =3D 0); = - static void install(const QString& username, const QString& ip, QWidge= t *window); + static void install(const QString& username, const QString& ip, + const QString& source, const QString& temporaryDir= ectory, QWidget *window); }; = #endif // PUBLISHER_H diff --git a/publisher/remoteinstaller/remoteinstaller.ui b/publisher/remot= einstaller/remoteinstaller.ui index a9f1ee5..d2ae349 100644 --- a/publisher/remoteinstaller/remoteinstaller.ui +++ b/publisher/remoteinstaller/remoteinstaller.ui @@ -6,89 +6,122 @@ 0 0 - 612 - 250 + 643 + 512 550 - 250 + 450 Form - + - 0 - 0 - 614 - 221 + 10 + 10 + 501 + 440 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <html><head/><body><p><span st= yle=3D" font-weight:600;">HINT: Add below the username and the= ip of the target computer</span></p></body></html>= - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Target ip address - - - - - - - - - - Target Username - - - - - - - + + + + + <html><head/><body><p><span styl= e=3D" font-size:12pt; font-weight:600;">Source</span><= ;/p></body></html> + + + + + + + + + + <html><head/><body><p>Choose the so= urce directory of your package.</p><p>Your url must end in a me= tadata.desktop file</p></body></html> + + + + + + + + + + <html><head/><body><p><span styl= e=3D" font-size:12pt; font-weight:600;">Username</span>&= lt;/p></body></html> + + + + + + + + + + <html><head/><body><p>Enter the use= rname of the target pc.</p></body></html> + + + + + + + + + + <html><head/><body><p><span styl= e=3D" font-size:12pt; font-weight:600;">IP Address</span>= ;</p></body></html> + + + + + + + + + + Enter the IP Address of the target pc + + + + + + + + + + <html><head/><body><p><span styl= e=3D" font-size:12pt; font-weight:600;">Temporary Directory<= ;/span></p></body></html> + + + + + + + + + + <html><head/><body><p>For this proc= ess the remote installer will need a temporary directory.</p><p>= ;Choose one. After the installation the temporary directory will be</p&g= t;<p>untouched.</p></body></html> + + + + + + + + + + <html><head/><body><p><span styl= e=3D" font-size:12pt;">Install Package</span></p>&= lt;/body></html> + + + + + + + Install the package + + @@ -99,6 +132,21 @@ QLineEdit
klineedit.h
+ + KSeparator + QFrame +
kseparator.h
+
+ + KPushButton + QPushButton +
kpushbutton.h
+
+ + KUrlRequester + QFrame +
kurlrequester.h
+
diff --git a/publisher/remoteinstaller/remoteinstallerdialog.cpp b/publishe= r/remoteinstaller/remoteinstallerdialog.cpp index bd643c3..04bd13e 100644 --- a/publisher/remoteinstaller/remoteinstallerdialog.cpp +++ b/publisher/remoteinstaller/remoteinstallerdialog.cpp @@ -10,23 +10,71 @@ #include "remoteinstallerdialog.h" #include "remoteinstaller.h" = +#include +#include + RemoteInstallerDialog::RemoteInstallerDialog(QWidget* parent) - : KDialog(parent) + : QDialog(parent) { - QWidget *widget =3D new QWidget(this); + QWidget *widget =3D new QWidget(); = m_ui.setupUi(widget); - setMainWidget(widget); = - connect(this, SIGNAL(okClicked()), this, SLOT(install())); + QVBoxLayout *layout =3D 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(const QString&)), th= is, SLOT(checkInformations())); + connect(m_ui.ipLineEdit, SIGNAL(textChanged(const QString&)), this, SL= OT(checkInformations())); + connect(m_ui.tmpDirUrl, SIGNAL(textChanged(const QString&)), this, SLO= T(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::install() +void RemoteInstallerDialog::checkInformations() { const QString username =3D m_ui.usernameLineEdit->text(); const QString ip =3D m_ui.ipLineEdit->text(); - if (!username.isEmpty() && !ip.isEmpty()) { - RemoteInstaller::install(username, ip, this); + const QString tmpDir =3D m_ui.tmpDirUrl->text(); + + QFile metadateDesktopFile(m_packagePath); + if (!metadateDesktopFile.exists()) { + return; + } + + if (!username.isEmpty() && !ip.isEmpty() && !tmpDir.isEmpty()) { + m_username =3D username; + m_ip =3D ip; + m_tmpDir =3D tmpDir; + + //now enable the install button + m_ui.installButton->setEnabled(true); } } = + +void RemoteInstallerDialog::install() +{ + RemoteInstaller::install(m_username, m_ip, m_packagePath, m_tmpDir, th= is); +} + +QString RemoteInstallerDialog::packagePath() const +{ + return m_packagePath; +} + +void RemoteInstallerDialog::setPackagePath(const QString& path) +{ + m_packagePath =3D path; +} diff --git a/publisher/remoteinstaller/remoteinstallerdialog.h b/publisher/= remoteinstaller/remoteinstallerdialog.h index 0ab7b85..b84f9c3 100644 --- a/publisher/remoteinstaller/remoteinstallerdialog.h +++ b/publisher/remoteinstaller/remoteinstallerdialog.h @@ -1,6 +1,6 @@ /* * Copyright 2012 Giorgos Tsiapaliwkas - * = + * * 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 @@ -10,20 +10,31 @@ #ifndef REMOTEINSTALLERDIALOG_H #define REMOTEINSTALLERDIALOG_H = -#include +#include = #include "ui_remoteinstaller.h" = -class RemoteInstallerDialog : public KDialog +class RemoteInstallerDialog : public QDialog { Q_OBJECT; public: RemoteInstallerDialog(QWidget* parent =3D 0); - = -public Q_SLOTS: + + QString packagePath() const; + void setPackagePath(const QString& path); + +private Q_SLOTS: void install(); -private: + void checkInformations(); + +protected: Ui::RemoteInstaller m_ui; + +private: + QString m_packagePath; + QString m_username; + QString m_ip; + QString m_tmpDir; }; = #endif // PUBLISHER_H diff --git a/publisher/remoteinstaller/standalone/main.cpp b/publisher/remo= teinstaller/standalone/main.cpp index 71f3954..4471197 100644 --- a/publisher/remoteinstaller/standalone/main.cpp +++ b/publisher/remoteinstaller/standalone/main.cpp @@ -33,6 +33,7 @@ int main(int argc, char *argv[]) KLocalizedString(), "", "plasma-devel@kde.org"); = aboutData.addAuthor(ki18n("Giorgos Tsiapaliwkas"), ki18n("Author"), "t= erietor@gmail.com"); + aboutData.setProgramIconName("plasmagik"); = KCmdLineArgs::init(argc, argv, &aboutData); = diff --git a/publisher/remoteinstaller/standalone/plasmaremoteinstaller.cpp= b/publisher/remoteinstaller/standalone/plasmaremoteinstaller.cpp index 3fa4a4f..a1d6216 100644 --- a/publisher/remoteinstaller/standalone/plasmaremoteinstaller.cpp +++ b/publisher/remoteinstaller/standalone/plasmaremoteinstaller.cpp @@ -8,32 +8,23 @@ */ = #include "plasmaremoteinstaller.h" -#include "../remoteinstaller.h" = PlasmaRemoteInstaller::PlasmaRemoteInstaller(QWidget* parent) - : KDialog(parent) + : RemoteInstallerDialog(parent) { - QWidget *widget =3D new QWidget(this); + connect(m_ui.srcDirUrl, SIGNAL(textChanged(const QString&)), this, SLO= T(checkProjectPath(const QString&))); = - m_ui.setupUi(widget); - setMainWidget(widget); - - connect(this, SIGNAL(okClicked()), this, SLOT(install())); - connect(m_ui.srcUrl, SIGNAL(textChanged(const QString&)), this, SLOT(c= heckProjectPath(const QString&))); = //disable the buttons. The user hasn't give a path yet. m_ui.usernameLineEdit->setEnabled(false); m_ui.ipLineEdit->setEnabled(false); - enableButtonOk(false); -} + m_ui.tmpDirUrl->setEnabled(false); = -void PlasmaRemoteInstaller::install() -{ - const QString username =3D m_ui.usernameLineEdit->text(); - const QString ip =3D m_ui.ipLineEdit->text(); - if (!username.isEmpty() && !ip.isEmpty()) { - RemoteInstaller::install(username, ip, this); - } + //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) @@ -44,13 +35,13 @@ void PlasmaRemoteInstaller::checkProjectPath(const QStr= ing& path) = //check if projectName/metadata.desktop exists if(path.endsWith("metadata.desktop")) { - m_ui.usernameLineEdit->setEnabled(true); + setPackagePath(path); + m_ui.usernameLineEdit->setEnabled(true); m_ui.ipLineEdit->setEnabled(true); - enableButtonOk(true); + m_ui.tmpDirUrl->setEnabled(true); } else { m_ui.usernameLineEdit->setEnabled(false); m_ui.ipLineEdit->setEnabled(false); - enableButtonOk(false); + m_ui.tmpDirUrl->setEnabled(false); } } - diff --git a/publisher/remoteinstaller/standalone/plasmaremoteinstaller.h b= /publisher/remoteinstaller/standalone/plasmaremoteinstaller.h index 9145ce7..dfe10ed 100644 --- a/publisher/remoteinstaller/standalone/plasmaremoteinstaller.h +++ b/publisher/remoteinstaller/standalone/plasmaremoteinstaller.h @@ -1,6 +1,6 @@ /* * Copyright 2012 Giorgos Tsiapaliwkas - * = + * * 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 @@ -10,21 +10,17 @@ #ifndef PLASMAREMOTEINSTALLER_H #define PLASMAREMOTEINSTALLER_H = -#include +#include "../remoteinstallerdialog.h" = -#include "ui_plasmaremoteinstaller.h" - -class PlasmaRemoteInstaller : public KDialog +class PlasmaRemoteInstaller : public RemoteInstallerDialog { Q_OBJECT; public: PlasmaRemoteInstaller(QWidget* parent =3D 0); = public Q_SLOTS: - void install(); void checkProjectPath(const QString& path); private: - Ui::PlasmaRemoteInstaller m_ui; }; = #endif // PUBLISHER_H diff --git a/publisher/remoteinstaller/standalone/plasmaremoteinstaller.ui = b/publisher/remoteinstaller/standalone/plasmaremoteinstaller.ui deleted file mode 100644 index 1965c44..0000000 --- a/publisher/remoteinstaller/standalone/plasmaremoteinstaller.ui +++ /dev/null @@ -1,120 +0,0 @@ - - - PlasmaRemoteInstaller - - - - 0 - 0 - 652 - 260 - - - - - 650 - 250 - - - - Form - - - - - 0 - 0 - 651 - 251 - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <html><head/><body><p><span st= yle=3D" font-weight:600;">HINT: Add below the username and the= ip of the target computer</span></p></body></html>= - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Target ip address - - - - - - - Target Username - - - - - - - - - - - - - Project source - - - - - - - - - - - - - - KLineEdit - QLineEdit -
klineedit.h
-
- - KUrlRequester - QFrame -
kurlrequester.h
-
-
- - -