Diffstat (limited to 'core/launcher/packageslave.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/packageslave.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/launcher/packageslave.cpp b/core/launcher/packageslave.cpp index 0461432..abbc610 100644 --- a/core/launcher/packageslave.cpp +++ b/core/launcher/packageslave.cpp | |||
@@ -44,86 +44,96 @@ using namespace Opie::Core; | |||
44 | #elif defined(Q_OS_MACX) | 44 | #elif defined(Q_OS_MACX) |
45 | #include <unistd.h> | 45 | #include <unistd.h> |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | 48 | ||
49 | PackageHandler::PackageHandler( QObject *parent, char* name ) | 49 | PackageHandler::PackageHandler( QObject *parent, char* name ) |
50 | : QObject( parent, name ), packageChannel( 0 ), currentProcess( 0 ), mNoSpaceLeft( FALSE ) | 50 | : QObject( parent, name ), packageChannel( 0 ), currentProcess( 0 ), mNoSpaceLeft( FALSE ) |
51 | { | 51 | { |
52 | // setup qcop channel | 52 | // setup qcop channel |
53 | #ifndef QT_NO_COP | 53 | #ifndef QT_NO_COP |
54 | packageChannel = new QCopChannel( "QPE/Package", this ); | 54 | packageChannel = new QCopChannel( "QPE/Package", this ); |
55 | connect( packageChannel, SIGNAL( received(const QCString&,const QByteArray&) ), | 55 | connect( packageChannel, SIGNAL( received(const QCString&,const QByteArray&) ), |
56 | this, SLOT( qcopMessage(const QCString&,const QByteArray&) ) ); | 56 | this, SLOT( qcopMessage(const QCString&,const QByteArray&) ) ); |
57 | #endif | 57 | #endif |
58 | } | 58 | } |
59 | 59 | ||
60 | void PackageHandler::qcopMessage( const QCString &msg, const QByteArray &data ) | 60 | void PackageHandler::qcopMessage( const QCString &msg, const QByteArray &data ) |
61 | { | 61 | { |
62 | QDataStream stream( data, IO_ReadOnly ); | 62 | QDataStream stream( data, IO_ReadOnly ); |
63 | 63 | ||
64 | if ( msg == "installPackage(QString)" ) { | 64 | if ( msg == "installPackage(QString)" ) { |
65 | QString file; | 65 | QString file; |
66 | stream >> file; | 66 | stream >> file; |
67 | installPackage( file ); | 67 | installPackage( file ); |
68 | } else if ( msg == "installPackage(QString,QString)" ) { | ||
69 | QString file, dest; | ||
70 | stream >> file >> dest; | ||
71 | installPackage( file, dest ); | ||
68 | } else if ( msg == "removePackage(QString)" ) { | 72 | } else if ( msg == "removePackage(QString)" ) { |
69 | QString file; | 73 | QString file; |
70 | stream >> file; | 74 | stream >> file; |
71 | removePackage( file ); | 75 | removePackage( file ); |
72 | } else if ( msg == "addPackageFiles(QString,QString)" ) { | 76 | } else if ( msg == "addPackageFiles(QString,QString)" ) { |
73 | QString location, listfile; | 77 | QString location, listfile; |
74 | stream >> location >> listfile; | 78 | stream >> location >> listfile; |
75 | addPackageFiles( location, listfile); | 79 | addPackageFiles( location, listfile); |
76 | } else if ( msg == "addPackages(QString)" ) { | 80 | } else if ( msg == "addPackages(QString)" ) { |
77 | QString location; | 81 | QString location; |
78 | stream >> location; | 82 | stream >> location; |
79 | addPackages( location ); | 83 | addPackages( location ); |
80 | } else if ( msg == "cleanupPackageFiles(QString)" ) { | 84 | } else if ( msg == "cleanupPackageFiles(QString)" ) { |
81 | QString listfile; | 85 | QString listfile; |
82 | stream >> listfile; | 86 | stream >> listfile; |
83 | cleanupPackageFiles( listfile ); | 87 | cleanupPackageFiles( listfile ); |
84 | } else if ( msg == "cleanupPackages(QString)" ) { | 88 | } else if ( msg == "cleanupPackages(QString)" ) { |
85 | QString location; | 89 | QString location; |
86 | stream >> location; | 90 | stream >> location; |
87 | cleanupPackages( location ); | 91 | cleanupPackages( location ); |
88 | } else if ( msg == "prepareInstall(QString,QString)" ) { | 92 | } else if ( msg == "prepareInstall(QString,QString)" ) { |
89 | QString size, path; | 93 | QString size, path; |
90 | stream >> size; | 94 | stream >> size; |
91 | stream >> path; | 95 | stream >> path; |
92 | prepareInstall( size, path ); | 96 | prepareInstall( size, path ); |
93 | } | 97 | } |
94 | } | 98 | } |
95 | 99 | ||
96 | void PackageHandler::installPackage( const QString &package ) | 100 | void PackageHandler::installPackage( const QString &package, const QString &dest ) |
97 | { | 101 | { |
98 | if ( mNoSpaceLeft ) { | 102 | if ( mNoSpaceLeft ) { |
99 | mNoSpaceLeft = FALSE; | 103 | mNoSpaceLeft = FALSE; |
100 | // Don't emit that for now, I still couldn't test it (Wener) | 104 | // Don't emit that for now, I still couldn't test it (Wener) |
101 | //sendReply( "installFailed(QString)", package ); | 105 | //sendReply( "installFailed(QString)", package ); |
102 | //return; | 106 | //return; |
103 | } | 107 | } |
104 | 108 | ||
105 | currentProcess = new QProcess( QStringList() << "ipkg" << "install" << package ); // No tr | 109 | QStringList cmd; |
110 | cmd << "ipkg"; | ||
111 | if ( !dest.isEmpty() ) { | ||
112 | cmd << "-d" << dest; | ||
113 | } | ||
114 | cmd << "install" << package; | ||
115 | currentProcess = new QProcess( cmd ); // No tr | ||
106 | connect( currentProcess, SIGNAL( processExited() ), SLOT( iProcessExited() ) ); | 116 | connect( currentProcess, SIGNAL( processExited() ), SLOT( iProcessExited() ) ); |
107 | connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) ); | 117 | connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) ); |
108 | connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) ); | 118 | connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) ); |
109 | currentPackage = package; | 119 | currentPackage = package; |
110 | 120 | ||
111 | currentProcessError=""; | 121 | currentProcessError=""; |
112 | sendReply( "installStarted(QString)", package ); | 122 | sendReply( "installStarted(QString)", package ); |
113 | currentProcess->start(); | 123 | currentProcess->start(); |
114 | } | 124 | } |
115 | 125 | ||
116 | void PackageHandler::removePackage( const QString &package ) | 126 | void PackageHandler::removePackage( const QString &package ) |
117 | { | 127 | { |
118 | currentProcess = new QProcess( QStringList() << "ipkg" << "remove" << package ); // No tr | 128 | currentProcess = new QProcess( QStringList() << "ipkg" << "remove" << package ); // No tr |
119 | connect( currentProcess, SIGNAL( processExited() ), SLOT( rmProcessExited() ) ); | 129 | connect( currentProcess, SIGNAL( processExited() ), SLOT( rmProcessExited() ) ); |
120 | connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) ); | 130 | connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) ); |
121 | connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) ); | 131 | connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) ); |
122 | currentPackage = package; | 132 | currentPackage = package; |
123 | 133 | ||
124 | currentProcessError=""; | 134 | currentProcessError=""; |
125 | sendReply( "removeStarted(QString)", package ); | 135 | sendReply( "removeStarted(QString)", package ); |
126 | currentProcess->start(); | 136 | currentProcess->start(); |
127 | } | 137 | } |
128 | 138 | ||
129 | void PackageHandler::sendReply( const QCString& msg, const QString& arg ) | 139 | void PackageHandler::sendReply( const QCString& msg, const QString& arg ) |