summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/main.cpp3
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp5
-rw-r--r--noncore/unsupported/oipkg/package.cpp65
-rw-r--r--noncore/unsupported/oipkg/package.h7
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp17
-rw-r--r--noncore/unsupported/oipkg/packagelistview.cpp1
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp10
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h1
8 files changed, 62 insertions, 47 deletions
diff --git a/noncore/unsupported/oipkg/main.cpp b/noncore/unsupported/oipkg/main.cpp
index 4af59b0..5cef2dc 100644
--- a/noncore/unsupported/oipkg/main.cpp
+++ b/noncore/unsupported/oipkg/main.cpp
@@ -1,19 +1,22 @@
1 1
2#include "mainwindow.h" 2#include "mainwindow.h"
3 3
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qstring.h> 5#include <qstring.h>
6#include <qmessagebox.h>
6int debugLevel; 7int debugLevel;
7 8
8int main( int argc, char ** argv ) 9int main( int argc, char ** argv )
9{ 10{
11
10 debugLevel = 2; 12 debugLevel = 2;
11 if (argc > 0) 13 if (argc > 0)
12 { 14 {
13 debugLevel = QString ( argv[1] ).toInt(); 15 debugLevel = QString ( argv[1] ).toInt();
14 } 16 }
15 QPEApplication a( argc, argv ); 17 QPEApplication a( argc, argv );
16 MainWindow mw; 18 MainWindow mw;
19 QMessageBox::information( &mw, "oipkg","While ipkg is working\noipkg is hanging.\nPlease be patient!");
17 a.showMainDocumentWidget( &mw ); 20 a.showMainDocumentWidget( &mw );
18 return a.exec(); 21 return a.exec();
19} 22}
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 06828e0..4865c39 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -54,26 +54,24 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
54 if (section->text(i)=="opie") 54 if (section->text(i)=="opie")
55 section->setCurrentItem(i); 55 section->setCurrentItem(i);
56 sectionChanged(); 56 sectionChanged();
57 57
58 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); 58 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
59 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); 59 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
60 60
61 connect( settings->removeLinksButton, SIGNAL( clicked()), 61 connect( settings->removeLinksButton, SIGNAL( clicked()),
62 SLOT(removeLinks()) ); 62 SLOT(removeLinks()) );
63 connect( settings->createLinksButton, SIGNAL( clicked()), 63 connect( settings->createLinksButton, SIGNAL( clicked()),
64 SLOT(createLinks()) ); 64 SLOT(createLinks()) );
65 65
66 //rootLocal = new QCheckListItem(listViewPackages,tr("local"));
67 //rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind"));
68 displayList(); 66 displayList();
69} 67}
70 68
71void MainWindow::makeMenu() 69void MainWindow::makeMenu()
72{ 70{
73 71
74 QPEToolBar *toolBar = new QPEToolBar( this ); 72 QPEToolBar *toolBar = new QPEToolBar( this );
75 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 73 QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
76 QPopupMenu *srvMenu = new QPopupMenu( menuBar ); 74 QPopupMenu *srvMenu = new QPopupMenu( menuBar );
77 QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 75 QPopupMenu *viewMenu = new QPopupMenu( menuBar );
78 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 76 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
79 // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); 77 // QPopupMenu *sectMenu = new QPopupMenu( menuBar );
@@ -277,26 +275,29 @@ void MainWindow::filterList()
277 packageList.filterPackages( f ); 275 packageList.filterPackages( f );
278 //wait->hide(); 276 //wait->hide();
279} 277}
280 278
281void MainWindow::displayList() 279void MainWindow::displayList()
282{ 280{
283 //wait->hide(); 281 //wait->hide();
284 filterList(); 282 filterList();
285 listViewPackages->clear(); 283 listViewPackages->clear();
286 Package *pack = packageList.first(); 284 Package *pack = packageList.first();
287 PackageListItem *item; 285 PackageListItem *item;
288 286
287// if (!rootLocal)
288// {
289 QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local")); 289 QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local"));
290 QCheckListItem *rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind")); 290 QCheckListItem *rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind"));
291// }
291 while( pack ) 292 while( pack )
292 { 293 {
293 item = new PackageListItem( rootLocal, pack, settings ); 294 item = new PackageListItem( rootLocal, pack, settings );
294 pack = packageList.next(); 295 pack = packageList.next();
295 } 296 }
296 pack = packageListSearch.first(); 297 pack = packageListSearch.first();
297 while( pack ) 298 while( pack )
298 { 299 {
299 item = new PackageListItem( rootSearch, pack, settings ); 300 item = new PackageListItem( rootSearch, pack, settings );
300 pack = packageListSearch.next(); 301 pack = packageListSearch.next();
301 } 302 }
302} 303}
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 6bb53a9..0787ece 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -60,73 +60,73 @@ Package::Package( Package *pi )
60 copyValues( pi ); 60 copyValues( pi );
61} 61}
62 62
63 63
64void Package::setValue( QString n, QString t ) 64void Package::setValue( QString n, QString t )
65{ 65{
66 if ( n == "Package" ) 66 if ( n == "Package" )
67 { 67 {
68 _name = QString( t ); 68 _name = QString( t );
69 }else if ( n == "Installed-Size" ) 69 }else if ( n == "Installed-Size" )
70 { 70 {
71 _size = t; 71 _size = t;
72 }else if ( n == "Priority") 72// }else if ( n == "Priority")
73 { 73// {
74 74
75 }else if ( n == "Section") 75 }else if ( n == "Section")
76 { 76 {
77 setSection( t ); 77 setSection( t );
78 }else if ( n == "Maintainer") 78// }else if ( n == "Maintainer")
79 { 79// {
80 80//
81 }else if ( n == "Architecture") 81// }else if ( n == "Architecture")
82 { 82// {
83 83
84 }else if ( n == "Version") 84 }else if ( n == "Version")
85 { 85 {
86 86 _version = t;
87 }else if ( n == "Pre-Depends") 87// }else if ( n == "Pre-Depends")
88 { 88// {
89 89//
90 }else if ( n == "Depends") 90// }else if ( n == "Depends")
91 { 91// {
92 92
93 }else if ( n == "Filename") 93 }else if ( n == "Filename")
94 { 94 {
95 _fileName = t; 95 _fileName = t;
96 }else if ( n == "Size") 96// }else if ( n == "Size")
97 { 97 // {
98 98 //
99 }else if ( n == "MD5Sum") 99 //}else if ( n == "MD5Sum")
100 { 100 //{
101 101
102 } 102 }else if ( n == "Description")
103 if ( n == "Description")
104 { 103 {
105 setDesc( t ); 104 setDesc( t );
106 } 105 }else if ( n == "Status")
107 if ( n == "Status")
108 { 106 {
109 if ( installed() ) return; 107 if ( installed() ) return;
110 _status = t; 108 _status = t;
111 } 109// }else if ( n == "Essential")
112 if ( t == "Essential") 110// {
113 {
114 111
112 }else{
113 _values.insert(n,new QString(t));
115 } 114 }
116}; 115}
117 116
118QString Package::name() 117QString Package::name()
119{ 118{
120 return _name; 119 if (_displayName.isEmpty() ) return _name;
120 else return _displayName;
121} 121}
122 122
123 123
124QString Package::installName() 124QString Package::installName()
125{ 125{
126 if (_useFileName) return _fileName; 126 if (_useFileName) return _fileName;
127 else return _name; 127 else return _name;
128} 128}
129 129
130bool Package::installed() 130bool Package::installed()
131{ 131{
132 return _status.contains("installed"); 132 return _status.contains("installed");
@@ -144,24 +144,30 @@ QString Package::desc()
144} 144}
145 145
146QString Package::shortDesc() 146QString Package::shortDesc()
147{ 147{
148 return _shortDesc; 148 return _shortDesc;
149} 149}
150 150
151QString Package::size() 151QString Package::size()
152{ 152{
153 return _size; 153 return _size;
154} 154}
155 155
156
157QString Package::version()
158{
159 return _version;
160}
161
156QString Package::sizeUnits() 162QString Package::sizeUnits()
157{ 163{
158 int i = _size.toInt(); 164 int i = _size.toInt();
159 int c = 0; 165 int c = 0;
160 QString ret; 166 QString ret;
161 QStringList unit; 167 QStringList unit;
162 unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;) 168 unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;)
163 while (i > 1) 169 while (i > 1)
164 { 170 {
165 ret=QString::number(i)+" "+unit[c]; 171 ret=QString::number(i)+" "+unit[c];
166 c++; 172 c++;
167 i /= 1024; 173 i /= 1024;
@@ -341,12 +347,17 @@ void Package::parseIpkgFile( QString file)
341} 347}
342 348
343//QString Package::getPackageName() 349//QString Package::getPackageName()
344//{ 350//{
345 //if ( _packageName.isEmpty() ) return _name; 351 //if ( _packageName.isEmpty() ) return _name;
346 //else return _packageName; 352 //else return _packageName;
347//} 353//}
348 354
349void Package::instalFromFile(bool iff) 355void Package::instalFromFile(bool iff)
350{ 356{
351 _useFileName = iff; 357 _useFileName = iff;
352} 358}
359
360void Package::setName(QString n)
361{
362 _displayName = n;
363}
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h
index 4618c3a..2ca966d 100644
--- a/noncore/unsupported/oipkg/package.h
+++ b/noncore/unsupported/oipkg/package.h
@@ -23,52 +23,55 @@ class Package //: public QObject
23 void setValue( QString, QString ); 23 void setValue( QString, QString );
24 void copyValues( Package* ); 24 void copyValues( Package* );
25 25
26 QString name() ; 26 QString name() ;
27 QString installName() ; 27 QString installName() ;
28 bool installed(); 28 bool installed();
29 29
30 void setDesc( QString ); 30 void setDesc( QString );
31 QString shortDesc(); 31 QString shortDesc();
32 QString desc(); 32 QString desc();
33 QString size(); 33 QString size();
34 QString sizeUnits(); 34 QString sizeUnits();
35 QString version();
35 void setSection( QString ); 36 void setSection( QString );
36 QString section(); 37 QString section();
37 QString subSection(); 38 QString subSection();
38 QString details(); 39 QString details();
39 bool toProcess(); 40 bool toProcess();
40 bool toInstall(); 41 bool toInstall();
41 bool toRemove(); 42 bool toRemove();
42 void processed(); 43 void processed();
43 QString dest(); 44 QString dest();
44 void setDest( QString d ); 45 void setDest( QString d );
45 void setOn(); 46 void setOn();
46 bool link(); 47 bool link();
47 void setLink(bool); 48 void setLink(bool);
48 void parseIpkgFile( QString ); 49 void parseIpkgFile( QString );
49 void instalFromFile(bool iff=true); 50 void instalFromFile(bool iff=true);
51 void setName(QString);
50public slots: 52public slots:
51// QString getPackageName();
52 void toggleProcess(); 53 void toggleProcess();
53 54
54private: 55private:
55 PackageManagerSettings *settings; 56 PackageManagerSettings *settings;
56// QString _packageName; 57 QString _displayName;
57 QString _name; 58 QString _name;
58 QString _fileName; 59 QString _fileName;
59 bool _toProcess; 60 bool _toProcess;
60 bool _link; 61 bool _link;
61 QString _status; 62 QString _status;
62 QString _size; 63 QString _size;
63 QString _section; 64 QString _section;
64 QString _subsection; 65 QString _subsection;
65 QString _shortDesc; 66 QString _shortDesc;
66 QString _desc; 67 QString _desc;
68 QString _version;
67 QString _dest; 69 QString _dest;
70 QDict<QString> _values;
68 bool _useFileName; 71 bool _useFileName;
69 void parsePackage( QStringList ); 72 void parsePackage( QStringList );
70 void init(PackageManagerSettings *); 73 void init(PackageManagerSettings *);
71}; 74};
72 75
73 76
74#endif 77#endif
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index b892b30..be20c71 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -24,35 +24,44 @@ PackageList::PackageList( PackageManagerSettings* s)
24{ 24{
25 settings = s; 25 settings = s;
26 PackageList(); 26 PackageList();
27} 27}
28 28
29PackageList::~PackageList() 29PackageList::~PackageList()
30{ 30{
31} 31}
32 32
33/** Inserts a package into the list */ 33/** Inserts a package into the list */
34void PackageList::insertPackage( Package* pack ) 34void PackageList::insertPackage( Package* pack )
35{ 35{
36 if (!pack) return;
36 Package* p = packageList.find( pack->name() ); 37 Package* p = packageList.find( pack->name() );
37 if ( p ) 38 if ( p )
38 { 39 {
39 p->copyValues( pack ); 40 if ( p->version() == pack->version() )
40 delete pack; 41 {
41 pack = p; 42 p->copyValues( pack );
43 delete pack;
44 pack = p;
45 } else {
46 p->setName( pack->name()+"["+p->version()+"]" );
47 pack->setName( pack->name()+"["+pack->version()+"]" );
48 packageList.insert( pack->name(), pack );
49 origPackageList.insert( pack->name(), pack );
50 }
42 }else{ 51 }else{
43 packageList.insert( pack->name(), pack ); 52 packageList.insert( pack->name(), pack );
44 origPackageList.insert( pack->name(), pack ); 53 origPackageList.insert( pack->name(), pack );
45 empty=false;
46 }; 54 };
55 empty=false;
47 updateSections( pack ); 56 updateSections( pack );
48} 57}
49 58
50void PackageList::filterPackages( QString f ) 59void PackageList::filterPackages( QString f )
51 { 60 {
52 packageList.clear(); 61 packageList.clear();
53 QDictIterator<Package> filterIter( origPackageList ); 62 QDictIterator<Package> filterIter( origPackageList );
54 filterIter.toFirst(); 63 filterIter.toFirst();
55 Package *pack= filterIter.current() ; 64 Package *pack= filterIter.current() ;
56 while ( pack ) 65 while ( pack )
57 { 66 {
58 if ( 67 if (
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp
index 610a0e1..36d081b 100644
--- a/noncore/unsupported/oipkg/packagelistview.cpp
+++ b/noncore/unsupported/oipkg/packagelistview.cpp
@@ -55,25 +55,24 @@ void PackageListView::showPopup()
55 { 55 {
56 popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); 56 popupAction = new QAction( dests[i], QString::null, 0, this, 0 );
57 popupAction->addTo( destsMenu ); 57 popupAction->addTo( destsMenu );
58 if ( dests[i] == ad && activePackage->toInstall() ) 58 if ( dests[i] == ad && activePackage->toInstall() )
59 { 59 {
60 popupAction->setToggleAction( true ); 60 popupAction->setToggleAction( true );
61 popupAction->setOn(true); 61 popupAction->setOn(true);
62 }; 62 };
63 } 63 }
64 connect( destsMenu, SIGNAL( activated( int ) ), 64 connect( destsMenu, SIGNAL( activated( int ) ),
65 this, SLOT( changePackageDest( int ) ) ); 65 this, SLOT( changePackageDest( int ) ) );
66 }else{ 66 }else{
67 // popupActcat setOn( activePackage->toProcess() );
68 } 67 }
69 popupMenu->popup( QCursor::pos() ); 68 popupMenu->popup( QCursor::pos() );
70} 69}
71 70
72void PackageListView::stopTimer( QListViewItem* ) 71void PackageListView::stopTimer( QListViewItem* )
73{ 72{
74 popupTimer->stop(); 73 popupTimer->stop();
75} 74}
76 75
77 76
78void PackageListView::changePackageDest( int i ) 77void PackageListView::changePackageDest( int i )
79{ 78{
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index fe200f5..1798c80 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -277,33 +277,24 @@ void PmIpkg::startDialog()
277 _force_depends->setAutoResize( TRUE ); 277 _force_depends->setAutoResize( TRUE );
278 _force_depends->setChecked(true); 278 _force_depends->setChecked(true);
279 GroupBox1Layout->addWidget( _force_depends, 0, 0 ); 279 GroupBox1Layout->addWidget( _force_depends, 0, 0 );
280 _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" ); 280 _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" );
281 _force_reinstall->setText( tr( "-force-reinstall" ) ); 281 _force_reinstall->setText( tr( "-force-reinstall" ) );
282 _force_reinstall->setAutoResize( TRUE ); 282 _force_reinstall->setAutoResize( TRUE );
283 GroupBox1Layout->addWidget( _force_reinstall, 1, 0 ); 283 GroupBox1Layout->addWidget( _force_reinstall, 1, 0 );
284 _force_remove = new QCheckBox( GroupBox1, "_force_remove" ); 284 _force_remove = new QCheckBox( GroupBox1, "_force_remove" );
285 _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); 285 _force_remove->setText( tr( "-force-removal-of-essential-packages" ) );
286 _force_remove->setAutoResize( TRUE ); 286 _force_remove->setAutoResize( TRUE );
287 GroupBox1Layout->addWidget( _force_remove, 1, 0 ); 287 GroupBox1Layout->addWidget( _force_remove, 1, 0 );
288 RunWindowLayout->addWidget( GroupBox1 , 3, 0 ); 288 RunWindowLayout->addWidget( GroupBox1 , 3, 0 );
289
290// connect( doItButton, SIGNAL( clicked() ),
291 // this, SLOT( doIt() ) );
292// connect( installButton, SIGNAL( clicked() ),
293 // this, SLOT( install() ) );
294// connect( removeButton, SIGNAL( clicked() ),
295 // this, SLOT( remove() ) );
296// connect( cancelButton, SIGNAL( clicked() ),
297 // installDialog, SLOT( close() ) );
298 installDialog->showMaximized(); 289 installDialog->showMaximized();
299 if ( installDialog->exec() ) doIt(); 290 if ( installDialog->exec() ) doIt();
300 installDialog->close(); 291 installDialog->close();
301 out(tr("<b>All done.</b>")); 292 out(tr("<b>All done.</b>"));
302} 293}
303 294
304void PmIpkg::doIt() 295void PmIpkg::doIt()
305{ 296{
306 show( true ); 297 show( true );
307 remove(); 298 remove();
308 install(); 299 install();
309} 300}
@@ -326,25 +317,24 @@ void PmIpkg::remove()
326 if ( it->link() ) 317 if ( it->link() )
327 { 318 {
328 out( "<br>removing links<br>" ); 319 out( "<br>removing links<br>" );
329 out( "for package "+it->name()+" in "+it->dest()+"<br>" ); 320 out( "for package "+it->name()+" in "+it->dest()+"<br>" );
330 processFileList( fileList, it->dest() ); 321 processFileList( fileList, it->dest() );
331 } 322 }
332 it->processed(); 323 it->processed();
333 324
334 out("<br><hr>"); 325 out("<br><hr>");
335 }else{ 326 }else{
336 out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); 327 out("<b>"+tr("Error while removing")+"</b><hr>"+it->name());
337 } 328 }
338 pvDebug(2,"delete File List");
339 if ( it->link() )delete fileList; 329 if ( it->link() )delete fileList;
340 } 330 }
341 out("<br>"); 331 out("<br>");
342} 332}
343 333
344 334
345void PmIpkg::install() 335void PmIpkg::install()
346{ 336{
347 if ( to_install.count() == 0 ) return; 337 if ( to_install.count() == 0 ) return;
348 out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); 338 out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
349 for (Package *it=to_install.first(); it != 0; it=to_install.next() ) 339 for (Package *it=to_install.first(); it != 0; it=to_install.next() )
350 { 340 {
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h
index 2b89023..fa00048 100644
--- a/noncore/unsupported/oipkg/pmipkg.h
+++ b/noncore/unsupported/oipkg/pmipkg.h
@@ -17,25 +17,24 @@
17class Package; 17class Package;
18class PmIpkg : public QObject 18class PmIpkg : public QObject
19{ 19{
20 Q_OBJECT 20 Q_OBJECT
21public: 21public:
22 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); 22 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 );
23 ~PmIpkg(); 23 ~PmIpkg();
24 24
25 int linkOpp; 25 int linkOpp;
26 void loadList( PackageList ); 26 void loadList( PackageList );
27 void commit( PackageList ); 27 void commit( PackageList );
28 void update(); 28 void update();
29 // PackageList* getPackageList();
30 void showButtons(bool b=true); 29 void showButtons(bool b=true);
31 void show( bool buttons=true ); 30 void show( bool buttons=true );
32 31
33public slots: 32public slots:
34 void doIt(); 33 void doIt();
35 void install(); 34 void install();
36 void remove(); 35 void remove();
37 void installFile(const QString &fileName, const QString &dest=""); 36 void installFile(const QString &fileName, const QString &dest="");
38 void removeFile(const QString &fileName, const QString &dest=""); 37 void removeFile(const QString &fileName, const QString &dest="");
39 void createLinks( const QString &dest ); 38 void createLinks( const QString &dest );
40 void removeLinks( const QString &dest ); 39 void removeLinks( const QString &dest );
41 40