-rw-r--r-- | noncore/unsupported/oipkg/TODO | 3 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/debug.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 115 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.h | 9 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/opie-oipkg.control | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 54 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.h | 22 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 46 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.h | 8 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.cpp | 44 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.h | 8 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.cpp | 24 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.h | 3 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 112 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 12 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/runwindow.ui | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/settings.h | 2 |
17 files changed, 312 insertions, 155 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO index c53ca93..744cba4 100644 --- a/noncore/unsupported/oipkg/TODO +++ b/noncore/unsupported/oipkg/TODO | |||
@@ -1,11 +1,8 @@ | |||
1 | * search | ||
2 | * Settings Class | 1 | * Settings Class |
3 | * make oipkg determine dest of "to remove" apps | ||
4 | * tr() ;) | 2 | * tr() ;) |
5 | * Dialog to display ipkg output live | 3 | * Dialog to display ipkg output live |
6 | * parse "to install" and "to remove" from status | 4 | * parse "to install" and "to remove" from status |
7 | * install local file | 5 | * install local file |
8 | * install to dest with click on packet | ||
9 | * qcop | 6 | * qcop |
10 | * error handling | 7 | * error handling |
11 | * manage links | 8 | * manage links |
diff --git a/noncore/unsupported/oipkg/debug.h b/noncore/unsupported/oipkg/debug.h index c53e36c..e73b9b2 100644 --- a/noncore/unsupported/oipkg/debug.h +++ b/noncore/unsupported/oipkg/debug.h | |||
@@ -7,6 +7,7 @@ extern int debugLevel; | |||
7 | 7 | ||
8 | #define HACK | 8 | #define HACK |
9 | 9 | ||
10 | #define NEWLAYOUT | ||
10 | 11 | ||
11 | #define pvDebug(I, S) \ | 12 | #define pvDebug(I, S) \ |
12 | if ( debugLevel < 3 ) \ | 13 | if ( debugLevel < 3 ) \ |
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index c803ca0..25ca889 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <qpe/qpemessagebox.h> | 7 | #include <qpe/qpemessagebox.h> |
8 | #include <qpe/resource.h> | 8 | #include <qpe/resource.h> |
9 | #include <qpe/qpetoolbar.h> | 9 | #include <qpe/qpetoolbar.h> |
10 | #include <qpe/qcopenvelope_qws.h> | ||
10 | #include <qaction.h> | 11 | #include <qaction.h> |
11 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
12 | #include <qpopupmenu.h> | 13 | #include <qpopupmenu.h> |
@@ -29,16 +30,21 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
29 | setCaption( tr("Package Manager") ); | 30 | setCaption( tr("Package Manager") ); |
30 | 31 | ||
31 | listViewPackages = new QListView( this,0,0 ); | 32 | listViewPackages = new QListView( this,0,0 ); |
33 | listViewPackages->setSelectionMode(QListView::NoSelection); | ||
32 | setCentralWidget( listViewPackages ); | 34 | setCentralWidget( listViewPackages ); |
33 | 35 | ||
34 | makeMenu(); | 36 | makeMenu(); |
35 | 37 | #ifdef NEWLAYOUT | |
38 | listViewPackages->addColumn( tr("Package") ); | ||
39 | listViewPackages->setRootIsDecorated( true ); | ||
40 | #endif | ||
41 | #ifndef NEWLAYOUT | ||
36 | QFontMetrics fm = fontMetrics(); | 42 | QFontMetrics fm = fontMetrics(); |
37 | int wlw = width()*2; | 43 | int wlw = width()*2; |
38 | int w0 = fm.width(tr("Package"))+30; | 44 | int w0 = fm.width(tr("Package"))+30; |
39 | // int w0 = fm.width(tr("Package"))+30; | 45 | // int w0 = fm.width(tr("Package"))+30; |
40 | int w2 = fm.width("00000")+4; | 46 | int w2 = fm.width("00000")+4; |
41 | int w1 = wlw-w2-w0-20; | 47 | int w1 = wlw-w2-w0-24; |
42 | listViewPackages->addColumn( tr("Package"), w0 ); | 48 | listViewPackages->addColumn( tr("Package"), w0 ); |
43 | listViewPackages->addColumn( tr("Description"), w1 ); | 49 | listViewPackages->addColumn( tr("Description"), w1 ); |
44 | listViewPackages->addColumn( tr("Size"), w2 ); | 50 | listViewPackages->addColumn( tr("Size"), w2 ); |
@@ -46,14 +52,18 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
46 | listViewPackages->setColumnWidthMode(1,QListView::Manual); | 52 | listViewPackages->setColumnWidthMode(1,QListView::Manual); |
47 | listViewPackages->setColumnWidthMode(2,QListView::Manual); | 53 | listViewPackages->setColumnWidthMode(2,QListView::Manual); |
48 | listViewPackages->setSelectionMode( QListView::Multi ); | 54 | listViewPackages->setSelectionMode( QListView::Multi ); |
49 | 55 | #endif | |
50 | connect( section, SIGNAL( activated(int) ), | 56 | connect( section, SIGNAL( activated(int) ), |
51 | this, SLOT( sectionChanged() ) ); | 57 | this, SLOT( sectionChanged() ) ); |
52 | connect( subsection, SIGNAL(activated(int) ), | 58 | connect( subsection, SIGNAL(activated(int) ), |
53 | this, SLOT( subSectionChanged() ) ); | 59 | this, SLOT( subSectionChanged() ) ); |
54 | connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ), | 60 | connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ), |
55 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 61 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
56 | 62 | connect( listViewPackages, SIGNAL( clicked( QListViewItem* ) ), | |
63 | this, SLOT( stopTimer( QListViewItem* ) ) ); | ||
64 | |||
65 | popupMenu = new QPopupMenu( this ); | ||
66 | |||
57 | settings = new PackageManagerSettings(this,0,TRUE); | 67 | settings = new PackageManagerSettings(this,0,TRUE); |
58 | 68 | ||
59 | ipkg = new PmIpkg( settings, this ); | 69 | ipkg = new PmIpkg( settings, this ); |
@@ -74,9 +84,10 @@ void MainWindow::makeMenu() | |||
74 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 84 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
75 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 85 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
76 | 86 | ||
77 | popupMenu = new QPopupMenu( this ); | 87 | popupMenu = new QPopupMenu( this ); |
78 | 88 | destsMenu = new QPopupMenu( popupMenu ); | |
79 | contextMenu = new QPopupMenu( this ); | 89 | popupTimer = new QTimer( this ); |
90 | connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); | ||
80 | 91 | ||
81 | setToolBarsMovable( false ); | 92 | setToolBarsMovable( false ); |
82 | toolBar->setHorizontalStretchable( true ); | 93 | toolBar->setHorizontalStretchable( true ); |
@@ -180,6 +191,14 @@ void MainWindow::makeMenu() | |||
180 | findAction->setToggleAction( true ); | 191 | findAction->setToggleAction( true ); |
181 | findAction->setOn( true ); | 192 | findAction->setOn( true ); |
182 | findAction->addTo( viewMenu ); | 193 | findAction->addTo( viewMenu ); |
194 | |||
195 | #ifdef NEW | ||
196 | Config cfg( "oipkg", Config::User ); | ||
197 | cfg.setGroup( "Setting_" + QString::number( setting ) ); | ||
198 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); | ||
199 | findShow(bool b) | ||
200 | sectionShow(bool b) | ||
201 | #endif | ||
183 | } | 202 | } |
184 | 203 | ||
185 | MainWindow::~MainWindow() | 204 | MainWindow::~MainWindow() |
@@ -189,7 +208,12 @@ MainWindow::~MainWindow() | |||
189 | void MainWindow::runIpkg() | 208 | void MainWindow::runIpkg() |
190 | { | 209 | { |
191 | ipkg->commit( packageList ); | 210 | ipkg->commit( packageList ); |
192 | // updateList(); //to remove | 211 | // ##### If we looked in the list of files, we could send out accurate |
212 | // ##### messages. But we don't bother yet, and just do an "all". | ||
213 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
214 | QString lf = QString::null; | ||
215 | e << lf; | ||
216 | displayList(); | ||
193 | } | 217 | } |
194 | 218 | ||
195 | void MainWindow::updateList() | 219 | void MainWindow::updateList() |
@@ -200,7 +224,7 @@ void MainWindow::updateList() | |||
200 | packageList.clear(); | 224 | packageList.clear(); |
201 | ipkg->update(); | 225 | ipkg->update(); |
202 | getList(); | 226 | getList(); |
203 | t->stop(); | 227 | t->stop(); |
204 | } | 228 | } |
205 | 229 | ||
206 | void MainWindow::getList() | 230 | void MainWindow::getList() |
@@ -224,7 +248,7 @@ void MainWindow::displayList() | |||
224 | while( pack ) | 248 | while( pack ) |
225 | { | 249 | { |
226 | if ( pack && (pack->name() != "") ) | 250 | if ( pack && (pack->name() != "") ) |
227 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack ) ); | 251 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) ); |
228 | pack = packageList.next(); | 252 | pack = packageList.next(); |
229 | } | 253 | } |
230 | } | 254 | } |
@@ -291,20 +315,24 @@ void MainWindow::showSettingsDst() | |||
291 | 315 | ||
292 | void MainWindow::showDetails() | 316 | void MainWindow::showDetails() |
293 | { | 317 | { |
294 | if ( activePackage ) return; | ||
295 | if ( details ) | 318 | if ( details ) |
296 | { | 319 | { |
297 | details = new PackageDetails( this ); | 320 | details = new PackageDetails( this ); |
298 | connect( details->install, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); | 321 | connect( details->install, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); |
299 | connect( details->remove, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); | 322 | connect( details->remove, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); |
300 | connect( details->ignore, SIGNAL(clicked()), details, SLOT(close())); | 323 | connect( details->ignore, SIGNAL(clicked()), details, SLOT(close())); |
301 | details->description->setTextFormat(RichText); | 324 | details->description->setTextFormat(RichText); |
302 | } | 325 | } |
303 | 326 | if ( !activePackage ) | |
304 | details->setCaption("Package: " + activePackage->name()); | 327 | { |
305 | details->description->setText(activePackage->details() ); | 328 | details->description->setText(tr("no package selected")); |
306 | details->install->setEnabled(!activePackage->installed()); | 329 | details->description->setText(tr("errmm...<br>...not working?")); |
307 | details->remove->setEnabled(activePackage->installed()); | 330 | }else{ |
331 | details->setCaption("Package: " + activePackage->name()); | ||
332 | details->description->setText(activePackage->details() ); | ||
333 | details->install->setEnabled(!activePackage->installed()); | ||
334 | details->remove->setEnabled(activePackage->installed()); | ||
335 | } | ||
308 | details->showMaximized(); | 336 | details->showMaximized(); |
309 | } | 337 | } |
310 | 338 | ||
@@ -316,10 +344,11 @@ void MainWindow::toggleActivePackage() | |||
316 | 344 | ||
317 | void MainWindow::setCurrent( QListViewItem* p ) | 345 | void MainWindow::setCurrent( QListViewItem* p ) |
318 | { | 346 | { |
319 | pvDebug(2, "MainWindow::setCurrent "); | 347 | if ( !p ) return; |
320 | return; | 348 | activePackageListItem = (PackageListItem*)p; |
321 | pvDebug(2, "name "+((Package*)p)->name()); | 349 | activePackage = activePackageListItem->getPackage(); |
322 | activePackage = (Package*)p; | 350 | pvDebug(5, "start timer"); |
351 | popupTimer->start( 750, true ); | ||
323 | } | 352 | } |
324 | 353 | ||
325 | void MainWindow::sectionShow(bool b) | 354 | void MainWindow::sectionShow(bool b) |
@@ -355,3 +384,35 @@ void MainWindow::rotateUpdateIcon() | |||
355 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); | 384 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); |
356 | updateIcon = !updateIcon; | 385 | updateIcon = !updateIcon; |
357 | } | 386 | } |
387 | |||
388 | void MainWindow::showPopup() | ||
389 | { | ||
390 | popupMenu->clear(); | ||
391 | destsMenu->clear(); | ||
392 | |||
393 | QAction *popupAction; | ||
394 | popupMenu->insertItem( tr("Install to"), destsMenu ); | ||
395 | QStringList dests = settings->getDestinationNames(); | ||
396 | for (uint i = 0; i < dests.count(); i++ ) | ||
397 | { | ||
398 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); | ||
399 | popupAction->addTo( destsMenu ); | ||
400 | } | ||
401 | connect( destsMenu, SIGNAL( activated( int ) ), | ||
402 | this, SLOT( changePackageDest( int ) ) ); | ||
403 | popupMenu->popup( QCursor::pos() ); | ||
404 | } | ||
405 | |||
406 | void MainWindow::changePackageDest( int i ) | ||
407 | { | ||
408 | activePackage->setDest( destsMenu->text(i) ); | ||
409 | activePackage->setOn(); | ||
410 | activePackage->setLink( settings->createLinks() ); | ||
411 | activePackageListItem->displayDetails(); | ||
412 | } | ||
413 | |||
414 | void MainWindow::stopTimer( QListViewItem* ) | ||
415 | { | ||
416 | pvDebug( 5, "stop timer" ); | ||
417 | popupTimer->stop(); | ||
418 | } | ||
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index 892d5e8..adc5e78 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h | |||
@@ -15,7 +15,7 @@ class QComboBox; | |||
15 | class QPEToolBar; | 15 | class QPEToolBar; |
16 | class QLineEdit; | 16 | class QLineEdit; |
17 | class QListView; | 17 | class QListView; |
18 | 18 | class PackageListItem; | |
19 | 19 | ||
20 | class MainWindow : public QMainWindow | 20 | class MainWindow : public QMainWindow |
21 | { | 21 | { |
@@ -46,6 +46,9 @@ public slots: | |||
46 | void findClose(); | 46 | void findClose(); |
47 | void findShow(bool); | 47 | void findShow(bool); |
48 | void filterList(); | 48 | void filterList(); |
49 | void showPopup(); | ||
50 | void changePackageDest( int ); | ||
51 | void stopTimer( QListViewItem* ); | ||
49 | 52 | ||
50 | private: | 53 | private: |
51 | void makeMenu(); | 54 | void makeMenu(); |
@@ -57,19 +60,21 @@ private: | |||
57 | PackageDetails* details; | 60 | PackageDetails* details; |
58 | PackageList packageList; | 61 | PackageList packageList; |
59 | Package *activePackage; | 62 | Package *activePackage; |
63 | PackageListItem *activePackageListItem; | ||
60 | QAction *runAction; | 64 | QAction *runAction; |
61 | QAction *detailsAction; | 65 | QAction *detailsAction; |
62 | QAction *updateAction; | 66 | QAction *updateAction; |
63 | QAction *findAction; | 67 | QAction *findAction; |
64 | QAction *sectionAction; | 68 | QAction *sectionAction; |
65 | QListView *listViewPackages; | 69 | QListView *listViewPackages; |
66 | QPopupMenu *contextMenu; | ||
67 | QPEToolBar *findBar; | 70 | QPEToolBar *findBar; |
68 | QLineEdit *findEdit; | 71 | QLineEdit *findEdit; |
69 | QPEToolBar *sectionBar; | 72 | QPEToolBar *sectionBar; |
70 | QComboBox *section; | 73 | QComboBox *section; |
71 | QComboBox *subsection; | 74 | QComboBox *subsection; |
75 | QTimer *popupTimer; | ||
72 | QPopupMenu *popupMenu; | 76 | QPopupMenu *popupMenu; |
77 | QPopupMenu *destsMenu; | ||
73 | bool updateIcon; | 78 | bool updateIcon; |
74 | private slots: | 79 | private slots: |
75 | void rotateUpdateIcon(); | 80 | void rotateUpdateIcon(); |
diff --git a/noncore/unsupported/oipkg/opie-oipkg.control b/noncore/unsupported/oipkg/opie-oipkg.control index 89cc0b4..2ffec71 100644 --- a/noncore/unsupported/oipkg/opie-oipkg.control +++ b/noncore/unsupported/oipkg/opie-oipkg.control | |||
@@ -4,6 +4,6 @@ Section: opie/settings | |||
4 | Maintainer: Patrick S. Vogt <tille@almana.ch> | 4 | Maintainer: Patrick S. Vogt <tille@almana.ch> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION), ipkg (>0.9) |
8 | Description: Package Manager | 8 | Description: Package Manager |
9 | A GUI front-end to ipkg for the Opie environment. | 9 | A GUI front-end to ipkg for the Opie environment. |
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 1705f78..9f602b5 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -9,8 +9,14 @@ Package::~Package() | |||
9 | { | 9 | { |
10 | } | 10 | } |
11 | 11 | ||
12 | Package::Package() | 12 | Package::Package( PackageManagerSettings *s ) |
13 | { | 13 | { |
14 | init(s); | ||
15 | } | ||
16 | |||
17 | void Package::init( PackageManagerSettings *s ) | ||
18 | { | ||
19 | settings = s; | ||
14 | _size = ""; | 20 | _size = ""; |
15 | _section = ""; | 21 | _section = ""; |
16 | _subsection = ""; | 22 | _subsection = ""; |
@@ -19,25 +25,26 @@ Package::Package() | |||
19 | _name = ""; | 25 | _name = ""; |
20 | _toProcess = false; | 26 | _toProcess = false; |
21 | _status = ""; | 27 | _status = ""; |
28 | _dest = ""; | ||
22 | } | 29 | } |
23 | 30 | ||
24 | Package::Package( QStringList pack ) | 31 | Package::Package( QStringList pack, PackageManagerSettings *s ) |
25 | { | 32 | { |
26 | Package(); | 33 | init(s); |
27 | parsePackage( pack ); | 34 | parsePackage( pack ); |
28 | _toProcess = false; | 35 | _toProcess = false; |
29 | } | 36 | } |
30 | 37 | ||
31 | Package::Package( QString n ) | 38 | Package::Package( QString n, PackageManagerSettings *s ) |
32 | { | 39 | { |
33 | Package(); | 40 | init(s); |
34 | _name = QString( n ); | 41 | _name = QString( n ); |
35 | _toProcess = false; | 42 | _toProcess = false; |
36 | } | 43 | } |
37 | 44 | ||
38 | Package::Package( Package *pi ) | 45 | Package::Package( Package *pi ) |
39 | { | 46 | { |
40 | Package(); | 47 | init(pi->settings); |
41 | copyValues( pi ); | 48 | copyValues( pi ); |
42 | _toProcess = false; | 49 | _toProcess = false; |
43 | } | 50 | } |
@@ -172,7 +179,7 @@ void Package::copyValues( Package* pack ) | |||
172 | if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); | 179 | if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); |
173 | } | 180 | } |
174 | 181 | ||
175 | QString Package::getSection() | 182 | QString Package::section() |
176 | { | 183 | { |
177 | return _section; | 184 | return _section; |
178 | } | 185 | } |
@@ -190,7 +197,7 @@ void Package::setSection( QString s) | |||
190 | } | 197 | } |
191 | } | 198 | } |
192 | 199 | ||
193 | QString Package::getSubSection() | 200 | QString Package::subSection() |
194 | { | 201 | { |
195 | return _subsection; | 202 | return _subsection; |
196 | } | 203 | } |
@@ -253,11 +260,38 @@ QString Package::details() | |||
253 | return description; | 260 | return description; |
254 | } | 261 | } |
255 | 262 | ||
256 | /** No descriptions */ | ||
257 | void Package::processed() | 263 | void Package::processed() |
258 | { | 264 | { |
259 | _toProcess = false; | 265 | _toProcess = false; |
260 | //hack, but we're mot writing status anyway... | 266 | //hack, but we're not writing status anyway... |
261 | if ( installed() ) _status = "install"; | 267 | if ( installed() ) _status = "install"; |
262 | else _status = "installed"; | 268 | else _status = "installed"; |
263 | } | 269 | } |
270 | |||
271 | QString Package::dest() | ||
272 | { | ||
273 | if ( installed()||(!installed() && _toProcess) ) | ||
274 | return _dest!=""?_dest:settings->getDestinationName(); | ||
275 | else return ""; | ||
276 | } | ||
277 | |||
278 | void Package::setDest( QString d ) | ||
279 | { | ||
280 | _dest = d; | ||
281 | } | ||
282 | |||
283 | void Package::setOn() | ||
284 | { | ||
285 | _toProcess = true; | ||
286 | } | ||
287 | |||
288 | bool Package::link() | ||
289 | { | ||
290 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; | ||
291 | return _link; | ||
292 | } | ||
293 | |||
294 | void Package::setLink(bool b) | ||
295 | { | ||
296 | _link = b; | ||
297 | } | ||
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index cf2af75..6c292ed 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h | |||
@@ -8,14 +8,16 @@ | |||
8 | #include <qdict.h> | 8 | #include <qdict.h> |
9 | #include <qobject.h> | 9 | #include <qobject.h> |
10 | 10 | ||
11 | #include "pksettings.h" | ||
12 | |||
11 | class Package //: public QObject | 13 | class Package //: public QObject |
12 | { | 14 | { |
13 | //Q_OBJECT | 15 | //Q_OBJECT |
14 | public: | 16 | public: |
15 | Package(); | 17 | Package(PackageManagerSettings *); |
16 | ~Package(); | 18 | ~Package(); |
17 | Package( QStringList ); | 19 | Package( QStringList, PackageManagerSettings * ); |
18 | Package( QString ); | 20 | Package( QString, PackageManagerSettings * ); |
19 | Package( Package* ); | 21 | Package( Package* ); |
20 | 22 | ||
21 | void setValue( QString, QString ); | 23 | void setValue( QString, QString ); |
@@ -29,27 +31,35 @@ class Package //: public QObject | |||
29 | QString desc(); | 31 | QString desc(); |
30 | QString size(); | 32 | QString size(); |
31 | void setSection( QString ); | 33 | void setSection( QString ); |
32 | QString getSection(); | 34 | QString section(); |
33 | QString getSubSection(); | 35 | QString subSection(); |
34 | QString details(); | 36 | QString details(); |
35 | bool toProcess(); | 37 | bool toProcess(); |
36 | bool toInstall(); | 38 | bool toInstall(); |
37 | bool toRemove(); | 39 | bool toRemove(); |
38 | /** No descriptions */ | ||
39 | void processed(); | 40 | void processed(); |
41 | QString dest(); | ||
42 | void setDest( QString d ); | ||
43 | void setOn(); | ||
44 | bool link(); | ||
45 | void setLink(bool); | ||
40 | public slots: | 46 | public slots: |
41 | void toggleProcess(); | 47 | void toggleProcess(); |
42 | 48 | ||
43 | private: | 49 | private: |
50 | PackageManagerSettings *settings; | ||
44 | QString _name; | 51 | QString _name; |
45 | bool _toProcess; | 52 | bool _toProcess; |
53 | bool _link; | ||
46 | QString _status; | 54 | QString _status; |
47 | QString _size; | 55 | QString _size; |
48 | QString _section; | 56 | QString _section; |
49 | QString _subsection; | 57 | QString _subsection; |
50 | QString _shortDesc; | 58 | QString _shortDesc; |
51 | QString _desc; | 59 | QString _desc; |
60 | QString _dest; | ||
52 | void parsePackage( QStringList ); | 61 | void parsePackage( QStringList ); |
62 | void init(PackageManagerSettings *); | ||
53 | }; | 63 | }; |
54 | 64 | ||
55 | 65 | ||
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index 944bb83..035ec81 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp | |||
@@ -70,8 +70,8 @@ void PackageList::filterPackages( QString f ) | |||
70 | while ( pack ) | 70 | while ( pack ) |
71 | { | 71 | { |
72 | if ( | 72 | if ( |
73 | ((aktSection=="All")||(pack->getSection()==aktSection)) && | 73 | ((aktSection=="All")||(pack->section()==aktSection)) && |
74 | ((aktSubSection=="All")||(pack->getSubSection()==aktSubSection)) && | 74 | ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) && |
75 | pack->name().contains( f ) | 75 | pack->name().contains( f ) |
76 | ) | 76 | ) |
77 | { | 77 | { |
@@ -126,11 +126,11 @@ void PackageList::setSubSection( QString ssec ) | |||
126 | 126 | ||
127 | void PackageList::updateSections( Package* pack ) | 127 | void PackageList::updateSections( Package* pack ) |
128 | { | 128 | { |
129 | QString s = pack->getSection(); | 129 | QString s = pack->section(); |
130 | if ( s.isEmpty() || s == "") return; | 130 | if ( s.isEmpty() || s == "") return; |
131 | if ( sections.contains(s) ) return; | 131 | if ( sections.contains(s) ) return; |
132 | sections += s; | 132 | sections += s; |
133 | QString ss = pack->getSubSection(); | 133 | QString ss = pack->subSection(); |
134 | if ( ss.isEmpty() || ss == "" ) return; | 134 | if ( ss.isEmpty() || ss == "" ) return; |
135 | if ( !subSections[s] ) { | 135 | if ( !subSections[s] ) { |
136 | subSections.insert( s, new QStringList() ); | 136 | subSections.insert( s, new QStringList() ); |
@@ -150,10 +150,13 @@ void PackageList::updateSections( Package* pack ) | |||
150 | void PackageList::parseStatus() | 150 | void PackageList::parseStatus() |
151 | { | 151 | { |
152 | QStringList dests = settings->getDestinationUrls(); | 152 | QStringList dests = settings->getDestinationUrls(); |
153 | for ( QStringList::Iterator it = dests.begin(); it != dests.end(); ++it ) | 153 | QStringList destnames = settings->getDestinationNames(); |
154 | QStringList::Iterator name = destnames.begin(); | ||
155 | for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir ) | ||
154 | { | 156 | { |
155 | pvDebug( 2,"Status Dir: "+*it+statusDir+"/status"); | 157 | pvDebug( 2,"Status: "+*dir+statusDir+"/status"); |
156 | readFileEntries( *it+statusDir+"/status" ); | 158 | readFileEntries( *dir+statusDir+"/status", *name ); |
159 | ++name; | ||
157 | }; | 160 | }; |
158 | } | 161 | } |
159 | 162 | ||
@@ -163,12 +166,12 @@ void PackageList::parseList() | |||
163 | 166 | ||
164 | for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it ) | 167 | for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it ) |
165 | { | 168 | { |
166 | pvDebug( 2, "List Dir: "+listsDir+"/"+*it); | 169 | pvDebug( 2, "List: "+listsDir+"/"+*it); |
167 | readFileEntries( listsDir+"/"+*it ); | 170 | readFileEntries( listsDir+"/"+*it, "" ); |
168 | } | 171 | } |
169 | } | 172 | } |
170 | 173 | ||
171 | void PackageList::readFileEntries( QString filename ) | 174 | void PackageList::readFileEntries( QString filename, QString dest ) |
172 | { | 175 | { |
173 | QStringList packEntry; | 176 | QStringList packEntry; |
174 | QFile f( filename ); | 177 | QFile f( filename ); |
@@ -182,7 +185,8 @@ void PackageList::readFileEntries( QString filename ) | |||
182 | //end of package | 185 | //end of package |
183 | if ( ! packEntry.isEmpty() ) | 186 | if ( ! packEntry.isEmpty() ) |
184 | { | 187 | { |
185 | Package *p = new Package( packEntry ); | 188 | Package *p = new Package( packEntry, settings ); |
189 | p->setDest( dest ); | ||
186 | if ( p ) | 190 | if ( p ) |
187 | { | 191 | { |
188 | insertPackage( p ); | 192 | insertPackage( p ); |
@@ -199,11 +203,11 @@ void PackageList::readFileEntries( QString filename ) | |||
199 | 203 | ||
200 | void PackageList::update() | 204 | void PackageList::update() |
201 | { | 205 | { |
202 | pvDebug( 3, "parseStatus"); | 206 | pvDebug( 2, "parseStatus"); |
203 | parseStatus(); | 207 | parseStatus(); |
204 | pvDebug( 3, "parseList"); | 208 | pvDebug( 2, "parseList"); |
205 | parseList(); | 209 | parseList(); |
206 | pvDebug( 3, "finished parsing"); | 210 | pvDebug( 2, "finished parsing"); |
207 | } | 211 | } |
208 | 212 | ||
209 | void PackageList::setSettings( PackageManagerSettings *s ) | 213 | void PackageList::setSettings( PackageManagerSettings *s ) |
@@ -221,3 +225,17 @@ void PackageList::clear() | |||
221 | origPackageList.clear(); | 225 | origPackageList.clear(); |
222 | packageList.clear(); | 226 | packageList.clear(); |
223 | } | 227 | } |
228 | |||
229 | void PackageList::allPackages() | ||
230 | { | ||
231 | packageList.clear(); | ||
232 | QDictIterator<Package> filterIter( origPackageList ); | ||
233 | filterIter.toFirst(); | ||
234 | Package *pack= filterIter.current() ; | ||
235 | while ( pack ) | ||
236 | { | ||
237 | packageList.insert( pack->name(), pack ); | ||
238 | ++filterIter; | ||
239 | pack = filterIter.current(); | ||
240 | } | ||
241 | } | ||
diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h index 4ce97af..7c326ca 100644 --- a/noncore/unsupported/oipkg/packagelist.h +++ b/noncore/unsupported/oipkg/packagelist.h | |||
@@ -12,7 +12,9 @@ | |||
12 | static QString statusDir="/usr/lib/ipkg/"; | 12 | static QString statusDir="/usr/lib/ipkg/"; |
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | class PackageList { | 15 | class PackageList //:QObject |
16 | { | ||
17 | // Q_OBJECT | ||
16 | public: | 18 | public: |
17 | //static QString all = QObject::tr("All"); | 19 | //static QString all = QObject::tr("All"); |
18 | 20 | ||
@@ -29,8 +31,8 @@ public: | |||
29 | void setSettings( PackageManagerSettings* ); | 31 | void setSettings( PackageManagerSettings* ); |
30 | void filterPackages( QString ); | 32 | void filterPackages( QString ); |
31 | Package* getByName( QString ); | 33 | Package* getByName( QString ); |
32 | /** No descriptions */ | ||
33 | void clear(); | 34 | void clear(); |
35 | void allPackages(); | ||
34 | 36 | ||
35 | public slots: | 37 | public slots: |
36 | void setSection(QString); | 38 | void setSection(QString); |
@@ -61,7 +63,7 @@ private: | |||
61 | void updateSections( Package* ); | 63 | void updateSections( Package* ); |
62 | void parseStatus(); | 64 | void parseStatus(); |
63 | void parseList(); | 65 | void parseList(); |
64 | void readFileEntries( QString ); | 66 | void readFileEntries( QString file, QString dest ); |
65 | }; | 67 | }; |
66 | 68 | ||
67 | 69 | ||
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index 5d08bb1..149ba35 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp | |||
@@ -1,24 +1,51 @@ | |||
1 | #include "packagelistitem.h" | 1 | #include "packagelistitem.h" |
2 | 2 | ||
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | #include <qobject.h> | ||
5 | |||
6 | #include "debug.h" | ||
4 | 7 | ||
5 | static QPixmap *pm_uninstalled=0; | 8 | static QPixmap *pm_uninstalled=0; |
6 | static QPixmap *pm_installed=0; | 9 | static QPixmap *pm_installed=0; |
7 | static QPixmap *pm_uninstall=0; | 10 | static QPixmap *pm_uninstall=0; |
8 | static QPixmap *pm_install=0; | 11 | static QPixmap *pm_install=0; |
9 | 12 | ||
10 | PackageListItem::PackageListItem(QListView* lv, Package *pi) | 13 | PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) |
11 | :QCheckListItem(lv,pi->name(),CheckBox) | 14 | :QCheckListItem(lv,pi->name(),CheckBox) |
12 | { | 15 | { |
13 | package = pi; | 16 | package = pi; |
17 | settings = s; | ||
18 | setExpandable( true ); | ||
19 | QCheckListItem *item; | ||
20 | #ifndef NEWLAYOUT | ||
21 | item = new QCheckListItem( this, QObject::tr("Name") ); | ||
22 | item->setText(1,pi->name()); | ||
23 | item = new QCheckListItem( this, QObject::tr("Description") ); | ||
24 | item->setText(1,pi->desc()+"\ntest multi\nline"); | ||
25 | item = new QCheckListItem( this, QObject::tr("Size") ); | ||
26 | item->setText(1,pi->size()); | ||
27 | item = new QCheckListItem( this, QObject::tr("Destination") ); | ||
28 | item->setText(1,pi->getDest()); | ||
29 | #endif | ||
30 | #ifdef NEWLAYOUT | ||
31 | item = new QCheckListItem( this, QObject::tr("Name: ")+pi->name() ); | ||
32 | item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); | ||
33 | item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); | ||
34 | destItem = new QCheckListItem( this, "" ); | ||
35 | linkItem = new QCheckListItem( this, "" ); | ||
36 | displayDetails(); | ||
37 | #endif | ||
38 | |||
14 | if (!pm_uninstalled) { | 39 | if (!pm_uninstalled) { |
15 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); | 40 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); |
16 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); | 41 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); |
17 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); | 42 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); |
18 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); | 43 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); |
19 | } | 44 | } |
45 | #ifndef NEWLAYOUT | ||
20 | setText(1, package->shortDesc() ); | 46 | setText(1, package->shortDesc() ); |
21 | setText(2, package->size() ); | 47 | setText(2, package->size() ); |
48 | #endif | ||
22 | } | 49 | } |
23 | 50 | ||
24 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, | 51 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, |
@@ -93,5 +120,20 @@ void PackageListItem::setOn( bool b ) | |||
93 | { | 120 | { |
94 | QCheckListItem::setOn( b ); | 121 | QCheckListItem::setOn( b ); |
95 | package->toggleProcess(); | 122 | package->toggleProcess(); |
123 | // if ( b ) | ||
124 | // { | ||
125 | // if ((package->dest()).isEmpty) | ||
126 | // package->setDest( settings->getDestinationName() ); | ||
127 | // }else{ | ||
128 | // package->setDest( QObject::tr("not installed")); | ||
129 | // } | ||
130 | package->setLink( settings->createLinks() ); | ||
131 | displayDetails(); | ||
132 | } | ||
133 | |||
134 | void PackageListItem::displayDetails() | ||
135 | { | ||
136 | linkItem->setText( 0, QObject::tr("Link: ")+QString(package->link()?QObject::tr("Yes"):QObject::tr("No")) ); | ||
137 | destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); | ||
96 | repaint(); | 138 | repaint(); |
97 | } | 139 | } |
diff --git a/noncore/unsupported/oipkg/packagelistitem.h b/noncore/unsupported/oipkg/packagelistitem.h index 6983e58..f695432 100644 --- a/noncore/unsupported/oipkg/packagelistitem.h +++ b/noncore/unsupported/oipkg/packagelistitem.h | |||
@@ -9,11 +9,13 @@ | |||
9 | #include <qpixmap.h> | 9 | #include <qpixmap.h> |
10 | #include <qdict.h> | 10 | #include <qdict.h> |
11 | 11 | ||
12 | #include "pksettings.h" | ||
13 | |||
12 | class PackageListItem | 14 | class PackageListItem |
13 | : public QCheckListItem | 15 | : public QCheckListItem |
14 | { | 16 | { |
15 | public: | 17 | public: |
16 | PackageListItem(QListView*, Package* ); | 18 | PackageListItem(QListView*, Package*, PackageManagerSettings*); |
17 | void paintCell( QPainter*, const QColorGroup&, int, int, int ); | 19 | void paintCell( QPainter*, const QColorGroup&, int, int, int ); |
18 | void paintFocus( QPainter*, const QColorGroup&, const QRect& ); | 20 | void paintFocus( QPainter*, const QColorGroup&, const QRect& ); |
19 | QPixmap statePixmap() const; | 21 | QPixmap statePixmap() const; |
@@ -22,8 +24,12 @@ public: | |||
22 | QString getName() { return package->name(); } ; | 24 | QString getName() { return package->name(); } ; |
23 | bool isInstalled(){ return package->installed(); }; | 25 | bool isInstalled(){ return package->installed(); }; |
24 | virtual void setOn ( bool ); | 26 | virtual void setOn ( bool ); |
27 | void displayDetails(); | ||
25 | 28 | ||
26 | private: | 29 | private: |
30 | QCheckListItem *destItem; | ||
31 | QCheckListItem *linkItem; | ||
32 | PackageManagerSettings *settings; | ||
27 | Package *package; | 33 | Package *package; |
28 | }; | 34 | }; |
29 | 35 | ||
diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp index 32224b5..f84a9c4 100644 --- a/noncore/unsupported/oipkg/pksettings.cpp +++ b/noncore/unsupported/oipkg/pksettings.cpp | |||
@@ -469,6 +469,7 @@ QStringList PackageManagerSettings::getActiveServers() | |||
469 | } | 469 | } |
470 | return sl; | 470 | return sl; |
471 | } | 471 | } |
472 | |||
472 | /** returns the destination listed in ipkg.conf */ | 473 | /** returns the destination listed in ipkg.conf */ |
473 | QStringList PackageManagerSettings::getDestinationUrls() | 474 | QStringList PackageManagerSettings::getDestinationUrls() |
474 | { | 475 | { |
@@ -480,6 +481,29 @@ QStringList PackageManagerSettings::getDestinationUrls() | |||
480 | return sl; | 481 | return sl; |
481 | } | 482 | } |
482 | 483 | ||
484 | /** returns the destination listed in ipkg.conf */ | ||
485 | QString PackageManagerSettings::getDestinationUrlByName(QString n) | ||
486 | { | ||
487 | QStringList sl; | ||
488 | for (int i=0; i<(int)destinations->count(); i++) | ||
489 | { | ||
490 | if ( n == destinations->text(i)) return*destinationurlDic[i]; | ||
491 | } | ||
492 | return ""; | ||
493 | } | ||
494 | |||
495 | /** returns the destination listed in ipkg.conf */ | ||
496 | QStringList PackageManagerSettings::getDestinationNames() | ||
497 | { | ||
498 | QStringList sl; | ||
499 | for (int i=0; i<(int)destinations->count(); i++) | ||
500 | { | ||
501 | sl += destinations->text(i); | ||
502 | } | ||
503 | return sl; | ||
504 | } | ||
505 | |||
506 | |||
483 | void PackageManagerSettings::linkEnabled( bool b ) | 507 | void PackageManagerSettings::linkEnabled( bool b ) |
484 | { | 508 | { |
485 | changed = true; | 509 | changed = true; |
diff --git a/noncore/unsupported/oipkg/pksettings.h b/noncore/unsupported/oipkg/pksettings.h index 2982f1c..11ba55c 100644 --- a/noncore/unsupported/oipkg/pksettings.h +++ b/noncore/unsupported/oipkg/pksettings.h | |||
@@ -19,6 +19,9 @@ public: | |||
19 | bool createLinks(); | 19 | bool createLinks(); |
20 | QStringList getActiveServers(); | 20 | QStringList getActiveServers(); |
21 | QStringList getDestinationUrls(); | 21 | QStringList getDestinationUrls(); |
22 | QStringList getDestinationNames(); | ||
23 | QString getDestinationUrlByName(QString); | ||
24 | |||
22 | private: | 25 | private: |
23 | QIntDict<QString> serverurlDic; | 26 | QIntDict<QString> serverurlDic; |
24 | QIntDict<QString> destinationurlDic; | 27 | QIntDict<QString> destinationurlDic; |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index eae73ad..3b31b4d 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <qpe/resource.h> | 8 | #include <qpe/resource.h> |
9 | #include <qpe/config.h> | 9 | #include <qpe/config.h> |
10 | #include <qpe/stringutil.h> | 10 | #include <qpe/stringutil.h> |
11 | #include <qpe/qcopenvelope_qws.h> | ||
12 | #include <qdir.h> | 11 | #include <qdir.h> |
13 | #include <qfile.h> | 12 | #include <qfile.h> |
14 | #include <qmultilineedit.h> | 13 | #include <qmultilineedit.h> |
@@ -40,38 +39,37 @@ PmIpkg::~PmIpkg() | |||
40 | 39 | ||
41 | //#define PROC | 40 | //#define PROC |
42 | #define SYSTEM | 41 | #define SYSTEM |
43 | int PmIpkg::runIpkg(const QString& args) | 42 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) |
44 | { | 43 | { |
45 | pvDebug(2,"PmIpkg::runIpkg "+args); | 44 | pvDebug(2,"PmIpkg::runIpkg "+args); |
46 | 45 | ||
47 | //to make script ipkg happy | ||
48 | pvDebug(2, "cd "+settings->getDestinationUrl()+"/tmp/ipkg"); | ||
49 | if (!QDir::setCurrent(settings->getDestinationUrl()+"/tmp/ipkg")) | ||
50 | { | ||
51 | QDir instDir = QDir(settings->getDestinationUrl()+"/tmp/ipkg"); | ||
52 | instDir.mkdir(settings->getDestinationUrl()+"/tmp/ipkg"); | ||
53 | } | ||
54 | #ifdef PROC | 46 | #ifdef PROC |
55 | QStringList cmd = "/usr/bin/ipkg "; | 47 | QStringList cmd = "/usr/bin/ipkg "; |
56 | #endif | 48 | #endif |
57 | #ifdef SYSTEM | 49 | #ifdef SYSTEM |
58 | QString cmd = "/usr/bin/ipkg "; | 50 | QString cmd = "/usr/bin/ipkg "; |
59 | #endif | 51 | #endif |
60 | cmd += " -dest "+settings->getDestinationName(); | 52 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
53 | if ( dest == "" ) | ||
54 | cmd += " -dest "+settings->getDestinationName(); | ||
55 | else | ||
56 | cmd += " -dest "+ dest; | ||
57 | |||
61 | cmd += " -force-defaults "; | 58 | cmd += " -force-defaults "; |
62 | 59 | ||
63 | out( "<hr><br>Starting to "+ args+"<br>\n"); | 60 | out( "<hr><br>Starting to "+ args+"<br>\n"); |
64 | cmd += args; | 61 | cmd += args; |
65 | out( "running:<br>\n"+cmd+"<br>\n" ); | ||
66 | int r = 0; | 62 | int r = 0; |
67 | #ifdef PROC | 63 | #ifdef PROC |
68 | QString o = "start"; | 64 | QString o = "start"; |
69 | Process ipkg( cmd ); | 65 | Process *ipkg = new Process( "ls");//cmd ); |
66 | out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); | ||
70 | QString description; | 67 | QString description; |
71 | ipkg.exec("",o); | 68 | ipkg->exec("",o); |
72 | out( o ); | 69 | // out( o ); |
73 | #endif | 70 | #endif |
74 | #ifdef SYSTEM | 71 | #ifdef SYSTEM |
72 | out( "running:<br>\n"+cmd+"<br>\n" ); | ||
75 | QString redirect = "/tmp/oipkg.pipe"; | 73 | QString redirect = "/tmp/oipkg.pipe"; |
76 | cmd += " | tee "+redirect+" 2>&1"; | 74 | cmd += " | tee "+redirect+" 2>&1"; |
77 | pvDebug(2, "running >"+cmd+"<"); | 75 | pvDebug(2, "running >"+cmd+"<"); |
@@ -80,16 +78,19 @@ int PmIpkg::runIpkg(const QString& args) | |||
80 | QString line; | 78 | QString line; |
81 | QString oldLine; | 79 | QString oldLine; |
82 | while ( ! f.open(IO_ReadOnly) ) {}; | 80 | while ( ! f.open(IO_ReadOnly) ) {}; |
83 | { | 81 | // { |
84 | QTextStream t( &f ); | 82 | QTextStream t( &f ); |
85 | // QString fp; | 83 | // QString fp; |
86 | while ( !t.eof() ) | 84 | while ( !t.eof() ) |
87 | { | 85 | { |
88 | line = t.readLine(); | 86 | line = t.readLine(); |
89 | if ( line != oldLine ) out( line +"<br>" ); | 87 | if ( line != oldLine ) |
90 | oldLine = line; | 88 | { |
89 | out( line +"<br>" ); | ||
90 | oldLine = line; | ||
91 | } | ||
91 | } | 92 | } |
92 | } | 93 | // } |
93 | f.close(); | 94 | f.close(); |
94 | out( "Finished!<br>"); | 95 | out( "Finished!<br>"); |
95 | #endif | 96 | #endif |
@@ -97,22 +98,24 @@ int PmIpkg::runIpkg(const QString& args) | |||
97 | return r; | 98 | return r; |
98 | } | 99 | } |
99 | 100 | ||
100 | void PmIpkg::makeLinks(QString pack) | 101 | void PmIpkg::makeLinks(Package *pack) |
101 | { | 102 | { |
102 | pvDebug( 2, "PmIpkg::makeLinks "+ pack); | 103 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
104 | QString dest = settings->getDestinationUrlByName( pack->dest() ); | ||
105 | if (dest == "/" ) return; | ||
103 | out( "<br>creating links<br>" ); | 106 | out( "<br>creating links<br>" ); |
104 | QString dest = settings->getDestinationUrl(); | 107 | out("for package "+pack->name()+" in "+dest+"<br>"); |
105 | out("for package "+pack+" in "+dest+"<br>"); | ||
106 | { | 108 | { |
107 | Config cfg( "oipkg", Config::User ); | 109 | Config cfg( "oipkg", Config::User ); |
108 | cfg.setGroup( "Common" ); | 110 | cfg.setGroup( "Common" ); |
109 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 111 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
110 | } | 112 | } |
111 | QString fn = dest+"/"+statusDir+"/info/"+pack+".list"; | 113 | QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; |
112 | QFile f( fn ); | 114 | QFile f( fn ); |
113 | if ( ! f.open(IO_ReadOnly) ) | 115 | if ( ! f.open(IO_ReadOnly) ) |
114 | { | 116 | { |
115 | out( "<b>Panik!</b> Could not open:<br>"+fn ); | 117 | out( "<b>Panik!</b> Could not open:<br>"+fn ); |
118 | return; | ||
116 | }; | 119 | }; |
117 | QTextStream t( &f ); | 120 | QTextStream t( &f ); |
118 | QString fp; | 121 | QString fp; |
@@ -126,8 +129,10 @@ void PmIpkg::makeLinks(QString pack) | |||
126 | 129 | ||
127 | void PmIpkg::processLinkDir( QString file, QString dest ) | 130 | void PmIpkg::processLinkDir( QString file, QString dest ) |
128 | { | 131 | { |
132 | if ( dest == "???" ) return; | ||
129 | QString destFile = file; | 133 | QString destFile = file; |
130 | file = dest+"/"+file; | 134 | file = dest+"/"+file; |
135 | if (file == dest) return; | ||
131 | QFileInfo fileInfo( file ); | 136 | QFileInfo fileInfo( file ); |
132 | if ( fileInfo.isDir() ) | 137 | if ( fileInfo.isDir() ) |
133 | { | 138 | { |
@@ -166,30 +171,21 @@ void PmIpkg::commit( PackageList pl ) | |||
166 | int sizecount = 0; | 171 | int sizecount = 0; |
167 | QString rem="<b>To remove:</b><br>\n"; | 172 | QString rem="<b>To remove:</b><br>\n"; |
168 | QString inst="<b>To install:</b><br>\n";; | 173 | QString inst="<b>To install:</b><br>\n";; |
174 | pl.allPackages(); | ||
169 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) | 175 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) |
170 | { | 176 | { |
171 | if ( pack && (pack->name() != "") && pack) | 177 | if ( pack && (pack->name() != "") && pack) |
172 | { | 178 | { |
173 | if ( pack->toInstall() ) | 179 | if ( pack->toInstall() ) |
174 | { | 180 | { |
175 | #ifndef NEWLIST | ||
176 | to_install.append( pack->name() ); | ||
177 | #endif | ||
178 | #ifdef NEWLIST | ||
179 | to_install.append( pack ); | 181 | to_install.append( pack ); |
180 | sizecount += pack->size().toInt(); | 182 | sizecount += pack->size().toInt(); |
181 | #endif | 183 | inst += pack->name()+"\t(on "+pack->dest()+")<br>"; |
182 | inst += pack->name()+"<br>"; | ||
183 | } | 184 | } |
184 | if ( pack->toRemove() ) | 185 | if ( pack->toRemove() ) |
185 | { | 186 | { |
186 | #ifndef NEWLIST | ||
187 | to_remove.append( pack->name() ); | ||
188 | #endif | ||
189 | #ifdef NEWLIST | ||
190 | to_remove.append( pack ); | 187 | to_remove.append( pack ); |
191 | sizecount += 1; | 188 | sizecount += 1; |
192 | #endif | ||
193 | rem += pack->name()+"<br>"; | 189 | rem += pack->name()+"<br>"; |
194 | } | 190 | } |
195 | } | 191 | } |
@@ -211,11 +207,6 @@ void PmIpkg::commit( PackageList pl ) | |||
211 | runwindow, SLOT( close() ) ); | 207 | runwindow, SLOT( close() ) ); |
212 | 208 | ||
213 | runwindow->exec(); | 209 | runwindow->exec(); |
214 | // ##### If we looked in the list of files, we could send out accurate | ||
215 | // ##### messages. But we don't bother yet, and just do an "all". | ||
216 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
217 | QString lf = QString::null; | ||
218 | e << lf; | ||
219 | return; | 210 | return; |
220 | } | 211 | } |
221 | 212 | ||
@@ -233,18 +224,6 @@ void PmIpkg::remove() | |||
233 | 224 | ||
234 | out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>"); | 225 | out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>"); |
235 | 226 | ||
236 | #ifndef NEWLIST | ||
237 | for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it) | ||
238 | { | ||
239 | if ( runIpkg("remove " + *it) == 0) | ||
240 | { | ||
241 | |||
242 | }else{ | ||
243 | out("<b>"+tr("Error while removing")+"</b>"+*it); | ||
244 | } | ||
245 | } | ||
246 | #endif | ||
247 | #ifdef NEWLIST | ||
248 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 227 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
249 | { | 228 | { |
250 | if ( runIpkg("remove " + it->name()) == 0) | 229 | if ( runIpkg("remove " + it->name()) == 0) |
@@ -256,7 +235,6 @@ void PmIpkg::remove() | |||
256 | out("<b>"+tr("Error while removing")+"</b>"+it->name()); | 235 | out("<b>"+tr("Error while removing")+"</b>"+it->name()); |
257 | } | 236 | } |
258 | } | 237 | } |
259 | #endif | ||
260 | } | 238 | } |
261 | 239 | ||
262 | 240 | ||
@@ -265,36 +243,22 @@ void PmIpkg::install() | |||
265 | if ( to_install.count() == 0 ) return; | 243 | if ( to_install.count() == 0 ) return; |
266 | show( true ); | 244 | show( true ); |
267 | out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); | 245 | out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); |
268 | #ifndef NEWLIST | 246 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
269 | for (QStringList::ConstIterator it=to_install.begin(); it!=to_install.end(); ++it) | ||
270 | { | ||
271 | if ( runIpkg("install " + *it) == 0 ) | ||
272 | { | ||
273 | if ( settings->createLinks() ) | ||
274 | makeLinks( *it ); | ||
275 | }else{ | ||
276 | out("<b>"+tr("Error while installing")+"</b>"+*it); | ||
277 | } | ||
278 | } | ||
279 | #endif | ||
280 | #ifdef NEWLIST | ||
281 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | ||
282 | { | 247 | { |
283 | if ( runIpkg("install " + it->name()) == 0 ) | 248 | |
249 | if ( runIpkg("install " + it->name(), it->dest() ) == 0 ) | ||
284 | { | 250 | { |
285 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | 251 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); |
286 | if ( settings->createLinks() ) | 252 | if ( it->link() ) |
287 | makeLinks( it->name() ); | 253 | makeLinks( it ); |
288 | it->processed(); | 254 | it->processed(); |
289 | }else{ | 255 | }else{ |
290 | out("<b>"+tr("Error while installing")+"</b>"+it->name()); | 256 | out("<b>"+tr("Error while installing")+"</b>"+it->name()); |
291 | } | 257 | } |
292 | } | 258 | } |
293 | #endif | ||
294 | } | 259 | } |
295 | 260 | ||
296 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) | 261 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) |
297 | // add 3rd package parameter | ||
298 | { | 262 | { |
299 | qDebug("msg="+msg+" -- "+QString(dest) ); | 263 | qDebug("msg="+msg+" -- "+QString(dest) ); |
300 | // QDir d( src ); | 264 | // QDir d( src ); |
@@ -345,8 +309,8 @@ void PmIpkg::show(bool b) | |||
345 | if (!runwindow->isVisible()) | 309 | if (!runwindow->isVisible()) |
346 | runwindow->showMaximized(); | 310 | runwindow->showMaximized(); |
347 | showButtons(b); | 311 | showButtons(b); |
348 | //if ( b ) | 312 | if ( b ) |
349 | runwindow->progress->hide(); | 313 | runwindow->progress->hide(); |
350 | // else | 314 | else |
351 | // runwindow->progress->show(); | 315 | runwindow->progress->show(); |
352 | } | 316 | } |
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index 2692017..c57adb7 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -11,7 +11,6 @@ | |||
11 | #include "packagelist.h" | 11 | #include "packagelist.h" |
12 | #include "debug.h" | 12 | #include "debug.h" |
13 | 13 | ||
14 | //#define NEWLIST | ||
15 | class Package; | 14 | class Package; |
16 | class PmIpkg : public QObject | 15 | class PmIpkg : public QObject |
17 | { | 16 | { |
@@ -29,20 +28,13 @@ public: | |||
29 | private: | 28 | private: |
30 | PackageManagerSettings* settings; | 29 | PackageManagerSettings* settings; |
31 | RunWindow *runwindow; | 30 | RunWindow *runwindow; |
32 | #ifndef NEWLIST | ||
33 | QStringList to_remove; | ||
34 | QStringList to_install; | ||
35 | #endif | ||
36 | #ifdef NEWLIST | ||
37 | QList<Package> to_remove; | 31 | QList<Package> to_remove; |
38 | QList<Package> to_install; | 32 | QList<Package> to_install; |
39 | #endif | ||
40 | bool runwindowopen; | 33 | bool runwindowopen; |
41 | 34 | ||
42 | void makeLinks(QString); | 35 | void makeLinks(Package*); |
43 | void processLinkDir( QString, QString ); | 36 | void processLinkDir( QString, QString ); |
44 | 37 | int runIpkg(const QString& args, const QString& dest="" ); | |
45 | int runIpkg(const QString& args); | ||
46 | void out( QString ); | 38 | void out( QString ); |
47 | 39 | ||
48 | public slots: | 40 | public slots: |
diff --git a/noncore/unsupported/oipkg/runwindow.ui b/noncore/unsupported/oipkg/runwindow.ui index 5359fe2..52da408 100644 --- a/noncore/unsupported/oipkg/runwindow.ui +++ b/noncore/unsupported/oipkg/runwindow.ui | |||
@@ -42,7 +42,7 @@ | |||
42 | </property> | 42 | </property> |
43 | <property stdset="1"> | 43 | <property stdset="1"> |
44 | <name>progress</name> | 44 | <name>progress</name> |
45 | <number>42</number> | 45 | <number>0</number> |
46 | </property> | 46 | </property> |
47 | </widget> | 47 | </widget> |
48 | <widget row="1" column="0" > | 48 | <widget row="1" column="0" > |
diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h index 5df522b..cf6e614 100644 --- a/noncore/unsupported/oipkg/settings.h +++ b/noncore/unsupported/oipkg/settings.h | |||
@@ -20,8 +20,6 @@ public: | |||
20 | bool createLinks(); | 20 | bool createLinks(); |
21 | QStringList getActiveServers(); | 21 | QStringList getActiveServers(); |
22 | QStringList getDestinationUrls(); | 22 | QStringList getDestinationUrls(); |
23 | /** No descriptions */ | ||
24 | QComboBox getActiveDestinationCombo(); | ||
25 | 23 | ||
26 | private: | 24 | private: |
27 | QIntDict<QString> serverurlDic; | 25 | QIntDict<QString> serverurlDic; |