author | drw <drw> | 2004-01-20 19:33:27 (UTC) |
---|---|---|
committer | drw <drw> | 2004-01-20 19:33:27 (UTC) |
commit | da0557836c852fade427c03ad59d349f3294bbb8 (patch) (unidiff) | |
tree | 979907c816c09f3b3a290b58eac353094cbcd90e | |
parent | 996826e77a8f96ada424814716178e65caba9287 (diff) | |
download | opie-da0557836c852fade427c03ad59d349f3294bbb8.zip opie-da0557836c852fade427c03ad59d349f3294bbb8.tar.gz opie-da0557836c852fade427c03ad59d349f3294bbb8.tar.bz2 |
Convert to use libipkg
-rw-r--r-- | noncore/settings/packagemanager/.cvsignore | 2 | ||||
-rw-r--r-- | noncore/settings/packagemanager/ChangeLog | 7 | ||||
-rw-r--r-- | noncore/settings/packagemanager/installdlg.cpp | 76 | ||||
-rw-r--r-- | noncore/settings/packagemanager/installdlg.h | 4 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 6 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkg.cpp | 188 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkg.h | 17 | ||||
-rw-r--r-- | noncore/settings/packagemanager/opackagemanager.cpp | 11 | ||||
-rw-r--r-- | noncore/settings/packagemanager/opackagemanager.h | 4 | ||||
-rw-r--r-- | noncore/settings/packagemanager/opie-packagemanager.control | 2 | ||||
-rw-r--r-- | noncore/settings/packagemanager/packagemanager.pro | 9 |
11 files changed, 135 insertions, 191 deletions
diff --git a/noncore/settings/packagemanager/.cvsignore b/noncore/settings/packagemanager/.cvsignore index 4183697..9f2b524 100644 --- a/noncore/settings/packagemanager/.cvsignore +++ b/noncore/settings/packagemanager/.cvsignore | |||
@@ -1,3 +1,5 @@ | |||
1 | Makefile* | 1 | Makefile* |
2 | moc* | 2 | moc* |
3 | .moc* | 3 | .moc* |
4 | .obj | ||
5 | .moc | ||
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog index a01c8b3..1ba12af 100644 --- a/noncore/settings/packagemanager/ChangeLog +++ b/noncore/settings/packagemanager/ChangeLog | |||
@@ -1,4 +1,9 @@ | |||
1 | 2004-01-nn Dan Williams <drw@handhelds.org> | 1 | 2004-01-20 Dan Williams <drw@handhelds.org> |
2 | |||
3 | * Released version 0.2.0 | ||
4 | * Converted to use libipkg in place of spawning ipkg process | ||
5 | |||
6 | 2004-01-13 Dan Williams <drw@handhelds.org> | ||
2 | 7 | ||
3 | * Released version 0.1.0 | 8 | * Released version 0.1.0 |
4 | * Initial check-in of new package management client to eventually replace AQPkg | 9 | * Initial check-in of new package management client to eventually replace AQPkg |
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp index 980d5eb..6a9ccbd 100644 --- a/noncore/settings/packagemanager/installdlg.cpp +++ b/noncore/settings/packagemanager/installdlg.cpp | |||
@@ -193,59 +193,78 @@ void InstallDlg::slotDisplayAvailSpace( const QString &destination ) | |||
193 | if ( !div ) div = 1; | 193 | if ( !div ) div = 1; |
194 | long avail = fs.f_bavail * mult / div; | 194 | long avail = fs.f_bavail * mult / div; |
195 | 195 | ||
196 | space = tr( "%1 Kb" ).arg( avail ); | 196 | space = tr( "%1 Kb" ).arg( avail ); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | 199 | ||
200 | // Display available space | 200 | // Display available space |
201 | m_availSpace->setText( space ); | 201 | m_availSpace->setText( space ); |
202 | } | 202 | } |
203 | 203 | ||
204 | void InstallDlg::slotBtnStart() | 204 | void InstallDlg::slotBtnStart() |
205 | { | 205 | { |
206 | QString btnText = m_btnStart->text(); | 206 | QString btnText = m_btnStart->text(); |
207 | if ( btnText == tr( "Abort" ) ) | 207 | if ( btnText == tr( "Abort" ) ) |
208 | { | 208 | { |
209 | // Stop execution of current command and prevent any others from executing | 209 | // Prevent unexecuted commands from executing |
210 | m_packman->abortCommand(); | ||
211 | m_currCommand = 999; | 210 | m_currCommand = 999; |
212 | 211 | ||
213 | // Allow user to close dialog | 212 | // Allow user to close dialog |
214 | m_btnStart->setText( tr( "Close" ) ); | 213 | m_btnStart->setText( tr( "Close" ) ); |
215 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); | 214 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); |
216 | return; | 215 | return; |
217 | } | 216 | } |
218 | else if ( btnText == tr( "Close" ) ) | 217 | else if ( btnText == tr( "Close" ) ) |
219 | { | 218 | { |
220 | // TODO - force reload of package data | 219 | // TODO - force reload of package data |
221 | emit closeInstallDlg(); | 220 | emit closeInstallDlg(); |
222 | return; | 221 | return; |
223 | } | 222 | } |
224 | 223 | ||
225 | // Start was clicked, execute first command | 224 | // Start was clicked, start executing |
226 | m_btnOptions->setEnabled( false ); | 225 | m_btnOptions->setEnabled( false ); |
227 | m_btnStart->setText( tr( "Abort" ) ); | 226 | if ( m_numCommands > 1 ) |
228 | m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); | 227 | { |
228 | m_btnStart->setText( tr( "Abort" ) ); | ||
229 | m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); | ||
230 | } | ||
231 | else | ||
232 | { | ||
233 | m_btnStart->setEnabled( false ); | ||
234 | } | ||
229 | 235 | ||
230 | QString dest; | 236 | QString dest; |
231 | if ( m_destination ) | 237 | if ( m_destination ) |
232 | dest = m_destination->currentText(); | 238 | dest = m_destination->currentText(); |
233 | m_packman->executeCommand( m_command[ 0 ], m_packages[ 0 ], dest, this, | 239 | |
234 | SLOT(slotOutput(OProcess*,char*,int)), SLOT(slotErrors(OProcess*,char*,int)), | 240 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) |
235 | SLOT(slotFinished(OProcess*)), true ); | 241 | { |
242 | // Execute next command | ||
243 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, | ||
244 | this, SLOT(slotOutput(char*)), true ); | ||
245 | } | ||
246 | |||
247 | // All commands executed, allow user to close dialog | ||
248 | m_btnStart->setEnabled( true ); | ||
249 | m_btnStart->setText( tr( "Close" ) ); | ||
250 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); | ||
251 | |||
252 | m_btnOptions->setEnabled( true ); | ||
253 | m_btnOptions->setText( tr( "Save output" ) ); | ||
254 | m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); | ||
236 | } | 255 | } |
237 | 256 | ||
238 | void InstallDlg::slotBtnOptions() | 257 | void InstallDlg::slotBtnOptions() |
239 | { | 258 | { |
240 | QString btnText = m_btnOptions->text(); | 259 | QString btnText = m_btnOptions->text(); |
241 | if ( btnText == tr( "Options" ) ) | 260 | if ( btnText == tr( "Options" ) ) |
242 | { | 261 | { |
243 | // Display configuration dialog (only options tab is enabled) | 262 | // Display configuration dialog (only options tab is enabled) |
244 | m_packman->configureDlg( true ); | 263 | m_packman->configureDlg( true ); |
245 | return; | 264 | return; |
246 | } | 265 | } |
247 | 266 | ||
248 | // Save output was clicked | 267 | // Save output was clicked |
249 | QMap<QString, QStringList> map; | 268 | QMap<QString, QStringList> map; |
250 | map.insert( tr( "All" ), QStringList() ); | 269 | map.insert( tr( "All" ), QStringList() ); |
251 | QStringList text; | 270 | QStringList text; |
@@ -254,56 +273,27 @@ void InstallDlg::slotBtnOptions() | |||
254 | text << "*"; | 273 | text << "*"; |
255 | map.insert( tr( "All" ), text ); | 274 | map.insert( tr( "All" ), text ); |
256 | 275 | ||
257 | QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); | 276 | QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); |
258 | if( !filename.isEmpty() ) | 277 | if( !filename.isEmpty() ) |
259 | { | 278 | { |
260 | QString currentFileName = QFileInfo( filename ).fileName(); | 279 | QString currentFileName = QFileInfo( filename ).fileName(); |
261 | DocLnk doc; | 280 | DocLnk doc; |
262 | doc.setType( "text/plain" ); | 281 | doc.setType( "text/plain" ); |
263 | doc.setFile( filename ); | 282 | doc.setFile( filename ); |
264 | doc.setName( currentFileName ); | 283 | doc.setName( currentFileName ); |
265 | FileManager fm; | 284 | FileManager fm; |
266 | fm.saveFile( doc, m_output->text() ); | 285 | fm.saveFile( doc, m_output->text() ); |
267 | } | 286 | } |
268 | } | 287 | } |
269 | 288 | ||
270 | void InstallDlg::slotOutput( OProcess */*process*/, char *buffer, int buffLen ) | 289 | void InstallDlg::slotOutput( char *msg ) |
271 | { | 290 | { |
272 | QString lineStr = buffer; | 291 | // Allow processing of other events |
273 | if ( lineStr[buffLen-1] == '\n' ) | 292 | qApp->processEvents(); |
274 | lineStr.truncate( buffLen - 1 ); | ||
275 | m_output->append( lineStr ); | ||
276 | m_output->setCursorPosition( m_output->numLines(), 0 ); | ||
277 | } | ||
278 | 293 | ||
279 | void InstallDlg::slotErrors( OProcess */*process*/, char *buffer, int buffLen ) | 294 | QString lineStr = msg; |
280 | { | 295 | if ( lineStr[lineStr.length()-1] == '\n' ) |
281 | QString lineStr = buffer; | 296 | lineStr.truncate( lineStr.length() - 1 ); |
282 | if ( lineStr[buffLen-1] == '\n' ) | ||
283 | lineStr.truncate( buffLen - 1 ); | ||
284 | m_output->append( lineStr ); | 297 | m_output->append( lineStr ); |
285 | m_output->setCursorPosition( m_output->numLines(), 0 ); | 298 | m_output->setCursorPosition( m_output->numLines(), 0 ); |
286 | } | 299 | } |
287 | |||
288 | void InstallDlg::slotFinished( OProcess */*process*/ ) | ||
289 | { | ||
290 | ++m_currCommand; | ||
291 | if ( m_currCommand < m_numCommands ) | ||
292 | { | ||
293 | // More commands left, execute next one | ||
294 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], m_destination->currentText(), | ||
295 | this, SLOT(slotOutput(OProcess*,char*,int)), | ||
296 | SLOT(slotErrors(OProcess*,char*,int)), | ||
297 | SLOT(slotFinished(OProcess*)), true ); | ||
298 | } | ||
299 | else | ||
300 | { | ||
301 | // All commands executed, allow user to close dialog | ||
302 | m_btnStart->setText( tr( "Close" ) ); | ||
303 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); | ||
304 | |||
305 | m_btnOptions->setEnabled( true ); | ||
306 | m_btnOptions->setText( tr( "Save output" ) ); | ||
307 | m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); | ||
308 | } | ||
309 | } | ||
diff --git a/noncore/settings/packagemanager/installdlg.h b/noncore/settings/packagemanager/installdlg.h index 8075f1d..7efe721 100644 --- a/noncore/settings/packagemanager/installdlg.h +++ b/noncore/settings/packagemanager/installdlg.h | |||
@@ -65,25 +65,23 @@ private: | |||
65 | QPushButton *m_btnStart; // Start/abort/close button | 65 | QPushButton *m_btnStart; // Start/abort/close button |
66 | QPushButton *m_btnOptions; // Installation options button | 66 | QPushButton *m_btnOptions; // Installation options button |
67 | 67 | ||
68 | // Commands and packages to execute | 68 | // Commands and packages to execute |
69 | int m_numCommands; // Number of commands to be executed | 69 | int m_numCommands; // Number of commands to be executed |
70 | int m_currCommand; // Number of currently executing command | 70 | int m_currCommand; // Number of currently executing command |
71 | OPackage::Command m_command[3]; // List of commands to be executed | 71 | OPackage::Command m_command[3]; // List of commands to be executed |
72 | QStringList *m_packages[3]; // Lists of package names associated to commands (m_command[]) | 72 | QStringList *m_packages[3]; // Lists of package names associated to commands (m_command[]) |
73 | 73 | ||
74 | private slots: | 74 | private slots: |
75 | // UI control slots | 75 | // UI control slots |
76 | void slotDisplayAvailSpace( const QString &destination ); | 76 | void slotDisplayAvailSpace( const QString &destination ); |
77 | void slotBtnStart(); | 77 | void slotBtnStart(); |
78 | void slotBtnOptions(); | 78 | void slotBtnOptions(); |
79 | 79 | ||
80 | // Execution slots | 80 | // Execution slots |
81 | void slotOutput( OProcess *process, char *buffer, int buffLen ); | 81 | void slotOutput( char *msg ); |
82 | void slotErrors( OProcess *process, char *buffer, int buffLen ); | ||
83 | void slotFinished( OProcess *process ); | ||
84 | 82 | ||
85 | signals: | 83 | signals: |
86 | void closeInstallDlg(); | 84 | void closeInstallDlg(); |
87 | }; | 85 | }; |
88 | 86 | ||
89 | #endif | 87 | #endif |
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 311b5fc..4611404 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp | |||
@@ -149,42 +149,41 @@ void MainWindow::initUI() | |||
149 | 149 | ||
150 | // Packages menu | 150 | // Packages menu |
151 | QPopupMenu *popup = new QPopupMenu( this ); | 151 | QPopupMenu *popup = new QPopupMenu( this ); |
152 | 152 | ||
153 | QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); | 153 | QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); |
154 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); | 154 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); |
155 | connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); | 155 | connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); |
156 | a->addTo( popup ); | 156 | a->addTo( popup ); |
157 | a->addTo( &m_toolBar ); | 157 | a->addTo( &m_toolBar ); |
158 | 158 | ||
159 | QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); | 159 | QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); |
160 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); | 160 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); |
161 | connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); | 161 | connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); |
162 | actionUpgrade->addTo( popup ); | 162 | actionUpgrade->addTo( popup ); |
163 | actionUpgrade->addTo( &m_toolBar ); | 163 | actionUpgrade->addTo( &m_toolBar ); |
164 | 164 | ||
165 | // Ipkg implementation does not seem to work currently? (not working in aqpkg either) | 165 | /* |
166 | /* | ||
167 | QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); | 166 | QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); |
168 | QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); | 167 | QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); |
169 | QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); | 168 | QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); |
170 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); | 169 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); |
171 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); | 170 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); |
172 | actionDownload->addTo( popup ); | 171 | actionDownload->addTo( popup ); |
173 | actionDownload->addTo( &m_toolBar ); | 172 | actionDownload->addTo( &m_toolBar ); |
174 | */ | 173 | */ |
175 | 174 | ||
176 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); | 175 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); |
177 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); | 176 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); |
178 | connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); | 177 | connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); |
179 | a->addTo( popup ); | 178 | a->addTo( popup ); |
180 | a->addTo( &m_toolBar ); | 179 | a->addTo( &m_toolBar ); |
181 | 180 | ||
182 | popup->insertSeparator(); | 181 | popup->insertSeparator(); |
183 | 182 | ||
184 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); | 183 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); |
185 | a->setWhatsThis( tr( "Click here to configure this application." ) ); | 184 | a->setWhatsThis( tr( "Click here to configure this application." ) ); |
186 | connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); | 185 | connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); |
187 | a->addTo( popup ); | 186 | a->addTo( popup ); |
188 | mb->insertItem( tr( "Actions" ), popup ); | 187 | mb->insertItem( tr( "Actions" ), popup ); |
189 | 188 | ||
190 | // View menu | 189 | // View menu |
@@ -358,33 +357,32 @@ void MainWindow::slotUpdate() | |||
358 | m_widgetStack.addWidget( dlg, 3 ); | 357 | m_widgetStack.addWidget( dlg, 3 ); |
359 | m_widgetStack.raiseWidget( dlg ); | 358 | m_widgetStack.raiseWidget( dlg ); |
360 | } | 359 | } |
361 | 360 | ||
362 | void MainWindow::slotUpgrade() | 361 | void MainWindow::slotUpgrade() |
363 | { | 362 | { |
364 | // Create package manager output widget | 363 | // Create package manager output widget |
365 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false, | 364 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false, |
366 | OPackage::Upgrade ); | 365 | OPackage::Upgrade ); |
367 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); | 366 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); |
368 | 367 | ||
369 | // Display widget | 368 | // Display widget |
370 | m_widgetStack.addWidget( dlg, 3 ); | 369 | m_widgetStack.addWidget( dlg, 3 ); |
371 | m_widgetStack.raiseWidget( dlg ); | 370 | m_widgetStack.raiseWidget( dlg ); |
372 | } | 371 | } |
373 | 372 | ||
374 | // Ipkg implementation does not seem to work currently? (not working in aqpkg either) | ||
375 | /* | 373 | /* |
376 | void MainWindow::slotDownload() | 374 | void MainWindow::slotDownload() |
377 | { | 375 | { |
378 | // Retrieve list of packages selected for download (if any) | 376 | // Retrieve list of packages selected for download (if any) |
379 | QStringList *workingPackages = new QStringList(); | 377 | QStringList *workingPackages = new QStringList(); |
380 | 378 | ||
381 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 379 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
382 | item != 0 ; | 380 | item != 0 ; |
383 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) | 381 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) |
384 | { | 382 | { |
385 | if ( item->isOn() ) | 383 | if ( item->isOn() ) |
386 | workingPackages->append( item->text() ); | 384 | workingPackages->append( item->text() ); |
387 | } | 385 | } |
388 | 386 | ||
389 | if ( workingPackages->isEmpty() ) | 387 | if ( workingPackages->isEmpty() ) |
390 | { | 388 | { |
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp index 13f3d7d..eeb0131 100644 --- a/noncore/settings/packagemanager/oipkg.cpp +++ b/noncore/settings/packagemanager/oipkg.cpp | |||
@@ -18,66 +18,85 @@ | |||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "oipkg.h" | 32 | #include "oipkg.h" |
33 | 33 | ||
34 | #include <stdio.h> | 34 | #include <stdlib.h> |
35 | #include <string.h> | ||
35 | 36 | ||
36 | #include <qdir.h> | 37 | #include <qdir.h> |
37 | #include <qfile.h> | 38 | #include <qfile.h> |
39 | #include <qmessagebox.h> | ||
38 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
39 | 41 | ||
40 | #include <opie/oprocess.h> | ||
41 | |||
42 | const QString IPKG_EXEC = "ipkg"; // Fully-qualified name of Ipkg executable | ||
43 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file | 42 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file |
44 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files | 43 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files |
45 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists | 44 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists |
46 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location | 45 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location |
47 | 46 | ||
47 | OIpkg *oipkg; | ||
48 | |||
49 | int fIpkgMessage( ipkg_conf_t */*conf*/, message_level_t /*level*/, char *msg ) | ||
50 | { | ||
51 | oipkg->ipkgOutput( msg ); | ||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | char* fIpkgResponse( char */*question*/ ) | ||
56 | { | ||
57 | return 0x0; | ||
58 | } | ||
59 | |||
48 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) | 60 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) |
49 | : QObject( parent, name ) | 61 | : QObject( parent, name ) |
50 | , m_config( config ) | 62 | , m_config( config ) |
51 | , m_ipkgExec( IPKG_EXEC ) // TODO - find executable? | ||
52 | , m_confInfo( NULL ) | 63 | , m_confInfo( NULL ) |
53 | , m_ipkgExecOptions( 0 ) | 64 | , m_ipkgExecOptions( 0 ) |
54 | , m_ipkgExecVerbosity( 1 ) | 65 | , m_ipkgExecVerbosity( 1 ) |
55 | , m_ipkgProcess( NULL ) | ||
56 | { | 66 | { |
67 | oipkg = this; | ||
68 | |||
69 | // Initialize libipkg | ||
70 | if ( ipkg_init( &fIpkgMessage, &fIpkgResponse, &m_ipkgArgs ) ) | ||
71 | QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error initialing libipkg" ) ); | ||
72 | |||
73 | // Default ipkg run-time arguments | ||
74 | m_ipkgArgs.noaction = false; | ||
75 | m_ipkgArgs.force_defaults = true; | ||
57 | } | 76 | } |
58 | 77 | ||
59 | OIpkg::~OIpkg() | 78 | OIpkg::~OIpkg() |
60 | { | 79 | { |
61 | // Upon destruction, ensure that items in config list are deleted with list | 80 | // Upon destruction, ensure that items in config list are deleted with list |
62 | if ( m_confInfo ) | 81 | if ( m_confInfo ) |
63 | m_confInfo->setAutoDelete( true ); | 82 | m_confInfo->setAutoDelete( true ); |
64 | 83 | ||
65 | // Terminate any running ipkg processes | 84 | // Free up libipkg resources |
66 | if ( m_ipkgProcess ) | 85 | if ( ipkg_deinit( &m_ipkgArgs ) ) |
67 | delete m_ipkgProcess; | 86 | QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error freeing libipkg" ) ); |
68 | } | 87 | } |
69 | 88 | ||
70 | OConfItemList *OIpkg::configItems() | 89 | OConfItemList *OIpkg::configItems() |
71 | { | 90 | { |
72 | // Retrieve all configuration items | 91 | // Retrieve all configuration items |
73 | return filterConfItems(); | 92 | return filterConfItems(); |
74 | } | 93 | } |
75 | 94 | ||
76 | OConfItemList *OIpkg::servers() | 95 | OConfItemList *OIpkg::servers() |
77 | { | 96 | { |
78 | // Retrieve only servers | 97 | // Retrieve only servers |
79 | return filterConfItems( OConfItem::Source ); | 98 | return filterConfItems( OConfItem::Source ); |
80 | } | 99 | } |
81 | 100 | ||
82 | OConfItemList *OIpkg::destinations() | 101 | OConfItemList *OIpkg::destinations() |
83 | { | 102 | { |
@@ -241,162 +260,97 @@ OPackageList *OIpkg::installedPackages( const QString &destName, const QString & | |||
241 | if ( key == "Description" ) | 260 | if ( key == "Description" ) |
242 | { | 261 | { |
243 | line = t.readLine(); | 262 | line = t.readLine(); |
244 | while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) | 263 | while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) |
245 | line = t.readLine(); | 264 | line = t.readLine(); |
246 | } | 265 | } |
247 | else | 266 | else |
248 | line = t.readLine(); | 267 | line = t.readLine(); |
249 | } | 268 | } |
250 | 269 | ||
251 | f.close(); | 270 | f.close(); |
252 | 271 | ||
253 | return pl; | 272 | return pl; |
254 | } | 273 | } |
255 | 274 | ||
256 | bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, const QString &destination, | 275 | bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, const QString &destination, |
257 | const QObject *receiver, const char *slotOutput, const char *slotErrors, | 276 | const QObject *receiver, const char *slotOutput, bool rawOutput ) |
258 | const char *slotFinished, bool rawOutput ) | ||
259 | { | 277 | { |
260 | if ( command == OPackage::NotDefined ) | 278 | if ( command == OPackage::NotDefined ) |
261 | return false; | 279 | return false; |
262 | 280 | ||
263 | // Set up command line for execution | 281 | // Set ipkg run-time options/arguments |
264 | QStringList cmdLine; | 282 | m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS ); |
265 | cmdLine.append( IPKG_EXEC ); | 283 | m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL ); |
266 | 284 | // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); | |
267 | QString verbosity( "-V" ); | 285 | m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE ); |
268 | verbosity.append( QString::number( m_ipkgExecVerbosity ) ); | 286 | m_ipkgArgs.verbosity = m_ipkgExecVerbosity; |
269 | cmdLine.append( verbosity ); | 287 | if ( m_ipkgArgs.dest ) |
270 | 288 | free( m_ipkgArgs.dest ); | |
271 | // Determine Ipkg execution options | 289 | if ( !destination.isNull() ) |
272 | if ( command == OPackage::Install && destination != QString::null ) | ||
273 | { | 290 | { |
274 | // TODO - Set destination for installs | 291 | int len = destination.length() + 1; |
275 | cmdLine.append( "-dest" ); | 292 | m_ipkgArgs.dest = (char *)malloc( len ); |
276 | cmdLine.append( destination ); | 293 | strncpy( m_ipkgArgs.dest, destination, destination.length() ); |
294 | m_ipkgArgs.dest[ len - 1 ] = '\0'; | ||
277 | } | 295 | } |
296 | else | ||
297 | m_ipkgArgs.dest = 0x0; | ||
278 | 298 | ||
279 | if ( command != OPackage::Update && command != OPackage::Download ) | 299 | // Connect output signal to widget |
300 | if ( rawOutput ) | ||
280 | { | 301 | { |
281 | if ( m_ipkgExecOptions & FORCE_DEPENDS ) | 302 | if ( slotOutput ) |
282 | cmdLine.append( "-force-depends" ); | 303 | connect( this, SIGNAL(execOutput(char *)), receiver, slotOutput ); |
283 | if ( m_ipkgExecOptions & FORCE_REINSTALL ) | 304 | } |
284 | cmdLine.append( "-force-reinstall" ); | 305 | else |
285 | if ( m_ipkgExecOptions & FORCE_REMOVE ) | 306 | { |
286 | cmdLine.append( "-force-removal-of-essential-packages" ); | 307 | // TODO - connect to local slot and parse output before emitting execOutput |
287 | if ( m_ipkgExecOptions & FORCE_OVERWRITE ) | ||
288 | cmdLine.append( "-force-overwrite" ); | ||
289 | if ( m_ipkgExecVerbosity == 3 ) | ||
290 | cmdLine.append( "-verbose_wget" ); | ||
291 | |||
292 | // TODO | ||
293 | // Handle make links | ||
294 | // Rules - If make links is switched on, create links to root | ||
295 | // if destDir is NOT / | ||
296 | /* | ||
297 | if ( m_ipkgExecOptions & MAKE_LINKS ) | ||
298 | { | ||
299 | // If destDir == / turn off make links as package is being insalled | ||
300 | // to root already. | ||
301 | if ( destDir == "/" ) | ||
302 | m_ipkgExecOptions ^= MAKE_LINKS; | ||
303 | } | ||
304 | */ | ||
305 | } | 308 | } |
306 | 309 | ||
307 | QString cmd; | ||
308 | switch( command ) | 310 | switch( command ) |
309 | { | 311 | { |
310 | case OPackage::Install: cmd = "install"; | 312 | case OPackage::Update : ipkg_lists_update( &m_ipkgArgs ); |
311 | break; | ||
312 | case OPackage::Remove: cmd = "remove"; | ||
313 | break; | 313 | break; |
314 | case OPackage::Update: cmd = "update"; | 314 | case OPackage::Upgrade : ipkg_packages_upgrade( &m_ipkgArgs ); |
315 | break; | 315 | break; |
316 | case OPackage::Upgrade: cmd = "upgrade"; | 316 | case OPackage::Install : { |
317 | break; | 317 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) |
318 | case OPackage::Download: cmd = "download"; | 318 | { |
319 | break; | 319 | ipkg_packages_install( &m_ipkgArgs, (*it) ); |
320 | case OPackage::Info: cmd = "info"; | 320 | } |
321 | }; | ||
321 | break; | 322 | break; |
322 | case OPackage::Files: cmd = "files"; | 323 | case OPackage::Remove : { |
324 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) | ||
325 | { | ||
326 | ipkg_packages_remove( &m_ipkgArgs, (*it), true ); | ||
327 | } | ||
328 | }; | ||
323 | break; | 329 | break; |
324 | //case OPackage::Version: cmd = "" ); | 330 | //case OPackage::Download : ; |
325 | // break; | 331 | // break; |
326 | default: | 332 | default : break; |
327 | break; | ||
328 | }; | 333 | }; |
329 | cmdLine.append( cmd ); | ||
330 | |||
331 | // TODO | ||
332 | // If we are removing, reinstalling or upgrading packages and make links option is selected | ||
333 | // create the links | ||
334 | /* | ||
335 | if ( command == Remove || command == Upgrade ) | ||
336 | { | ||
337 | createLinks = false; | ||
338 | if ( flags & MAKE_LINKS ) | ||
339 | { | ||
340 | emit outputText( tr( "Removing symbolic links...\n" ) ); | ||
341 | linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); | ||
342 | emit outputText( QString( " " ) ); | ||
343 | } | ||
344 | } | ||
345 | */ | ||
346 | // Append package list (if any) to end of command line | ||
347 | if ( parameters && !parameters->isEmpty() ) | ||
348 | { | ||
349 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) | ||
350 | { | ||
351 | cmdLine.append( *it ); | ||
352 | } | ||
353 | } | ||
354 | |||
355 | // Create OProcess | ||
356 | if ( m_ipkgProcess ) | ||
357 | delete m_ipkgProcess; | ||
358 | m_ipkgProcess = new OProcess( cmdLine, this ); | ||
359 | |||
360 | // Connect signals (if any) | ||
361 | if ( receiver ) | ||
362 | { | ||
363 | if ( rawOutput ) | ||
364 | { | ||
365 | if ( slotOutput ) | ||
366 | connect( m_ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), receiver, slotOutput ); | ||
367 | if ( slotErrors ) | ||
368 | connect( m_ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)), receiver, slotErrors ); | ||
369 | if ( slotFinished ) | ||
370 | connect( m_ipkgProcess, SIGNAL(processExited(OProcess*)), receiver, slotFinished ); | ||
371 | } | ||
372 | else // !rawOutput | ||
373 | { | ||
374 | // TODO - how should it handle partial lines? (i.e. "Installing opi", "e-aqpkg...") | ||
375 | } | ||
376 | } | ||
377 | 334 | ||
378 | // Run process | 335 | return true; |
379 | printf( "Running: \'%s\'\n", cmdLine.join( " " ).latin1() ); | ||
380 | return m_ipkgProcess->start( OProcess::NotifyOnExit, OProcess::All ); | ||
381 | } | 336 | } |
382 | 337 | ||
383 | void OIpkg::abortCommand() | 338 | void OIpkg::ipkgOutput( char *msg ) |
384 | { | 339 | { |
385 | if ( m_ipkgProcess ) | 340 | emit execOutput( msg ); |
386 | delete m_ipkgProcess; | ||
387 | } | 341 | } |
388 | 342 | ||
389 | void OIpkg::loadConfiguration() | 343 | void OIpkg::loadConfiguration() |
390 | { | 344 | { |
391 | if ( m_confInfo ) | 345 | if ( m_confInfo ) |
392 | delete m_confInfo; | 346 | delete m_confInfo; |
393 | 347 | ||
394 | // Load configuration item list | 348 | // Load configuration item list |
395 | m_confInfo = new OConfItemList(); | 349 | m_confInfo = new OConfItemList(); |
396 | 350 | ||
397 | QStringList confFiles; | 351 | QStringList confFiles; |
398 | QDir confDir( IPKG_CONF_DIR ); | 352 | QDir confDir( IPKG_CONF_DIR ); |
399 | if ( confDir.exists() ) | 353 | if ( confDir.exists() ) |
400 | { | 354 | { |
401 | confDir.setNameFilter( "*.conf" ); | 355 | confDir.setNameFilter( "*.conf" ); |
402 | confDir.setFilter( QDir::Files ); | 356 | confDir.setFilter( QDir::Files ); |
diff --git a/noncore/settings/packagemanager/oipkg.h b/noncore/settings/packagemanager/oipkg.h index 4065f48..824fa17 100644 --- a/noncore/settings/packagemanager/oipkg.h +++ b/noncore/settings/packagemanager/oipkg.h | |||
@@ -19,82 +19,83 @@ | |||
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef OIPKG_H | 32 | #ifndef OIPKG_H |
33 | #define OIPKG_H | 33 | #define OIPKG_H |
34 | 34 | ||
35 | extern "C" { | ||
36 | #include <libipkg.h> | ||
37 | }; | ||
38 | |||
35 | #include <qobject.h> | 39 | #include <qobject.h> |
36 | 40 | ||
37 | #include <qpe/config.h> | 41 | #include <qpe/config.h> |
38 | 42 | ||
39 | #include "oconfitem.h" | 43 | #include "oconfitem.h" |
40 | #include "opackage.h" | 44 | #include "opackage.h" |
41 | 45 | ||
42 | // Ipkg execution options (m_ipkgExecOptions) | 46 | // Ipkg execution options (m_ipkgExecOptions) |
43 | #define FORCE_DEPENDS 0x0001 | 47 | #define FORCE_DEPENDS 0x0001 |
44 | #define FORCE_REMOVE 0x0002 | 48 | #define FORCE_REMOVE 0x0002 |
45 | #define FORCE_REINSTALL 0x0004 | 49 | #define FORCE_REINSTALL 0x0004 |
46 | #define FORCE_OVERWRITE 0x0008 | 50 | #define FORCE_OVERWRITE 0x0008 |
47 | 51 | ||
48 | class OConfItemList; | 52 | class OConfItemList; |
49 | class OProcess; | ||
50 | 53 | ||
51 | class OIpkg : public QObject | 54 | class OIpkg : public QObject |
52 | { | 55 | { |
53 | Q_OBJECT | 56 | Q_OBJECT |
54 | 57 | ||
55 | public: | 58 | public: |
56 | OIpkg( Config *config = 0x0, QObject *parent = 0x0, const char *name = 0x0 ); | 59 | OIpkg( Config *config = 0x0, QObject *parent = 0x0, const char *name = 0x0 ); |
57 | ~OIpkg(); | 60 | ~OIpkg(); |
58 | 61 | ||
59 | OConfItemList *configItems(); | 62 | OConfItemList *configItems(); |
60 | OConfItemList *servers(); | 63 | OConfItemList *servers(); |
61 | OConfItemList *destinations(); | 64 | OConfItemList *destinations(); |
62 | OConfItemList *options(); | 65 | OConfItemList *options(); |
63 | 66 | ||
64 | int ipkgExecOptions() { return m_ipkgExecOptions; } | 67 | int ipkgExecOptions() { return m_ipkgExecOptions; } |
65 | int ipkgExecVerbosity() { return m_ipkgExecVerbosity; } | 68 | int ipkgExecVerbosity() { return m_ipkgExecVerbosity; } |
66 | 69 | ||
67 | void setConfigItems( OConfItemList *configList ); | 70 | void setConfigItems( OConfItemList *configList ); |
68 | void setIpkgExecOptions( int options ) { m_ipkgExecOptions = options; } | 71 | void setIpkgExecOptions( int options ) { m_ipkgExecOptions = options; } |
69 | void setIpkgExecVerbosity( int verbosity ) { m_ipkgExecVerbosity = verbosity; } | 72 | void setIpkgExecVerbosity( int verbosity ) { m_ipkgExecVerbosity = verbosity; } |
70 | 73 | ||
71 | void saveSettings(); | 74 | void saveSettings(); |
72 | 75 | ||
73 | OPackageList *availablePackages( const QString &server = QString::null ); | 76 | OPackageList *availablePackages( const QString &server = QString::null ); |
74 | OPackageList *installedPackages( const QString &destName = QString::null, | 77 | OPackageList *installedPackages( const QString &destName = QString::null, |
75 | const QString &destPath = QString::null ); | 78 | const QString &destPath = QString::null ); |
76 | 79 | ||
77 | bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0, | 80 | bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0, |
78 | const QString &destination = QString::null, const QObject *receiver = 0x0, | 81 | const QString &destination = QString::null, const QObject *receiver = 0x0, |
79 | const char *slotOutput = 0x0, const char *slotErrors = 0x0, | 82 | const char *slotOutput = 0x0, bool rawOutput = true ); |
80 | const char *slotFinished = 0x0, bool rawOutput = true ); | ||
81 | void abortCommand(); | 83 | void abortCommand(); |
82 | 84 | ||
85 | void ipkgOutput( char *msg ); | ||
86 | |||
83 | private: | 87 | private: |
84 | Config *m_config; // Pointer to application configuration file | 88 | Config *m_config; // Pointer to application configuration file |
85 | QString m_ipkgExec; // Fully qualified path/filename of ipkg binary | 89 | args_t m_ipkgArgs; // libipkg configuration arguments |
86 | OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files | 90 | OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files |
87 | int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options | 91 | int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options |
88 | int m_ipkgExecVerbosity; // Ipkg execution verbosity level | 92 | int m_ipkgExecVerbosity; // Ipkg execution verbosity level |
89 | OProcess *m_ipkgProcess; // Pointer to process which Ipkg will run in | ||
90 | 93 | ||
91 | void loadConfiguration(); | 94 | void loadConfiguration(); |
92 | OConfItemList *filterConfItems( OConfItem::Type typefilter = OConfItem::NotDefined ); | 95 | OConfItemList *filterConfItems( OConfItem::Type typefilter = OConfItem::NotDefined ); |
93 | 96 | ||
94 | signals: | 97 | signals: |
95 | void execOutput( OProcess *process, char *buffer, int length ); | 98 | void execOutput( char *msg ); |
96 | void execErrors( OProcess *process, char *buffer, int length ); | ||
97 | void execFinished( OProcess *process, char *buffer, int length ); | ||
98 | }; | 99 | }; |
99 | 100 | ||
100 | #endif | 101 | #endif |
diff --git a/noncore/settings/packagemanager/opackagemanager.cpp b/noncore/settings/packagemanager/opackagemanager.cpp index 6bef918..e1c8a21 100644 --- a/noncore/settings/packagemanager/opackagemanager.cpp +++ b/noncore/settings/packagemanager/opackagemanager.cpp | |||
@@ -304,27 +304,20 @@ int OPackageManager::compareVersions( const QString &version1, const QString &ve | |||
304 | return 0; | 304 | return 0; |
305 | } | 305 | } |
306 | 306 | ||
307 | bool OPackageManager::configureDlg( bool installOptions ) | 307 | bool OPackageManager::configureDlg( bool installOptions ) |
308 | { | 308 | { |
309 | OIpkgConfigDlg dlg( &m_ipkg, installOptions, static_cast<QWidget *>(parent()) ); | 309 | OIpkgConfigDlg dlg( &m_ipkg, installOptions, static_cast<QWidget *>(parent()) ); |
310 | return ( dlg.exec() == QDialog::Accepted ); | 310 | return ( dlg.exec() == QDialog::Accepted ); |
311 | } | 311 | } |
312 | 312 | ||
313 | void OPackageManager::saveSettings() | 313 | void OPackageManager::saveSettings() |
314 | { | 314 | { |
315 | m_ipkg.saveSettings(); | 315 | m_ipkg.saveSettings(); |
316 | } | 316 | } |
317 | 317 | ||
318 | bool OPackageManager::executeCommand( OPackage::Command command, QStringList *packages, | 318 | bool OPackageManager::executeCommand( OPackage::Command command, QStringList *packages, |
319 | const QString &destination, const QObject *receiver, | 319 | const QString &destination, const QObject *receiver, |
320 | const char *slotOutput, const char *slotErrors, | 320 | const char *slotOutput, bool rawOutput ) |
321 | const char *slotFinished, bool rawOutput ) | ||
322 | { | 321 | { |
323 | return m_ipkg.executeCommand( command, packages, destination, receiver, slotOutput, slotErrors, | 322 | return m_ipkg.executeCommand( command, packages, destination, receiver, slotOutput, rawOutput ); |
324 | slotFinished, rawOutput ); | ||
325 | } | ||
326 | |||
327 | void OPackageManager::abortCommand() | ||
328 | { | ||
329 | m_ipkg.abortCommand(); | ||
330 | } | 323 | } |
diff --git a/noncore/settings/packagemanager/opackagemanager.h b/noncore/settings/packagemanager/opackagemanager.h index 5e1a30a..871af0c 100644 --- a/noncore/settings/packagemanager/opackagemanager.h +++ b/noncore/settings/packagemanager/opackagemanager.h | |||
@@ -59,33 +59,31 @@ public: | |||
59 | 59 | ||
60 | const QStringList &categories() { return m_categories; } | 60 | const QStringList &categories() { return m_categories; } |
61 | QStringList *servers(); | 61 | QStringList *servers(); |
62 | QStringList *destinations(); | 62 | QStringList *destinations(); |
63 | 63 | ||
64 | int compareVersions( const QString &version1, const QString &version2 ); | 64 | int compareVersions( const QString &version1, const QString &version2 ); |
65 | 65 | ||
66 | OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, | 66 | OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, |
67 | const QString &name = QString::null ); | 67 | const QString &name = QString::null ); |
68 | OPackage *findPackage( const QString &name = QString::null ); | 68 | OPackage *findPackage( const QString &name = QString::null ); |
69 | 69 | ||
70 | bool configureDlg( bool installOptions = false ); | 70 | bool configureDlg( bool installOptions = false ); |
71 | void saveSettings(); | 71 | void saveSettings(); |
72 | 72 | ||
73 | bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0, | 73 | bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0, |
74 | const QString &destination = QString::null, const QObject *receiver = 0x0, | 74 | const QString &destination = QString::null, const QObject *receiver = 0x0, |
75 | const char *slotOutput = 0x0, const char *slotErrors = 0x0, | 75 | const char *slotOutput = 0x0, bool rawOutput = true ); |
76 | const char *slotFinished = 0x0, bool rawOutput = true ); | ||
77 | void abortCommand(); | ||
78 | 76 | ||
79 | private: | 77 | private: |
80 | Config *m_config; // Pointer to application configuration file | 78 | Config *m_config; // Pointer to application configuration file |
81 | OIpkg m_ipkg; // OIpkg object to retrieve package/configuration information | 79 | OIpkg m_ipkg; // OIpkg object to retrieve package/configuration information |
82 | QDict<OPackage> m_packages; // Global list of available packages | 80 | QDict<OPackage> m_packages; // Global list of available packages |
83 | QStringList m_categories; // List of all categories | 81 | QStringList m_categories; // List of all categories |
84 | 82 | ||
85 | signals: | 83 | signals: |
86 | void initStatus( int numSteps ); | 84 | void initStatus( int numSteps ); |
87 | void statusText( const QString &status ); | 85 | void statusText( const QString &status ); |
88 | void statusBar( int currStep ); | 86 | void statusBar( int currStep ); |
89 | }; | 87 | }; |
90 | 88 | ||
91 | #endif | 89 | #endif |
diff --git a/noncore/settings/packagemanager/opie-packagemanager.control b/noncore/settings/packagemanager/opie-packagemanager.control index db06761..095e3be 100644 --- a/noncore/settings/packagemanager/opie-packagemanager.control +++ b/noncore/settings/packagemanager/opie-packagemanager.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-packagemanager | 1 | Package: opie-packagemanager |
2 | Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop | 2 | Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: Settings | 4 | Section: Settings |
5 | Depends: task-opie-minimal | 5 | Depends: task-opie-minimal |
6 | Replaces: packagemanager | 6 | Replaces: packagemanager |
7 | Architecture: arm | 7 | Architecture: arm |
8 | Maintainer: Dan Williams (drw@handhelds.org) | 8 | Maintainer: Dan Williams (drw@handhelds.org) |
9 | Description: Opie package management client | 9 | Description: Opie package management client |
10 | Version: 0.1.0 | 10 | Version: 0.2.0 |
diff --git a/noncore/settings/packagemanager/packagemanager.pro b/noncore/settings/packagemanager/packagemanager.pro index 9aa3dc6..55af13e 100644 --- a/noncore/settings/packagemanager/packagemanager.pro +++ b/noncore/settings/packagemanager/packagemanager.pro | |||
@@ -1,31 +1,36 @@ | |||
1 | CONFIG = qt warn_on release quick-app | 1 | CONFIG = qt warn_on release quick-app |
2 | //TEMPLATE = app | ||
3 | //CONFIG += qte warn_on debug | ||
4 | //DESTDIR = $(OPIEDIR)/bin | ||
2 | 5 | ||
3 | SOURCES = opackage.cpp \ | 6 | SOURCES = opackage.cpp \ |
4 | oconfitem.cpp \ | 7 | oconfitem.cpp \ |
5 | oipkg.cpp \ | 8 | oipkg.cpp \ |
6 | oipkgconfigdlg.cpp \ | 9 | oipkgconfigdlg.cpp \ |
7 | opackagemanager.cpp \ | 10 | opackagemanager.cpp \ |
8 | mainwindow.cpp \ | 11 | mainwindow.cpp \ |
9 | installdlg.cpp \ | 12 | installdlg.cpp \ |
10 | packageinfodlg.cpp \ | 13 | packageinfodlg.cpp \ |
11 | filterdlg.cpp \ | 14 | filterdlg.cpp \ |
12 | promptdlg.cpp \ | 15 | promptdlg.cpp \ |
13 | main.cpp | 16 | main.cpp |
14 | HEADERS = opackage.h \ | 17 | HEADERS = opackage.h \ |
15 | oconfitem.h \ | 18 | oconfitem.h \ |
16 | oipkg.h \ | 19 | oipkg.h \ |
17 | oipkgconfigdlg.h \ | 20 | oipkgconfigdlg.h \ |
18 | opackagemanager.h \ | 21 | opackagemanager.h \ |
19 | mainwindow.h \ | 22 | mainwindow.h \ |
20 | installdlg.h \ | 23 | installdlg.h \ |
21 | packageinfodlg.h \ | 24 | packageinfodlg.h \ |
22 | filterdlg.h \ | 25 | filterdlg.h \ |
23 | promptdlg.h | 26 | promptdlg.h |
24 | 27 | ||
28 | DEFINES += IPKG_LIB | ||
29 | DEFINES += HAVE_MKDTEMP | ||
25 | TARGET = packagemanager | 30 | TARGET = packagemanager |
26 | INCLUDEPATH += $(OPIEDIR)/include | 31 | INCLUDEPATH += $(OPIEDIR)/include $(IPKGDIR) |
27 | DEPENDPATH += $(OPIEDIR)/include | 32 | DEPENDPATH += $(OPIEDIR)/include |
28 | LIBS += -lqpe -lopie | 33 | LIBS += -lqpe -lopie -lipkg |
29 | 34 | ||
30 | include ( $(OPIEDIR)/include.pro ) | 35 | include ( $(OPIEDIR)/include.pro ) |
31 | 36 | ||