-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 | |||
@@ -6,8 +6,9 @@ | |||
6 | extern int debugLevel; | 6 | 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 ) \ |
13 | { \ | 14 | { \ |
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 | |||
@@ -6,8 +6,9 @@ | |||
6 | #include <qpe/qpemenubar.h> | 6 | #include <qpe/qpemenubar.h> |
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> |
13 | #include <qtoolbutton.h> | 14 | #include <qtoolbutton.h> |
@@ -28,33 +29,42 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
28 | { | 29 | { |
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 ); |
45 | listViewPackages->setColumnWidthMode(0,QListView::Manual); | 51 | listViewPackages->setColumnWidthMode(0,QListView::Manual); |
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 ); |
60 | packageList.setSettings( settings ); | 70 | packageList.setSettings( settings ); |
@@ -73,11 +83,12 @@ void MainWindow::makeMenu() | |||
73 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 83 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
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 ); |
83 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 94 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
@@ -179,8 +190,16 @@ void MainWindow::makeMenu() | |||
179 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | 190 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); |
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() |
186 | { | 205 | { |
@@ -188,9 +207,14 @@ MainWindow::~MainWindow() | |||
188 | 207 | ||
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() |
196 | { | 220 | { |
@@ -199,9 +223,9 @@ void MainWindow::updateList() | |||
199 | t->start( 0, false ); | 223 | t->start( 0, false ); |
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() |
207 | { | 231 | { |
@@ -223,9 +247,9 @@ void MainWindow::displayList() | |||
223 | Package *pack = packageList.first(); | 247 | Package *pack = packageList.first(); |
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 | } |
231 | 255 | ||
@@ -290,22 +314,26 @@ void MainWindow::showSettingsDst() | |||
290 | 314 | ||
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 | ||
311 | void MainWindow::toggleActivePackage() | 339 | void MainWindow::toggleActivePackage() |
@@ -315,12 +343,13 @@ void MainWindow::toggleActivePackage() | |||
315 | } | 343 | } |
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) |
326 | { | 355 | { |
@@ -354,4 +383,36 @@ void MainWindow::rotateUpdateIcon() | |||
354 | else | 383 | else |
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 | |||
@@ -14,9 +14,9 @@ | |||
14 | class QComboBox; | 14 | 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 | { |
22 | Q_OBJECT | 22 | Q_OBJECT |
@@ -45,8 +45,11 @@ public slots: | |||
45 | void sectionShow(bool); | 45 | void sectionShow(bool); |
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(); |
52 | void setSections(); | 55 | void setSections(); |
@@ -56,21 +59,23 @@ private: | |||
56 | PackageManagerSettings *settings; | 59 | PackageManagerSettings *settings; |
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(); |
76 | }; | 81 | }; |
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 | |||
@@ -3,7 +3,7 @@ Priority: optional | |||
3 | Section: opie/settings | 3 | 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 | |||
@@ -8,37 +8,44 @@ | |||
8 | Package::~Package() | 8 | 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 = ""; |
17 | _shortDesc = ""; | 23 | _shortDesc = ""; |
18 | _desc = ""; | 24 | _desc = ""; |
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 | } |
44 | 51 | ||
@@ -171,9 +178,9 @@ void Package::copyValues( Package* pack ) | |||
171 | if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name ); | 178 | if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name ); |
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 | } |
179 | 186 | ||
@@ -189,9 +196,9 @@ void Package::setSection( QString s) | |||
189 | _subsection = ""; | 196 | _subsection = ""; |
190 | } | 197 | } |
191 | } | 198 | } |
192 | 199 | ||
193 | QString Package::getSubSection() | 200 | QString Package::subSection() |
194 | { | 201 | { |
195 | return _subsection; | 202 | return _subsection; |
196 | } | 203 | } |
197 | 204 | ||
@@ -252,12 +259,39 @@ QString Package::details() | |||
252 | } | 259 | } |
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 | |||
@@ -7,16 +7,18 @@ | |||
7 | #include <qpixmap.h> | 7 | #include <qpixmap.h> |
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 ); |
22 | void copyValues( Package* ); | 24 | void copyValues( Package* ); |
@@ -28,29 +30,37 @@ class Package //: public QObject | |||
28 | QString shortDesc(); | 30 | QString shortDesc(); |
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 | ||
56 | #endif | 66 | #endif |
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 | |||
@@ -69,10 +69,10 @@ void PackageList::filterPackages( QString f ) | |||
69 | Package *pack= filterIter.current() ; | 69 | Package *pack= filterIter.current() ; |
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 | { |
78 | packageList.insert( pack->name(), pack ); | 78 | packageList.insert( pack->name(), pack ); |
@@ -125,13 +125,13 @@ void PackageList::setSubSection( QString ssec ) | |||
125 | } | 125 | } |
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() ); |
137 | QStringList *subsecs = subSections[s]; | 137 | QStringList *subsecs = subSections[s]; |
@@ -149,12 +149,15 @@ void PackageList::updateSections( Package* pack ) | |||
149 | /** No descriptions */ | 149 | /** No descriptions */ |
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 | ||
160 | void PackageList::parseList() | 163 | void PackageList::parseList() |
@@ -162,14 +165,14 @@ void PackageList::parseList() | |||
162 | QStringList srvs = settings->getActiveServers(); | 165 | QStringList srvs = settings->getActiveServers(); |
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 ); |
175 | if ( !f.open(IO_ReadOnly) ) return; | 178 | if ( !f.open(IO_ReadOnly) ) return; |
@@ -181,9 +184,10 @@ void PackageList::readFileEntries( QString filename ) | |||
181 | { | 184 | { |
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 ); |
189 | packEntry.clear(); | 193 | packEntry.clear(); |
@@ -198,13 +202,13 @@ void PackageList::readFileEntries( QString filename ) | |||
198 | 202 | ||
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 ) |
210 | { | 214 | { |
@@ -220,4 +224,18 @@ void PackageList::clear() | |||
220 | { | 224 | { |
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 | |||
@@ -11,9 +11,11 @@ | |||
11 | static QString listsDir="/usr/lib/ipkg/"; | 11 | static QString listsDir="/usr/lib/ipkg/"; |
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 | ||
19 | PackageList(); | 21 | PackageList(); |
@@ -28,10 +30,10 @@ public: | |||
28 | QStringList getSubSections(); | 30 | QStringList getSubSections(); |
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); |
37 | void setSubSection(QString); | 39 | void setSubSection(QString); |
@@ -60,9 +62,9 @@ private: | |||
60 | 62 | ||
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 | ||
68 | #endif | 70 | #endif |
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,25 +1,52 @@ | |||
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, |
25 | int column, int width, int alignment ) | 52 | int column, int width, int alignment ) |
@@ -92,6 +119,21 @@ QString PackageListItem::key( int column, bool ascending ) const | |||
92 | void PackageListItem::setOn( bool b ) | 119 | 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 | |||
@@ -8,23 +8,29 @@ | |||
8 | #include <qpainter.h> | 8 | #include <qpainter.h> |
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; |
20 | QString key( int, bool ) const; | 22 | QString key( int, bool ) const; |
21 | Package* getPackage() { return package; } ; | 23 | Package* getPackage() { return package; } ; |
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 | ||
30 | 36 | ||
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 | |||
@@ -468,8 +468,9 @@ QStringList PackageManagerSettings::getActiveServers() | |||
468 | sl += activeServers->text(i); | 468 | sl += activeServers->text(i); |
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 | { |
475 | QStringList sl; | 476 | QStringList sl; |
@@ -479,8 +480,31 @@ QStringList PackageManagerSettings::getDestinationUrls() | |||
479 | } | 480 | } |
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; |
486 | activeLinkDestination->setEnabled( b ); | 510 | activeLinkDestination->setEnabled( b ); |
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 | |||
@@ -18,8 +18,11 @@ public: | |||
18 | QString getLinkDestinationName(); | 18 | QString getLinkDestinationName(); |
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; |
25 | int ipkg_old; | 28 | int ipkg_old; |
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 | |||
@@ -7,9 +7,8 @@ | |||
7 | #include <qpe/process.h> | 7 | #include <qpe/process.h> |
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> |
15 | #include <qstring.h> | 14 | #include <qstring.h> |
@@ -39,81 +38,85 @@ PmIpkg::~PmIpkg() | |||
39 | } | 38 | } |
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+"<"); |
78 | r = system(cmd.latin1()); | 76 | r = system(cmd.latin1()); |
79 | QFile f( redirect ); | 77 | QFile f( redirect ); |
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 |
96 | 97 | ||
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; |
119 | while ( !t.eof() ) | 122 | while ( !t.eof() ) |
@@ -125,10 +128,12 @@ void PmIpkg::makeLinks(QString pack) | |||
125 | } | 128 | } |
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 | { |
134 | QDir destDir( destFile ); | 139 | QDir destDir( destFile ); |
@@ -165,32 +170,23 @@ void PmIpkg::commit( PackageList pl ) | |||
165 | to_remove.clear(); | 170 | to_remove.clear(); |
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 | } |
196 | } | 192 | } |
@@ -210,13 +206,8 @@ void PmIpkg::commit( PackageList pl ) | |||
210 | connect( runwindow->cancelButton, SIGNAL( clicked() ), | 206 | connect( runwindow->cancelButton, SIGNAL( clicked() ), |
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 | ||
222 | void PmIpkg::doIt() | 213 | void PmIpkg::doIt() |
@@ -232,20 +223,8 @@ void PmIpkg::remove() | |||
232 | show( true ); | 223 | show( true ); |
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) |
251 | { | 230 | { |
@@ -255,47 +234,32 @@ void PmIpkg::remove() | |||
255 | }else{ | 234 | }else{ |
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 | ||
263 | void PmIpkg::install() | 241 | void PmIpkg::install() |
264 | { | 242 | { |
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 ); |
301 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 265 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
@@ -344,9 +308,9 @@ void PmIpkg::show(bool b) | |||
344 | { | 308 | { |
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 | |||
@@ -10,9 +10,8 @@ | |||
10 | #include "runwindow.h" | 10 | #include "runwindow.h" |
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 | { |
18 | Q_OBJECT | 17 | Q_OBJECT |
@@ -28,22 +27,15 @@ public: | |||
28 | 27 | ||
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: |
49 | void doIt(); | 41 | void doIt(); |
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 | |||
@@ -41,9 +41,9 @@ | |||
41 | <cstring>progress</cstring> | 41 | <cstring>progress</cstring> |
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" > |
49 | <class>QTextView</class> | 49 | <class>QTextView</class> |
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 | |||
@@ -19,10 +19,8 @@ public: | |||
19 | QString getLinkDestinationName(); | 19 | QString getLinkDestinationName(); |
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; |
28 | QIntDict<QString> destinationurlDic; | 26 | QIntDict<QString> destinationurlDic; |