summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/TODO5
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp3
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp6
-rw-r--r--noncore/unsupported/oipkg/packagelistdoclnk.cpp3
-rw-r--r--noncore/unsupported/oipkg/packagelistremote.cpp1
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp31
6 files changed, 28 insertions, 21 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO
index 6de54ec..b92cbb0 100644
--- a/noncore/unsupported/oipkg/TODO
+++ b/noncore/unsupported/oipkg/TODO
@@ -1,15 +1,12 @@
1* Settings Class 1* Settings Class
2* tr() ;)
3* Dialog to display ipkg output live
4* parse "to install" and "to remove" from status 2* parse "to install" and "to remove" from status
5* install local file dialog 3* install local file dialog
6* qcop 4* qcop
7* error handling 5* error handling
8* manage links 6* manage links
9* dependency checking 7* dependency checking
10* create dest if it does not exist 8* create dest if it does not exist
11* allow reinstalling 9* allow reinstalling
12* different types of filters and searches 10* different types of filters and searches
13 i.e. name, desc, files etc 11 i.e. name, desc, files etc
14* mark packages from doclnk and ipkgfind installed if installed 12* display new list after update \ No newline at end of file
15* show if different version is installed \ No newline at end of file
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 2fa91e3..19a1420 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -31,129 +31,130 @@
31#include "packagelistitem.h" 31#include "packagelistitem.h"
32 32
33 33
34MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : 34MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
35 QMainWindow( parent, name, f ) 35 QMainWindow( parent, name, f )
36 { 36 {
37 setCaption( tr("Package Manager") ); 37 setCaption( tr("Package Manager") );
38 settings = new PackageManagerSettings(this,0,TRUE); 38 settings = new PackageManagerSettings(this,0,TRUE);
39 listViewPackages = new PackageListView( this,"listViewPackages",settings ); 39 listViewPackages = new PackageListView( this,"listViewPackages",settings );
40 setCentralWidget( listViewPackages ); 40 setCentralWidget( listViewPackages );
41 listViewPackages->addList( tr("feeds"), &packageListServers ); 41 listViewPackages->addList( tr("feeds"), &packageListServers );
42 listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); 42 listViewPackages->addList( tr("ipkgfind"), &packageListSearch );
43 listViewPackages->addList( tr("documents"), &packageListDocLnk ); 43 listViewPackages->addList( tr("documents"), &packageListDocLnk );
44 //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); 44 //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton);
45 //wait = new QMessageBox(this); 45 //wait = new QMessageBox(this);
46 // wait->setText(tr("Please wait")); 46 // wait->setText(tr("Please wait"));
47 ipkg = new PmIpkg( settings, this ); 47 ipkg = new PmIpkg( settings, this );
48// settings->setIpkg( ipkg ); 48// settings->setIpkg( ipkg );
49 packageListServers.setSettings( settings ); 49 packageListServers.setSettings( settings );
50 packageListSearch.setSettings( settings ); 50 packageListSearch.setSettings( settings );
51 packageListDocLnk.setSettings( settings ); 51 packageListDocLnk.setSettings( settings );
52 pvDebug(9,"packageListServers.update"); 52 pvDebug(9,"packageListServers.update");
53 packageListServers.update(); 53 packageListServers.update();
54 pvDebug(9,"packageListDocLnk.update"); 54 pvDebug(9,"packageListDocLnk.update");
55 packageListDocLnk.update(); 55 packageListDocLnk.update();
56 pvDebug(9,"makeMenu"); 56 pvDebug(9,"makeMenu");
57 makeMenu(); 57 makeMenu();
58 makeChannel(); 58 makeChannel();
59 //opie is hardcoded default ;) 59 //opie is hardcoded default ;)
60 pvDebug(9,"section->setCurrentItem"); 60 pvDebug(9,"section->setCurrentItem");
61 for (int i=0;i<section->count();i++) 61 for (int i=0;i<section->count();i++)
62 if (section->text(i)=="opie") 62 if (section->text(i)=="opie")
63 section->setCurrentItem(i); 63 section->setCurrentItem(i);
64 sectionChanged(); 64 sectionChanged();
65 65
66 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); 66 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
67 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); 67 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
68 68
69 connect( settings->removeLinksButton, SIGNAL( clicked()), 69 connect( settings->removeLinksButton, SIGNAL( clicked()),
70 SLOT(removeLinks()) ); 70 SLOT(removeLinks()) );
71 connect( settings->createLinksButton, SIGNAL( clicked()), 71 connect( settings->createLinksButton, SIGNAL( clicked()),
72 SLOT(createLinks()) ); 72 SLOT(createLinks()) );
73 73
74 pvDebug(9,"displayList"); 74 pvDebug(9,"displayList");
75 displayList(); 75 displayList();
76} 76}
77 77
78void MainWindow::makeMenu() 78void MainWindow::makeMenu()
79{ 79{
80 80
81 QPEToolBar *toolBar = new QPEToolBar( this ); 81 QPEToolBar *toolBar = new QPEToolBar( this );
82 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 82 QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
83 QPopupMenu *srvMenu = new QPopupMenu( menuBar ); 83 QPopupMenu *srvMenu = new QPopupMenu( menuBar );
84 QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 84 QPopupMenu *viewMenu = new QPopupMenu( menuBar );
85 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 85 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
86 // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); 86 // QPopupMenu *sectMenu = new QPopupMenu( menuBar );
87 87
88 setToolBarsMovable( false ); 88 setToolBarsMovable( false );
89 toolBar->setHorizontalStretchable( true ); 89 toolBar->setHorizontalStretchable( true );
90 menuBar->insertItem( tr( "Package" ), srvMenu ); 90 menuBar->insertItem( tr( "Package" ), srvMenu );
91 menuBar->insertItem( tr( "View" ), viewMenu ); 91 menuBar->insertItem( tr( "View" ), viewMenu );
92 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 92 menuBar->insertItem( tr( "Settings" ), cfgMenu );
93 // menuBar->insertItem( tr( "Sections" ), sectMenu ); 93 // menuBar->insertItem( tr( "Sections" ), sectMenu );
94 94
95 QLabel *spacer = new QLabel( "", toolBar ); 95 QLabel *spacer;
96// spacer = new QLabel( "", toolBar );
96// spacer->setBackgroundColor( toolBar->backgroundColor() ); 97// spacer->setBackgroundColor( toolBar->backgroundColor() );
97// toolBar->setStretchableWidget( spacer ); 98// toolBar->setStretchableWidget( spacer );
98 99
99 100
100 runAction = new QAction( tr( "Apply" ), 101 runAction = new QAction( tr( "Apply" ),
101 Resource::loadPixmap( "oipkg/install" ), 102 Resource::loadPixmap( "oipkg/install" ),
102 QString::null, 0, this, 0 ); 103 QString::null, 0, this, 0 );
103 connect( runAction, SIGNAL( activated() ), 104 connect( runAction, SIGNAL( activated() ),
104 this, SLOT( runIpkg() ) ); 105 this, SLOT( runIpkg() ) );
105 runAction->addTo( toolBar ); 106 runAction->addTo( toolBar );
106 runAction->addTo( srvMenu ); 107 runAction->addTo( srvMenu );
107 108
108 srvMenu->insertSeparator (); 109 srvMenu->insertSeparator ();
109 110
110 updateAction = new QAction( tr( "Update" ), 111 updateAction = new QAction( tr( "Update" ),
111 Resource::loadIconSet( "oipkg/update" ), 112 Resource::loadIconSet( "oipkg/update" ),
112 QString::null, 0, this, 0 ); 113 QString::null, 0, this, 0 );
113 connect( updateAction, SIGNAL( activated() ), 114 connect( updateAction, SIGNAL( activated() ),
114 this , SLOT( updateList() ) ); 115 this , SLOT( updateList() ) );
115 updateAction->addTo( toolBar ); 116 updateAction->addTo( toolBar );
116 updateAction->addTo( srvMenu ); 117 updateAction->addTo( srvMenu );
117 118
118 QAction *cfgact; 119 QAction *cfgact;
119 120
120 cfgact = new QAction( tr( "Setups" ), 121 cfgact = new QAction( tr( "Setups" ),
121 QString::null, 0, this, 0 ); 122 QString::null, 0, this, 0 );
122 connect( cfgact, SIGNAL( activated() ), 123 connect( cfgact, SIGNAL( activated() ),
123 SLOT( showSettings() ) ); 124 SLOT( showSettings() ) );
124 cfgact->addTo( cfgMenu ); 125 cfgact->addTo( cfgMenu );
125 126
126 cfgact = new QAction( tr( "Servers" ), 127 cfgact = new QAction( tr( "Servers" ),
127 QString::null, 0, this, 0 ); 128 QString::null, 0, this, 0 );
128 connect( cfgact, SIGNAL( activated() ), 129 connect( cfgact, SIGNAL( activated() ),
129 SLOT( showSettingsSrv() ) ); 130 SLOT( showSettingsSrv() ) );
130 cfgact->addTo( cfgMenu ); 131 cfgact->addTo( cfgMenu );
131 cfgact = new QAction( tr( "Destinations" ), 132 cfgact = new QAction( tr( "Destinations" ),
132 QString::null, 0, this, 0 ); 133 QString::null, 0, this, 0 );
133 connect( cfgact, SIGNAL( activated() ), 134 connect( cfgact, SIGNAL( activated() ),
134 SLOT( showSettingsDst() ) ); 135 SLOT( showSettingsDst() ) );
135 cfgact->addTo( cfgMenu ); 136 cfgact->addTo( cfgMenu );
136 137
137 QAction *a; 138 QAction *a;
138 139
139 // SECTIONS 140 // SECTIONS
140 sectionBar = new QPEToolBar( this ); 141 sectionBar = new QPEToolBar( this );
141 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); 142 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE );
142 sectionBar->setHorizontalStretchable( true ); 143 sectionBar->setHorizontalStretchable( true );
143 QLabel *label = new QLabel( tr("Section: "), sectionBar ); 144 QLabel *label = new QLabel( tr("Section: "), sectionBar );
144 label->setBackgroundColor( sectionBar->backgroundColor() ); 145 label->setBackgroundColor( sectionBar->backgroundColor() );
145 sectionBar->setStretchableWidget( label ); 146 sectionBar->setStretchableWidget( label );
146 section = new QComboBox( false, sectionBar ); 147 section = new QComboBox( false, sectionBar );
147 label = new QLabel( " / ", sectionBar ); 148 label = new QLabel( " / ", sectionBar );
148 label->setBackgroundColor( sectionBar->backgroundColor() ); 149 label->setBackgroundColor( sectionBar->backgroundColor() );
149 subsection = new QComboBox( false, sectionBar ); 150 subsection = new QComboBox( false, sectionBar );
150 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 151 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
151 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); 152 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
152 a->addTo( sectionBar ); 153 a->addTo( sectionBar );
153 setSections(); 154 setSections();
154 setSubSections(); 155 setSubSections();
155 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); 156 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
156 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); 157 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
157 sectionAction->setToggleAction( true ); 158 sectionAction->setToggleAction( true );
158 sectionAction->addTo( viewMenu ); 159 sectionAction->addTo( viewMenu );
159 160
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index 2fc4c41..fdd1163 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -1,118 +1,121 @@
1#include "packagelist.h" 1#include "packagelist.h"
2 2
3#include <assert.h> 3#include <assert.h>
4#include <qfile.h> 4#include <qfile.h>
5#include <qfileinfo.h> 5#include <qfileinfo.h>
6#include <qtextstream.h> 6#include <qtextstream.h>
7 7
8#include "debug.h" 8#include "debug.h"
9 9
10static QDict<Package> *packageListAll; 10static QDict<Package> *packageListAll;
11static int packageListAllRefCount = 0;
11 12
12PackageList::PackageList() 13PackageList::PackageList()
13 : packageIter( packageList ) 14 : packageIter( packageList )
14{ 15{
15 empty=true; 16 empty=true;
16 if (!packageListAll) packageListAll = new QDict<Package>(); 17 if (!packageListAll) packageListAll = new QDict<Package>();
18 packageListAllRefCount++;
17 sections << "All"; 19 sections << "All";
18 subSections.insert("All", new QStringList() ); 20 subSections.insert("All", new QStringList() );
19 QStringList *ss = subSections["All"]; 21 QStringList *ss = subSections["All"];
20 *ss << "All"; 22 *ss << "All";
21 aktSection = "All"; 23 aktSection = "All";
22 aktSubSection = "All"; 24 aktSubSection = "All";
23} 25}
24 26
25PackageList::PackageList( PackageManagerSettings* s) 27PackageList::PackageList( PackageManagerSettings* s)
26 : packageIter( packageList ) 28 : packageIter( packageList )
27{ 29{
28 settings = s; 30 settings = s;
29 PackageList(); 31 PackageList();
30} 32}
31 33
32PackageList::~PackageList() 34PackageList::~PackageList()
33{ 35{
36 if (--packageListAllRefCount < 1 ) delete packageListAll;
34} 37}
35 38
36/** Inserts a package into the list */ 39/** Inserts a package into the list */
37void PackageList::insertPackage( Package* pack ) 40void PackageList::insertPackage( Package* pack )
38{ 41{
39 if (!pack) return; 42 if (!pack) return;
40 Package* p = packageListAll->find( pack->name() ); 43 Package* p = packageListAll->find( pack->name() );
41 if ( p ) 44 if ( p )
42 { 45 {
43 if ( (p->version() == pack->version()) 46 if ( (p->version() == pack->version())
44 && (p->dest() == pack->dest()) ) 47 && (p->dest() == pack->dest()) )
45 { 48 {
46 p->copyValues( pack ); 49 p->copyValues( pack );
47 delete pack; 50 delete pack;
48 pack = p; 51 pack = p;
49 } else { 52 } else {
50 QDict<Package> *packver = p->getOtherVersions(); 53 QDict<Package> *packver = p->getOtherVersions();
51 // p->setName( pack->name()+"["+p->version()+"]" ); 54 // p->setName( pack->name()+"["+p->version()+"]" );
52 if (!packver) 55 if (!packver)
53 { 56 {
54 packver = new QDict<Package>; 57 packver = new QDict<Package>();
55 packver->insert( pack->name(), p ); 58 packver->insert( pack->name(), p );
56 p->setOtherVersions( packver ); 59 p->setOtherVersions( packver );
57 } 60 }
58 pack->setName( pack->name()+"["+pack->version()+"]" ); 61 pack->setName( pack->name()+"["+pack->version()+"]" );
59 pack->setOtherVersions( packver ); 62 pack->setOtherVersions( packver );
60 packver->insert( pack->name(), pack ); 63 packver->insert( pack->name(), pack );
61 packageListAll->insert( pack->name(), pack ); 64 packageListAll->insert( pack->name(), pack );
62 packageList.insert( pack->name(), pack ); 65 packageList.insert( pack->name(), pack );
63 origPackageList.insert( pack->name(), pack ); 66 origPackageList.insert( pack->name(), pack );
64 } 67 }
65 }else{ 68 }else{
66 packageListAll->insert( pack->name(), pack ); 69 packageListAll->insert( pack->name(), pack );
67 packageList.insert( pack->name(), pack ); 70 packageList.insert( pack->name(), pack );
68 origPackageList.insert( pack->name(), pack ); 71 origPackageList.insert( pack->name(), pack );
69 }; 72 };
70 empty=false; 73 empty=false;
71 updateSections( pack ); 74 updateSections( pack );
72} 75}
73 76
74void PackageList::filterPackages( QString f ) 77void PackageList::filterPackages( QString f )
75 { 78 {
76 packageList.clear(); 79 packageList.clear();
77 QDictIterator<Package> filterIter( origPackageList ); 80 QDictIterator<Package> filterIter( origPackageList );
78 filterIter.toFirst(); 81 filterIter.toFirst();
79 Package *pack= filterIter.current() ; 82 Package *pack= filterIter.current() ;
80 while ( pack ) 83 while ( pack )
81 { 84 {
82 if ( 85 if (
83 ((aktSection=="All")||(pack->section()==aktSection)) && 86 ((aktSection=="All")||(pack->section()==aktSection)) &&
84 ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) && 87 ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) &&
85 pack->name().contains( f ) 88 pack->name().contains( f )
86 ) 89 )
87 { 90 {
88 packageList.insert( pack->name(), pack ); 91 packageList.insert( pack->name(), pack );
89 } 92 }
90 ++filterIter; 93 ++filterIter;
91 pack = filterIter.current(); 94 pack = filterIter.current();
92 } 95 }
93} 96}
94 97
95Package* PackageList::find( QString n ) 98Package* PackageList::find( QString n )
96{ 99{
97 return packageList.find( n ); 100 return packageList.find( n );
98} 101}
99 102
100Package* PackageList::first() 103Package* PackageList::first()
101 { 104 {
102 packageIter.toFirst(); 105 packageIter.toFirst();
103 return packageIter.current(); 106 return packageIter.current();
104} 107}
105 108
106Package* PackageList::next() 109Package* PackageList::next()
107{ 110{
108 ++packageIter; 111 ++packageIter;
109 return packageIter.current(); 112 return packageIter.current();
110} 113}
111 114
112QStringList PackageList::getSections() 115QStringList PackageList::getSections()
113{ 116{
114 sections.sort(); 117 sections.sort();
115 return sections; 118 return sections;
116} 119}
117 120
118QStringList PackageList::getSubSections() 121QStringList PackageList::getSubSections()
@@ -121,96 +124,97 @@ QStringList PackageList::getSubSections()
121 if ( !subSections[aktSection] ) return ss; 124 if ( !subSections[aktSection] ) return ss;
122 ss = *subSections[aktSection]; 125 ss = *subSections[aktSection];
123 ss.sort(); 126 ss.sort();
124 return ss; 127 return ss;
125} 128}
126 129
127void PackageList::setSection( QString sec ) 130void PackageList::setSection( QString sec )
128{ 131{
129 aktSection = sec; 132 aktSection = sec;
130} 133}
131 134
132void PackageList::setSubSection( QString ssec ) 135void PackageList::setSubSection( QString ssec )
133{ 136{
134 aktSubSection = ssec; 137 aktSubSection = ssec;
135} 138}
136 139
137void PackageList::updateSections( Package* pack ) 140void PackageList::updateSections( Package* pack )
138{ 141{
139 QString s = pack->section(); 142 QString s = pack->section();
140 if ( s.isEmpty() || s == "") return; 143 if ( s.isEmpty() || s == "") return;
141 if ( sections.contains(s) ) return; 144 if ( sections.contains(s) ) return;
142 sections += s; 145 sections += s;
143 QString ss = pack->subSection(); 146 QString ss = pack->subSection();
144 if ( ss.isEmpty() || ss == "" ) return; 147 if ( ss.isEmpty() || ss == "" ) return;
145 if ( !subSections[s] ) { 148 if ( !subSections[s] ) {
146 subSections.insert( s, new QStringList() ); 149 subSections.insert( s, new QStringList() );
147 QStringList *subsecs = subSections[s]; 150 QStringList *subsecs = subSections[s];
148 *subsecs += "All"; 151 *subsecs += "All";
149 } 152 }
150 QStringList *subsecs = subSections[s]; 153 QStringList *subsecs = subSections[s];
151 *subsecs += ss; 154 *subsecs += ss;
152 if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); 155 if ( !subSections["All"] ) subSections.insert( "All", new QStringList() );
153 subsecs = subSections["All"]; 156 subsecs = subSections["All"];
154 *subsecs += ss; 157 *subsecs += ss;
155} 158}
156 159
157 160
158void PackageList::readFileEntries( QString filename, QString dest ) 161void PackageList::readFileEntries( QString filename, QString dest )
159 { 162 {
160 pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); 163 pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest);
161 QStringList packEntry; 164 QStringList packEntry;
162 QFile f( filename ); 165 QFile f( filename );
163 if ( !f.open(IO_ReadOnly) ) return; 166 if ( !f.open(IO_ReadOnly) ) return;
164 QTextStream *statusStream = new QTextStream( &f ); 167 QTextStream *statusStream = new QTextStream( &f );
165 while ( !statusStream ->eof() ) 168 while ( !statusStream ->eof() )
166 { 169 {
167 QString line = statusStream->readLine(); 170 QString line = statusStream->readLine();
168 if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) 171 if ( line.find(QRegExp("[\n\t ]*")) || line == "" )
169 { 172 {
170 //end of package 173 //end of package
171 if ( ! packEntry.isEmpty() ) 174 if ( ! packEntry.isEmpty() )
172 { 175 {
173 Package *p = new Package( packEntry, settings ); 176 Package *p = new Package( packEntry, settings );
174 p->setDest( dest ); 177 p->setDest( dest );
175 if ( p ) 178 if ( p )
176 { 179 {
177 insertPackage( p ); 180 insertPackage( p );
178 packEntry.clear(); 181 packEntry.clear();
179 } 182 }
180 } 183 }
181 }else{ 184 }else{
182 packEntry << line; 185 packEntry << line;
183 }; 186 };
184 } 187 }
188 delete statusStream;
185 return; 189 return;
186} 190}
187 191
188void PackageList::setSettings( PackageManagerSettings *s ) 192void PackageList::setSettings( PackageManagerSettings *s )
189{ 193{
190 settings = s; 194 settings = s;
191} 195}
192 196
193Package* PackageList::getByName( QString n ) 197Package* PackageList::getByName( QString n )
194{ 198{
195 origPackageList[n]; 199 origPackageList[n];
196} 200}
197 201
198void PackageList::clear() 202void PackageList::clear()
199{ 203{
200 origPackageList.clear(); 204 origPackageList.clear();
201 packageList.clear(); 205 packageList.clear();
202} 206}
203 207
204void PackageList::allPackages() 208void PackageList::allPackages()
205{ 209{
206 packageList.clear(); 210 packageList.clear();
207 QDictIterator<Package> filterIter( origPackageList ); 211 QDictIterator<Package> filterIter( origPackageList );
208 filterIter.toFirst(); 212 filterIter.toFirst();
209 Package *pack= filterIter.current() ; 213 Package *pack= filterIter.current() ;
210 while ( pack ) 214 while ( pack )
211 { 215 {
212 packageList.insert( pack->name(), pack ); 216 packageList.insert( pack->name(), pack );
213 ++filterIter; 217 ++filterIter;
214 pack = filterIter.current(); 218 pack = filterIter.current();
215 } 219 }
216} 220}
diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.cpp b/noncore/unsupported/oipkg/packagelistdoclnk.cpp
index 1d10adf..f31f742 100644
--- a/noncore/unsupported/oipkg/packagelistdoclnk.cpp
+++ b/noncore/unsupported/oipkg/packagelistdoclnk.cpp
@@ -1,44 +1,45 @@
1 1
2#include "packagelistdoclnk.h" 2#include "packagelistdoclnk.h"
3 3
4#include <qpe/applnk.h> 4#include <qpe/applnk.h>
5#include <qpe/config.h> 5#include <qpe/config.h>
6#include <qlist.h> 6#include <qlist.h>
7 7
8#include "package.h" 8#include "package.h"
9#include "pksettings.h" 9#include "pksettings.h"
10 10
11PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s) 11PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s)
12 : PackageList(s) 12 : PackageList(s)
13{ 13{
14 PackageListDocLnk(); 14 PackageListDocLnk();
15} 15}
16 16
17PackageListDocLnk::PackageListDocLnk() 17PackageListDocLnk::PackageListDocLnk()
18 : PackageList() 18 : PackageList()
19{ 19{
20 Config cfg( "oipkg", Config::User ); 20 Config cfg( "oipkg", Config::User );
21 cfg.setGroup( "Common" ); 21 cfg.setGroup( "Common" );
22 docLnkDir = cfg.readEntry( "docLnkDir", "/root/" ); 22 docLnkDir = cfg.readEntry( "docLnkDir", "/root/" );
23 pvDebug(2,"opening DocLnkSet "+docLnkDir); 23 pvDebug(2,"opening DocLnkSet "+docLnkDir);
24 doclnkset = new DocLnkSet(docLnkDir,"application/ipkg"); 24 doclnkset = new DocLnkSet(docLnkDir,"application/ipkg");
25} 25}
26 26
27PackageListDocLnk::~PackageListDocLnk() 27PackageListDocLnk::~PackageListDocLnk()
28{ 28{
29 Config cfg( "oipkg", Config::User ); 29 Config cfg( "oipkg", Config::User );
30 cfg.setGroup( "Common" ); 30 cfg.setGroup( "Common" );
31 cfg.writeEntry( "docLnkDir", docLnkDir ); 31 cfg.writeEntry( "docLnkDir", docLnkDir );
32 delete doclnkset;
32} 33}
33 34
34 35
35 36
36void PackageListDocLnk::update() 37void PackageListDocLnk::update()
37{ 38{
38 pvDebug(2,"PackageListDocLnk::update "); 39 pvDebug(2,"PackageListDocLnk::update ");
39 QList<DocLnk> packlist = doclnkset->children(); 40 QList<DocLnk> packlist = doclnkset->children();
40 for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() ) 41 for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() )
41 { 42 {
42 insertPackage( new Package(pack->file(), settings) ); 43 insertPackage( new Package(pack->file(), settings ) );
43 } 44 }
44} 45}
diff --git a/noncore/unsupported/oipkg/packagelistremote.cpp b/noncore/unsupported/oipkg/packagelistremote.cpp
index ee54fca..e37f256 100644
--- a/noncore/unsupported/oipkg/packagelistremote.cpp
+++ b/noncore/unsupported/oipkg/packagelistremote.cpp
@@ -1,48 +1,49 @@
1 1
2#include "packagelistremote.h" 2#include "packagelistremote.h"
3 3
4#include <qstring.h> 4#include <qstring.h>
5#include <stdlib.h> 5#include <stdlib.h>
6#include <unistd.h> 6#include <unistd.h>
7 7
8PackageListRemote::PackageListRemote(PackageManagerSettings* s) 8PackageListRemote::PackageListRemote(PackageManagerSettings* s)
9 : PackageList(s) 9 : PackageList(s)
10{ 10{
11 PackageListRemote(); 11 PackageListRemote();
12} 12}
13 13
14PackageListRemote::PackageListRemote() 14PackageListRemote::PackageListRemote()
15 : PackageList() 15 : PackageList()
16{ 16{
17} 17}
18 18
19PackageListRemote::~PackageListRemote() 19PackageListRemote::~PackageListRemote()
20{ 20{
21} 21}
22 22
23void PackageListRemote::query(QString s) 23void PackageListRemote::query(QString s)
24{ 24{
25 pvDebug(4,"set query "+s); 25 pvDebug(4,"set query "+s);
26 searchString = s; 26 searchString = s;
27} 27}
28 28
29void PackageListRemote::update() 29void PackageListRemote::update()
30{ 30{
31 pvDebug(2,"PackageListRemote::update"); 31 pvDebug(2,"PackageListRemote::update");
32 if (searchString.isEmpty()) return;
32 int r=0; 33 int r=0;
33 QString cmd = "wget"; 34 QString cmd = "wget";
34 QString redirect = "/tmp/oipkg.query"; 35 QString redirect = "/tmp/oipkg.query";
35 36
36 // use file for output 37 // use file for output
37 cmd += " --output-document="+redirect; 38 cmd += " --output-document="+redirect;
38//http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package&section= 39//http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package&section=
39 QString server="http://ipkgfind.handhelds.org/"; 40 QString server="http://ipkgfind.handhelds.org/";
40 cmd += " \""+server+"/packages.phtml"; 41 cmd += " \""+server+"/packages.phtml";
41 cmd += "?format=pda&searchtype=package&section="; 42 cmd += "?format=pda&searchtype=package&section=";
42 cmd += "&query="+searchString; 43 cmd += "&query="+searchString;
43 cmd += "\""; 44 cmd += "\"";
44 45
45 pvDebug(4,"search :"+cmd); 46 pvDebug(4,"search :"+cmd);
46 r = system(cmd.latin1()); 47 r = system(cmd.latin1());
47 readFileEntries( redirect ); 48 readFileEntries( redirect );
48} 49}
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index f2852c3..6ef6d19 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -1,371 +1,374 @@
1#include "pmipkg.h" 1#include "pmipkg.h"
2#include "pksettings.h" 2#include "pksettings.h"
3#include "package.h" 3#include "package.h"
4#include "packagelistitem.h" 4#include "packagelistitem.h"
5 5
6#include <qpe/process.h> 6#include <qpe/process.h>
7#include <qpe/resource.h> 7#include <qpe/resource.h>
8#include <qpe/config.h> 8#include <qpe/config.h>
9#include <qpe/stringutil.h> 9#include <qpe/stringutil.h>
10#include <qpe/qpeapplication.h> 10#include <qpe/qpeapplication.h>
11#include <qdir.h> 11#include <qdir.h>
12#include <qfile.h> 12#include <qfile.h>
13#include <qgroupbox.h> 13#include <qgroupbox.h>
14#include <qmultilineedit.h> 14#include <qmultilineedit.h>
15#include <qstring.h> 15#include <qstring.h>
16#include <qcheckbox.h> 16#include <qcheckbox.h>
17#include <qtextstream.h> 17#include <qtextstream.h>
18#include <qtextview.h> 18#include <qtextview.h>
19 19
20#include <qprogressbar.h> 20#include <qprogressbar.h>
21#include <qpushbutton.h> 21#include <qpushbutton.h>
22#include <qlayout.h> 22#include <qlayout.h>
23 23
24#include <stdlib.h> 24#include <stdlib.h>
25#include <unistd.h> 25#include <unistd.h>
26 26
27#include "mainwindow.h" 27#include "mainwindow.h"
28 28
29 29
30PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) 30PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
31 : QObject ( p ) 31 : QObject ( p )
32{ 32{
33 settings = s; 33 settings = s;
34 runwindow = new RunWindow( p, name, true, f ); 34 runwindow = new RunWindow( p, name, true, f );
35} 35}
36 36
37PmIpkg::~PmIpkg() 37PmIpkg::~PmIpkg()
38{ 38{
39} 39}
40 40
41bool PmIpkg::runIpkg(const QString& args, const QString& dest ) 41bool PmIpkg::runIpkg(const QString& args, const QString& dest )
42{ 42{
43 bool ret=false; 43 bool ret=false;
44 QDir::setCurrent("/tmp"); 44 QDir::setCurrent("/tmp");
45 QString cmd = "/usr/bin/ipkg "; 45 QString cmd = "/usr/bin/ipkg ";
46 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); 46 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
47 if ( dest == "" ) 47 if ( dest == "" )
48 cmd += " -dest "+settings->getDestinationName(); 48 cmd += " -dest "+settings->getDestinationName();
49 else 49 else
50 cmd += " -dest "+ dest; 50 cmd += " -dest "+ dest;
51 51
52 cmd += " -force-defaults "; 52 cmd += " -force-defaults ";
53 53
54 if (installDialog->_force_depends) 54 if (installDialog && installDialog->_force_depends)
55 { 55 {
56 if (installDialog->_force_depends->isChecked()) 56 if (installDialog->_force_depends->isChecked())
57 cmd += " -force-depends "; 57 cmd += " -force-depends ";
58 if (installDialog->_force_reinstall->isChecked()) 58 if (installDialog->_force_reinstall->isChecked())
59 cmd += " -force-reinstall "; 59 cmd += " -force-reinstall ";
60 if (installDialog->_force_remove->isChecked()) 60 if (installDialog->_force_remove->isChecked())
61 cmd += " -force-removal-of-essential-packages "; 61 cmd += " -force-removal-of-essential-packages ";
62 } 62 }
63 63
64 out( "Starting to "+ args+"\n"); 64 out( "Starting to "+ args+"\n");
65 cmd += args; 65 cmd += args;
66 out( "running:\n"+cmd+"\n" ); 66 out( "running:\n"+cmd+"\n" );
67 pvDebug(2,"running:"+cmd); 67 pvDebug(2,"running:"+cmd);
68 qApp->processEvents(); 68 qApp->processEvents();
69 FILE *fp; 69 FILE *fp;
70 char line[130]; 70 char line[130];
71 QString lineStr, lineStrOld; 71 QString lineStr, lineStrOld;
72 sleep(1); 72 sleep(1);
73 cmd +=" 2>&1"; 73 cmd +=" 2>&1";
74 fp = popen( (const char *) cmd, "r"); 74 fp = popen( (const char *) cmd, "r");
75 if ( !fp ) { 75 if ( !fp ) {
76 qDebug("Could not execute '" + cmd + "'! err=%d", fp); 76 qDebug("Could not execute '" + cmd + "'! err=%d", fp);
77 pclose(fp); 77 pclose(fp);
78 out("\nError while executing "+ cmd+"\n\n"); 78 out("\nError while executing "+ cmd+"\n\n");
79 return false; 79 return false;
80 } else { 80 } else {
81 while ( fgets( line, sizeof line, fp)) { 81 while ( fgets( line, sizeof line, fp)) {
82 lineStr = line; 82 lineStr = line;
83 lineStr=lineStr.left(lineStr.length()-1); 83 lineStr=lineStr.left(lineStr.length()-1);
84 //Configuring opie-oipkg...Done 84 //Configuring opie-oipkg...Done
85 if (lineStr.contains("Done")) 85 if (lineStr.contains("Done"))
86 ret = true; 86 ret = true;
87 if (lineStr!=lineStrOld) 87 if (lineStr!=lineStrOld)
88 out(lineStr); 88 out(lineStr);
89 lineStrOld = lineStr; 89 lineStrOld = lineStr;
90 qApp->processEvents();
90 } 91 }
91 pclose(fp); 92 pclose(fp);
92 } 93 }
93 //out( "Finished!"); 94 //out( "Finished!");
94 pvDebug(2,QString(ret?"success\n":"failure\n")); 95 pvDebug(2,QString(ret?"success\n":"failure\n"));
95 return ret; 96 return ret;
96} 97}
97 98
98void PmIpkg::makeLinks(Package *pack) 99void PmIpkg::makeLinks(Package *pack)
99{ 100{
100 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); 101 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
101 linkPackage( pack->name(), pack->dest() ); 102 linkPackage( pack->name(), pack->dest() );
102} 103}
103 104
104QStringList* PmIpkg::getList( QString packFileName, QString d ) 105QStringList* PmIpkg::getList( QString packFileName, QString d )
105{ 106{
106 QString dest = settings->getDestinationUrlByName( d ); 107 QString dest = settings->getDestinationUrlByName( d );
107 dest = dest==""?d:dest; 108 dest = dest==""?d:dest;
108 if (dest == "/" ) return 0; 109 if (dest == "/" ) return 0;
109 { 110 {
110 Config cfg( "oipkg", Config::User ); 111 Config cfg( "oipkg", Config::User );
111 cfg.setGroup( "Common" ); 112 cfg.setGroup( "Common" );
112 QString statusDir = cfg.readEntry( "statusDir", "" ); 113 QString statusDir = cfg.readEntry( "statusDir", "" );
113 } 114 }
114 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; 115 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list";
115 QFile f( packFileName ); 116 QFile f( packFileName );
116 if ( ! f.open(IO_ReadOnly) ) 117 if ( ! f.open(IO_ReadOnly) )
117 { 118 {
118 pvDebug(1," Panik! Could not open"); 119 pvDebug(1," Panik! Could not open");
119 out( "Panik!\n Could not open:\n"+packFileName ); 120 out( "Panik!\n Could not open:\n"+packFileName );
120 return (QStringList*)0; 121 return (QStringList*)0;
121 } 122 }
122 QStringList *fileList = new QStringList(); 123 QStringList *fileList = new QStringList();
123 QTextStream t( &f ); 124 QTextStream t( &f );
124 while ( !t.eof() ) 125 while ( !t.eof() )
125 { 126 {
126 *fileList += t.readLine(); 127 *fileList += t.readLine();
127 } 128 }
128 return fileList; 129 return fileList;
129} 130}
130 131
131void PmIpkg::linkPackage( QString packFileName, QString dest ) 132void PmIpkg::linkPackage( QString packFileName, QString dest )
132{ 133{
133 QStringList *fileList = getList( packFileName, dest ); 134 QStringList *fileList = getList( packFileName, dest );
134 processFileList( fileList, dest ); 135 processFileList( fileList, dest );
135 delete fileList; 136 delete fileList;
136} 137}
137 138
138void PmIpkg::processFileList( QStringList *fileList, QString d ) 139void PmIpkg::processFileList( QStringList *fileList, QString d )
139{ 140{
140 if (!fileList) return; 141 if (!fileList) return;
141 for (uint i=0; i < fileList->count(); i++) 142 for (uint i=0; i < fileList->count(); i++)
142 { 143 {
143 QString dest = settings->getDestinationUrlByName( d ); 144 QString dest = settings->getDestinationUrlByName( d );
144 dest = dest==""?d:dest; 145 dest = dest==""?d:dest;
145 processLinkDir( (*fileList)[i], dest ); 146 processLinkDir( (*fileList)[i], dest );
146 } 147 }
147} 148}
148 149
149 150
150void PmIpkg::processLinkDir( QString file, QString dest ) 151void PmIpkg::processLinkDir( QString file, QString dest )
151{ 152{
152 pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); 153 pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest);
153 if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); 154 if (linkOpp==createLink) pvDebug( 4,"opp: createLink");
154 if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); 155 if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink");
155 if ( dest == "???" || dest == "" ) return; 156 if ( dest == "???" || dest == "" ) return;
156 QString destFile = file; 157 QString destFile = file;
157 file = dest+"/"+file; 158 file = dest+"/"+file;
158 if (file == dest) return; 159 if (file == dest) return;
160// if (linkOpp==createLink) out( "\ncreating links\n" );
161 // if (linkOpp==removeLink) out( "\nremoving links\n" );
159 QFileInfo fileInfo( file ); 162 QFileInfo fileInfo( file );
160 if ( fileInfo.isDir() ) 163 if ( fileInfo.isDir() )
161 { 164 {
162 pvDebug(4, "process dir "+file); 165 pvDebug(4, "process dir "+file);
163 QDir destDir( destFile ); 166 QDir destDir( destFile );
164 if (linkOpp==createLink) destDir.mkdir( destFile, true ); 167 if (linkOpp==createLink) destDir.mkdir( destFile, true );
165 QDir d( file ); 168 QDir d( file );
166// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); 169// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
167 const QFileInfoList *list = d.entryInfoList(); 170 const QFileInfoList *list = d.entryInfoList();
168 QFileInfoListIterator it( *list ); 171 QFileInfoListIterator it( *list );
169 QFileInfo *fi; 172 QFileInfo *fi;
170 while ( (fi=it.current()) ) 173 while ( (fi=it.current()) )
171 { 174 {
172 pvDebug(4, "processLinkDir "+fi->absFilePath()); 175 pvDebug(4, "processLinkDir "+fi->absFilePath());
173 processLinkDir( fi->absFilePath(), dest ); 176 processLinkDir( fi->absFilePath(), dest );
174 ++it; 177 ++it;
175 } 178 }
176 } else 179 } else
177 if ( fileInfo.isFile() ) 180 if ( fileInfo.isFile() )
178 { 181 {
179 const char *instFile = strdup( (file).ascii() ); 182 const char *instFile = strdup( (file).ascii() );
180 const char *linkFile = strdup( (destFile).ascii()); 183 const char *linkFile = strdup( (destFile).ascii());
181 if( linkOpp==createLink ) 184 if( linkOpp==createLink )
182 { 185 {
183 pvDebug(4, "linking: "+file+" -> "+destFile ); 186 pvDebug(4, "linking: "+file+" -> "+destFile );
184 symlink( instFile, linkFile ); 187 symlink( instFile, linkFile );
185 } 188 }
186 } else { 189 } else {
187 const char *linkFile = strdup( (destFile).ascii()); 190 const char *linkFile = strdup( (destFile).ascii());
188 if( linkOpp==removeLink ) 191 if( linkOpp==removeLink )
189 { 192 {
190 QFileInfo toRemoveLink( destFile ); 193 QFileInfo toRemoveLink( destFile );
191 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) 194 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
192 { 195 {
193 pvDebug(4,"removing "+destFile+" no "+file); 196 pvDebug(4,"removing "+destFile+" no "+file);
194 unlink( linkFile ); 197 unlink( linkFile );
195 } 198 }
196 } 199 }
197 } 200 }
198} 201}
199 202
200void PmIpkg::loadList( PackageList *pl ) 203void PmIpkg::loadList( PackageList *pl )
201 { 204 {
202 for( Package *pack = pl->first();pack ; (pack = pl->next()) ) 205 for( Package *pack = pl->first();pack ; (pack = pl->next()) )
203 { 206 {
204 if ( pack && (pack->name() != "") && pack) 207 if ( pack && (pack->name() != "") && pack)
205 { 208 {
206 if ( pack->toInstall() ) 209 if ( pack->toInstall() )
207 to_install.append( pack ); 210 to_install.append( pack );
208 if ( pack->toRemove() ) 211 if ( pack->toRemove() )
209 to_remove.append( pack ); 212 to_remove.append( pack );
210 } 213 }
211 } 214 }
212} 215}
213 216
214void PmIpkg::commit() 217void PmIpkg::commit()
215 { 218 {
216 int sizecount = 0; 219 int sizecount = 0;
217 installDialog = new InstallDialog(settings,0,0,true); 220 installDialog = new InstallDialog(settings,0,0,true);
218 installDialog->toRemoveItem->setOpen( true ); 221 installDialog->toRemoveItem->setOpen( true );
219 installDialog->toInstallItem->setOpen( true ); 222 installDialog->toInstallItem->setOpen( true );
220 for (uint i=0; i < to_remove.count(); i++) 223 for (uint i=0; i < to_remove.count(); i++)
221 { 224 {
222 sizecount += 1; 225 sizecount += 1;
223 installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); 226 installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) );
224 } 227 }
225 for (uint i=0; i < to_install.count(); i++) 228 for (uint i=0; i < to_install.count(); i++)
226 { 229 {
227 sizecount += to_install.at(i)->size().toInt(); 230 sizecount += to_install.at(i)->size().toInt();
228 installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); 231 installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) );
229 } 232 }
230 runwindow->progress->setTotalSteps(sizecount); 233 runwindow->progress->setTotalSteps(sizecount);
231 qDebug("Install size %i",sizecount); 234 qDebug("Install size %i",sizecount);
232 installDialog->showMaximized(); 235 installDialog->showMaximized();
233 installDialog->show(); 236 installDialog->show();
234 if ( installDialog->exec() ) 237 if ( installDialog->exec() )
235 { 238 {
236 doIt(); 239 doIt();
237 runwindow->showMaximized(); 240 runwindow->showMaximized();
238 runwindow->show(); 241 runwindow->show();
239 } 242 }
240 installDialog->close(); 243 installDialog->close();
241 out(tr("\nAll done.")); 244 out(tr("\nAll done."));
242} 245}
243 246
244void PmIpkg::doIt() 247void PmIpkg::doIt()
245{ 248{
246 runwindow->progress->setProgress(0); 249 runwindow->progress->setProgress(0);
247 show(); 250 show();
248 remove(); 251 remove();
249 install(); 252 install();
250} 253}
251 254
252 255
253void PmIpkg::remove() 256void PmIpkg::remove()
254{ 257{
255 if ( to_remove.count() == 0 ) return; 258 if ( to_remove.count() == 0 ) return;
256 259
257 out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); 260 out(tr("Removing")+"\n"+tr("please wait")+"\n\n");
258 261
259 QStringList *fileList; 262 QStringList *fileList;
260 for (uint i=0; i < to_remove.count(); i++) 263 for (uint i=0; i < to_remove.count(); i++)
261 { 264 {
262 if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); 265 if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() );
263 if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) 266 if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() ))
264 { 267 {
265 runwindow->progress->setProgress( 1 ); 268 runwindow->progress->setProgress( 1 );
266 linkOpp = removeLink; 269 linkOpp = removeLink;
267 to_remove.at(i)->processed(); 270 to_remove.at(i)->processed();
271 if ( to_remove.at(i)->link() )
272 processFileList( fileList, to_remove.at(i)->dest() );
268 to_remove.take( i ); 273 to_remove.take( i );
269 274
270 out("\n\n"); 275 out("\n");
271 }else{ 276 }else{
272 out(tr("Error while removing")+to_remove.at(i)->name()+"\n"); 277 out(tr("Error while removing")+to_remove.at(i)->name()+"\n");
278 if ( to_remove.at(i)->link() )
279 processFileList( fileList, to_remove.at(i)->dest() );
273 } 280 }
274 if ( to_remove.at(i)->link() ) 281 if ( to_remove.at(i)->link() )
275 {
276 out( "\nremoving links\n" );
277 out( "for package "+to_remove.at(i)->name()+" in "+to_remove.at(i)->dest()+"\n" );
278 processFileList( fileList, to_remove.at(i)->dest() ); 282 processFileList( fileList, to_remove.at(i)->dest() );
279 }
280 if ( to_remove.at(i)->link() )delete fileList; 283 if ( to_remove.at(i)->link() )delete fileList;
281 } 284 }
282 to_remove.clear(); 285 to_remove.clear();
283 out("\n"); 286 out("\n");
284} 287}
285 288
286 289
287void PmIpkg::install() 290void PmIpkg::install()
288{ 291{
289 if ( to_install.count() == 0 ) return; 292 if ( to_install.count() == 0 ) return;
290 out(tr("Installing")+"\n"+tr("please wait")+"\n"); 293 out(tr("Installing")+"\n"+tr("please wait")+"\n");
291 for (uint i=0; i < to_install.count(); i++) 294 for (uint i=0; i < to_install.count(); i++)
292 { 295 {
296 qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug
293 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) 297 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ))
294 { 298 {
295 runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); 299 runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress());
296 to_install.at(i)->processed(); 300 to_install.at(i)->processed();
301 linkOpp = createLink;
302 if ( to_install.at(i)->link() )
303 makeLinks( to_install.at(i) );
297 to_install.take( i ); 304 to_install.take( i );
298 out("\n\n"); 305 out("\n");
299 }else{ 306 }else{
300 out(tr("Error while installing")+to_install.at(i)->name()+"\n"); 307 out(tr("Error while installing")+to_install.at(i)->name()+"\n");
301 } 308 linkOpp = createLink;
302 linkOpp = createLink; 309 if ( to_install.at(i)->link() )
303 if ( to_install.at(i)->link() ) 310 makeLinks( to_install.at(i) );
304 {
305 out( "\ncreating links\n" );
306 out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"\n" );
307 makeLinks( to_install.at(i) );
308 } 311 }
309 } 312 }
310 out("\n"); 313 out("\n");
311 to_install.clear(); 314 to_install.clear();
312} 315}
313 316
314void PmIpkg::createLinks( const QString &dest ) 317void PmIpkg::createLinks( const QString &dest )
315{ 318{
316 pvDebug(2,"PmIpkg::createLinks "+dest); 319 pvDebug(2,"PmIpkg::createLinks "+dest);
317 linkOpp=createLink; 320 linkOpp=createLink;
318 QString url = settings->getDestinationUrlByName( dest ); 321 QString url = settings->getDestinationUrlByName( dest );
319 url = url==""?dest:url; 322 url = url==""?dest:url;
320 processLinkDir( "/opt", url ); 323 processLinkDir( "/opt", url );
321 processLinkDir( "/usr", url ); 324 processLinkDir( "/usr", url );
322} 325}
323 326
324void PmIpkg::removeLinks( const QString &dest ) 327void PmIpkg::removeLinks( const QString &dest )
325{ 328{
326 pvDebug(2,"PmIpkg::removeLinks "+dest); 329 pvDebug(2,"PmIpkg::removeLinks "+dest);
327 linkOpp=removeLink; 330 linkOpp=removeLink;
328 QString url = settings->getDestinationUrlByName( dest ); 331 QString url = settings->getDestinationUrlByName( dest );
329 url = url==""?dest:url; 332 url = url==""?dest:url;
330 processLinkDir( "/opt", url ); 333 processLinkDir( "/opt", url );
331 processLinkDir( "/usr", url ); 334 processLinkDir( "/usr", url );
332} 335}
333 336
334void PmIpkg::update() 337void PmIpkg::update()
335{ 338{
336 show(); 339 show();
337 runIpkg( "update" ); 340 runIpkg( "update" );
338 runwindow->close(); 341 runwindow->close();
339} 342}
340 343
341void PmIpkg::out( QString o ) 344void PmIpkg::out( QString o )
342{ 345{
343 runwindow->outPut->append(o); 346 runwindow->outPut->append(o);
344 runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); 347 runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE);
345} 348}
346 349
347 350
348 351
349 352
350void PmIpkg::show() 353void PmIpkg::show()
351{ 354{
352 if (!runwindow->isVisible()) 355 if (!runwindow->isVisible())
353 { 356 {
354 runwindow->showMaximized(); 357 runwindow->showMaximized();
355 runwindow->show(); 358 runwindow->show();
356 } 359 }
357 runwindow->outPut->setText(""); 360 runwindow->outPut->setText("");
358 //showButtons(b); 361 //showButtons(b);
359 //if ( !b ) 362 //if ( !b )
360 // runwindow->progress->hide(); 363 // runwindow->progress->hide();
361// else 364// else
362 // runwindow->progress->show(); 365 // runwindow->progress->show();
363} 366}
364 367
365void PmIpkg::installFile(const QString &fileName, const QString &dest) 368void PmIpkg::installFile(const QString &fileName, const QString &dest)
366{ 369{
367 370
368 to_install.clear(); 371 to_install.clear();
369 to_remove.clear(); 372 to_remove.clear();
370 pvDebug( 2,"PmIpkg::installFile "+ fileName); 373 pvDebug( 2,"PmIpkg::installFile "+ fileName);
371 Package *p = new Package(fileName,settings); 374 Package *p = new Package(fileName,settings);