summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/TODO3
-rw-r--r--noncore/unsupported/oipkg/debug.h1
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp115
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h9
-rw-r--r--noncore/unsupported/oipkg/opie-oipkg.control2
-rw-r--r--noncore/unsupported/oipkg/package.cpp54
-rw-r--r--noncore/unsupported/oipkg/package.h22
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp46
-rw-r--r--noncore/unsupported/oipkg/packagelist.h8
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.cpp44
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.h8
-rw-r--r--noncore/unsupported/oipkg/pksettings.cpp24
-rw-r--r--noncore/unsupported/oipkg/pksettings.h3
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp112
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h12
-rw-r--r--noncore/unsupported/oipkg/runwindow.ui2
-rw-r--r--noncore/unsupported/oipkg/settings.h2
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
@@ -4,12 +4,13 @@
4#include <stdio.h> 4#include <stdio.h>
5 5
6extern int debugLevel; 6extern 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) \
12if ( debugLevel < 3 ) \ 13if ( debugLevel < 3 ) \
13{ \ 14{ \
14 if ( I <= debugLevel ) qDebug(S);\ 15 if ( I <= debugLevel ) qDebug(S);\
15}else{\ 16}else{\
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
@@ -4,12 +4,13 @@
4#include "mainwindow.h" 4#include "mainwindow.h"
5 5
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>
14#include <qstring.h> 15#include <qstring.h>
15#include <qlabel.h> 16#include <qlabel.h>
@@ -26,37 +27,46 @@
26MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : 27MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
27 QMainWindow( parent, name, f ) 28 QMainWindow( parent, name, f )
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 );
61 getList(); 71 getList();
62 setSections(); 72 setSections();
@@ -71,15 +81,16 @@ void MainWindow::makeMenu()
71 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 81 QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
72 QPopupMenu *srvMenu = new QPopupMenu( menuBar ); 82 QPopupMenu *srvMenu = new QPopupMenu( menuBar );
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 );
84 menuBar->insertItem( tr( "View" ), viewMenu ); 95 menuBar->insertItem( tr( "View" ), viewMenu );
85 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 96 menuBar->insertItem( tr( "Settings" ), cfgMenu );
@@ -177,33 +188,46 @@ void MainWindow::makeMenu()
177 a->addTo( findBar ); 188 a->addTo( findBar );
178 findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); 189 findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 );
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
185MainWindow::~MainWindow() 204MainWindow::~MainWindow()
186{ 205{
187} 206}
188 207
189void MainWindow::runIpkg() 208void 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
195void MainWindow::updateList() 219void MainWindow::updateList()
196{ 220{
197 QTimer *t = new QTimer( this ); 221 QTimer *t = new QTimer( this );
198 connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); 222 connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) );
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
206void MainWindow::getList() 230void MainWindow::getList()
207{ 231{
208 packageList.update(); 232 packageList.update();
209 displayList(); 233 displayList();
@@ -221,13 +245,13 @@ void MainWindow::displayList()
221 filterList(); 245 filterList();
222 listViewPackages->clear(); 246 listViewPackages->clear();
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
232void MainWindow::sectionChanged() 256void MainWindow::sectionChanged()
233{ 257{
@@ -288,41 +312,46 @@ void MainWindow::showSettingsDst()
288 updateList(); 312 updateList();
289} 313}
290 314
291 315
292void MainWindow::showDetails() 316void 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
311void MainWindow::toggleActivePackage() 339void MainWindow::toggleActivePackage()
312{ 340{
313 activePackage->toggleProcess(); 341 activePackage->toggleProcess();
314 if ( details ) details->close(); 342 if ( details ) details->close();
315} 343}
316 344
317void MainWindow::setCurrent( QListViewItem* p ) 345void 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
325void MainWindow::sectionShow(bool b) 354void MainWindow::sectionShow(bool b)
326{ 355{
327 if (b) sectionBar->show(); 356 if (b) sectionBar->show();
328 else sectionBar->hide(); 357 else sectionBar->hide();
@@ -352,6 +381,38 @@ void MainWindow::rotateUpdateIcon()
352 if ( updateIcon ) 381 if ( updateIcon )
353 updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); 382 updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) );
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
388void 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
406void MainWindow::changePackageDest( int i )
407{
408 activePackage->setDest( destsMenu->text(i) );
409 activePackage->setOn();
410 activePackage->setLink( settings->createLinks() );
411 activePackageListItem->displayDetails();
412}
413
414void 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
@@ -12,13 +12,13 @@
12#include "pkdesc.h" 12#include "pkdesc.h"
13 13
14class QComboBox; 14class QComboBox;
15class QPEToolBar; 15class QPEToolBar;
16class QLineEdit; 16class QLineEdit;
17class QListView; 17class QListView;
18 18class PackageListItem;
19 19
20class MainWindow : public QMainWindow 20class MainWindow : public QMainWindow
21{ 21{
22 Q_OBJECT 22 Q_OBJECT
23 23
24 24
@@ -43,36 +43,41 @@ public slots:
43 void setCurrent( QListViewItem* ); 43 void setCurrent( QListViewItem* );
44 void sectionClose(); 44 void sectionClose();
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
50private: 53private:
51 void makeMenu(); 54 void makeMenu();
52 void setSections(); 55 void setSections();
53 void setSubSections(); 56 void setSubSections();
54 57
55 PmIpkg* ipkg; 58 PmIpkg* ipkg;
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;
74private slots: 79private slots:
75 void rotateUpdateIcon(); 80 void rotateUpdateIcon();
76}; 81};
77 82
78#endif 83#endif
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
@@ -1,9 +1,9 @@
1Files: bin/oipkg apps/Settings/oipkg.desktop pics/oipkg/ 1Files: bin/oipkg apps/Settings/oipkg.desktop pics/oipkg/
2Priority: optional 2Priority: optional
3Section: opie/settings 3Section: opie/settings
4Maintainer: Patrick S. Vogt <tille@almana.ch> 4Maintainer: Patrick S. Vogt <tille@almana.ch>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION 6Version: $QPE_VERSION-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION), ipkg (>0.9)
8Description: Package Manager 8Description: 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
@@ -6,41 +6,48 @@
6#include "debug.h" 6#include "debug.h"
7 7
8Package::~Package() 8Package::~Package()
9{ 9{
10} 10}
11 11
12Package::Package() 12Package::Package( PackageManagerSettings *s )
13{ 13{
14 init(s);
15}
16
17void 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
24Package::Package( QStringList pack ) 31Package::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
31Package::Package( QString n ) 38Package::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
38Package::Package( Package *pi ) 45Package::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
45 52
46void Package::setValue( QString n, QString t ) 53void Package::setValue( QString n, QString t )
@@ -169,13 +176,13 @@ void Package::copyValues( Package* pack )
169 if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc ); 176 if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc );
170 if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc ); 177 if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc );
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
175QString Package::getSection() 182QString Package::section()
176{ 183{
177 return _section; 184 return _section;
178} 185}
179 186
180void Package::setSection( QString s) 187void Package::setSection( QString s)
181{ 188{
@@ -187,13 +194,13 @@ void Package::setSection( QString s)
187 }else{ 194 }else{
188 _section = s; 195 _section = s;
189 _subsection = ""; 196 _subsection = "";
190 } 197 }
191} 198}
192 199
193QString Package::getSubSection() 200QString Package::subSection()
194{ 201{
195 return _subsection; 202 return _subsection;
196} 203}
197 204
198void Package::parsePackage( QStringList pack ) 205void Package::parsePackage( QStringList pack )
199{ 206{
@@ -250,14 +257,41 @@ QString Package::details()
250 } 257 }
251 } 258 }
252 } 259 }
253 return description; 260 return description;
254} 261}
255 262
256/** No descriptions */
257void Package::processed() 263void 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
271QString Package::dest()
272{
273 if ( installed()||(!installed() && _toProcess) )
274 return _dest!=""?_dest:settings->getDestinationName();
275 else return "";
276}
277
278void Package::setDest( QString d )
279{
280 _dest = d;
281}
282
283void Package::setOn()
284{
285 _toProcess = true;
286}
287
288bool Package::link()
289{
290 if ( _dest == "root" || (!installed() && !_toProcess) ) return false;
291 return _link;
292}
293
294void 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
@@ -5,20 +5,22 @@
5#include <qlistview.h> 5#include <qlistview.h>
6#include <qpainter.h> 6#include <qpainter.h>
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
11class Package //: public QObject 13class 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* );
23 25
24 QString name() ; 26 QString name() ;
@@ -26,31 +28,39 @@ class Package //: public QObject
26 28
27 void setDesc( QString ); 29 void setDesc( QString );
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);
40public slots: 46public slots:
41 void toggleProcess(); 47 void toggleProcess();
42 48
43private: 49private:
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
@@ -67,14 +67,14 @@ void PackageList::filterPackages( QString f )
67 QDictIterator<Package> filterIter( origPackageList ); 67 QDictIterator<Package> filterIter( origPackageList );
68 filterIter.toFirst(); 68 filterIter.toFirst();
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 );
79 } 79 }
80 ++filterIter; 80 ++filterIter;
@@ -123,17 +123,17 @@ void PackageList::setSubSection( QString ssec )
123{ 123{
124 aktSubSection = ssec; 124 aktSubSection = ssec;
125} 125}
126 126
127void PackageList::updateSections( Package* pack ) 127void 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];
138 *subsecs += "All"; 138 *subsecs += "All";
139 } 139 }
@@ -147,31 +147,34 @@ void PackageList::updateSections( Package* pack )
147 147
148 148
149/** No descriptions */ 149/** No descriptions */
150void PackageList::parseStatus() 150void 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
160void PackageList::parseList() 163void PackageList::parseList()
161{ 164{
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
171void PackageList::readFileEntries( QString filename ) 174void 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;
176 QTextStream *statusStream = new QTextStream( &f ); 179 QTextStream *statusStream = new QTextStream( &f );
177 while ( !statusStream ->eof() ) 180 while ( !statusStream ->eof() )
@@ -179,13 +182,14 @@ void PackageList::readFileEntries( QString filename )
179 QString line = statusStream->readLine(); 182 QString line = statusStream->readLine();
180 if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) 183 if ( line.find(QRegExp("[\n\t ]*")) || line == "" )
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();
190 } 194 }
191 } 195 }
@@ -196,17 +200,17 @@ void PackageList::readFileEntries( QString filename )
196 return; 200 return;
197} 201}
198 202
199 203
200void PackageList::update() 204void 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
209void PackageList::setSettings( PackageManagerSettings *s ) 213void PackageList::setSettings( PackageManagerSettings *s )
210{ 214{
211 settings = s; 215 settings = s;
212} 216}
@@ -218,6 +222,20 @@ Package* PackageList::getByName( QString n )
218 222
219void PackageList::clear() 223void PackageList::clear()
220{ 224{
221 origPackageList.clear(); 225 origPackageList.clear();
222 packageList.clear(); 226 packageList.clear();
223} 227}
228
229void 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
@@ -9,13 +9,15 @@
9#define HACK 9#define HACK
10#ifdef HACK 10#ifdef HACK
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
15class PackageList { 15class PackageList //:QObject
16{
17 // Q_OBJECT
16public: 18public:
17 //static QString all = QObject::tr("All"); 19 //static QString all = QObject::tr("All");
18 20
19 PackageList(); 21 PackageList();
20 PackageList( PackageManagerSettings* ); 22 PackageList( PackageManagerSettings* );
21 ~PackageList(); 23 ~PackageList();
@@ -26,14 +28,14 @@ public:
26 28
27 QStringList getSections(); 29 QStringList getSections();
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
35public slots: 37public slots:
36 void setSection(QString); 38 void setSection(QString);
37 void setSubSection(QString); 39 void setSubSection(QString);
38 void update(); 40 void update();
39 41
@@ -58,11 +60,11 @@ private:
58 QDict<bool> sectionsDict; 60 QDict<bool> sectionsDict;
59 61
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,27 +1,54 @@
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
5static QPixmap *pm_uninstalled=0; 8static QPixmap *pm_uninstalled=0;
6static QPixmap *pm_installed=0; 9static QPixmap *pm_installed=0;
7static QPixmap *pm_uninstall=0; 10static QPixmap *pm_uninstall=0;
8static QPixmap *pm_install=0; 11static QPixmap *pm_install=0;
9 12
10PackageListItem::PackageListItem(QListView* lv, Package *pi) 13PackageListItem::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
24void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, 51void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg,
25 int column, int width, int alignment ) 52 int column, int width, int alignment )
26{ 53{
27 if ( !p ) 54 if ( !p )
@@ -90,8 +117,23 @@ QString PackageListItem::key( int column, bool ascending ) const
90} 117}
91 118
92void PackageListItem::setOn( bool b ) 119void 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
134void 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
@@ -6,26 +6,32 @@
6#include <qstring.h> 6#include <qstring.h>
7#include <qlistview.h> 7#include <qlistview.h>
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
12class PackageListItem 14class PackageListItem
13: public QCheckListItem 15: public QCheckListItem
14{ 16{
15public: 17public:
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
26private: 29private:
30 QCheckListItem *destItem;
31 QCheckListItem *linkItem;
32 PackageManagerSettings *settings;
27 Package *package; 33 Package *package;
28}; 34};
29 35
30 36
31#endif 37#endif
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
@@ -466,22 +466,46 @@ QStringList PackageManagerSettings::getActiveServers()
466 { 466 {
467 if ( activeServers->isSelected(i) ) 467 if ( activeServers->isSelected(i) )
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 */
473QStringList PackageManagerSettings::getDestinationUrls() 474QStringList PackageManagerSettings::getDestinationUrls()
474{ 475{
475 QStringList sl; 476 QStringList sl;
476 for (int i=0; i<(int)destinations->count(); i++) 477 for (int i=0; i<(int)destinations->count(); i++)
477 { 478 {
478 sl += *destinationurlDic[i]; 479 sl += *destinationurlDic[i];
479 } 480 }
480 return sl; 481 return sl;
481} 482}
482 483
484/** returns the destination listed in ipkg.conf */
485QString 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 */
496QStringList 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
483void PackageManagerSettings::linkEnabled( bool b ) 507void PackageManagerSettings::linkEnabled( bool b )
484{ 508{
485 changed = true; 509 changed = true;
486 activeLinkDestination->setEnabled( b ); 510 activeLinkDestination->setEnabled( b );
487} 511}
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
@@ -16,12 +16,15 @@ public:
16 QString getDestinationUrl(); 16 QString getDestinationUrl();
17 QString getDestinationName(); 17 QString getDestinationName();
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
22private: 25private:
23 QIntDict<QString> serverurlDic; 26 QIntDict<QString> serverurlDic;
24 QIntDict<QString> destinationurlDic; 27 QIntDict<QString> destinationurlDic;
25 int ipkg_old; 28 int ipkg_old;
26 int editedserver; 29 int editedserver;
27 int editeddestination; 30 int editeddestination;
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
@@ -5,13 +5,12 @@
5#include "packagelistitem.h" 5#include "packagelistitem.h"
6 6
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>
16#include <qtextstream.h> 15#include <qtextstream.h>
17#include <qtextview.h> 16#include <qtextview.h>
@@ -37,85 +36,89 @@ PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlag
37PmIpkg::~PmIpkg() 36PmIpkg::~PmIpkg()
38{ 37{
39} 38}
40 39
41//#define PROC 40//#define PROC
42#define SYSTEM 41#define SYSTEM
43int PmIpkg::runIpkg(const QString& args) 42int 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
100void PmIpkg::makeLinks(QString pack) 101void 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() )
120 { 123 {
121 fp = t.readLine(); 124 fp = t.readLine();
@@ -123,14 +126,16 @@ void PmIpkg::makeLinks(QString pack)
123 } 126 }
124 f.close(); 127 f.close();
125} 128}
126 129
127void PmIpkg::processLinkDir( QString file, QString dest ) 130void 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 );
135 destDir.mkdir( destFile, true ); 140 destDir.mkdir( destFile, true );
136 QDir d( file ); 141 QDir d( file );
@@ -163,36 +168,27 @@ void PmIpkg::commit( PackageList pl )
163 168
164 to_install.clear(); 169 to_install.clear();
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 }
197 193
198 out("<p>"+inst+"</p>"+"<p>"+rem+"</p><hl>"); 194 out("<p>"+inst+"</p>"+"<p>"+rem+"</p><hl>");
@@ -208,17 +204,12 @@ void PmIpkg::commit( PackageList pl )
208 connect( runwindow->removeButton, SIGNAL( clicked() ), 204 connect( runwindow->removeButton, SIGNAL( clicked() ),
209 this, SLOT( remove() ) ); 205 this, SLOT( remove() ) );
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
222void PmIpkg::doIt() 213void PmIpkg::doIt()
223{ 214{
224 remove(); 215 remove();
@@ -230,74 +221,47 @@ void PmIpkg::remove()
230{ 221{
231 if ( to_remove.count() == 0 ) return; 222 if ( to_remove.count() == 0 ) return;
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 {
252 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); 231 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
253 it->processed(); 232 it->processed();
254 runwindow->progress->setProgress( 1 ); 233 runwindow->progress->setProgress( 1 );
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
263void PmIpkg::install() 241void 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
296void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) 261void 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 );
302//// if (! d.exists() ) return; 266//// if (! d.exists() ) return;
303// const QFileInfoList *list = d.entryInfoList(); 267// const QFileInfoList *list = d.entryInfoList();
@@ -342,11 +306,11 @@ void PmIpkg::showButtons(bool b)
342 306
343void PmIpkg::show(bool b) 307void 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
@@ -8,13 +8,12 @@
8#include <qwidget.h> 8#include <qwidget.h>
9#include "pksettings.h" 9#include "pksettings.h"
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
15class Package; 14class Package;
16class PmIpkg : public QObject 15class PmIpkg : public QObject
17{ 16{
18 Q_OBJECT 17 Q_OBJECT
19public: 18public:
20 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); 19 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 );
@@ -26,26 +25,19 @@ public:
26 void showButtons(bool b=true); 25 void showButtons(bool b=true);
27 void show( bool buttons=true ); 26 void show( bool buttons=true );
28 27
29private: 28private:
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
48public slots: 40public slots:
49 void doIt(); 41 void doIt();
50 void install(); 42 void install();
51 void remove(); 43 void remove();
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
@@ -39,13 +39,13 @@
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
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>
50 <property stdset="1"> 50 <property stdset="1">
51 <name>name</name> 51 <name>name</name>
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
@@ -17,14 +17,12 @@ public:
17 QString getDestinationUrl(); 17 QString getDestinationUrl();
18 QString getDestinationName(); 18 QString getDestinationName();
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
26private: 24private:
27 QIntDict<QString> serverurlDic; 25 QIntDict<QString> serverurlDic;
28 QIntDict<QString> destinationurlDic; 26 QIntDict<QString> destinationurlDic;
29 int ipkg_old; 27 int ipkg_old;
30 int editedserver; 28 int editedserver;