summaryrefslogtreecommitdiff
authortille <tille>2002-06-21 12:44:34 (UTC)
committer tille <tille>2002-06-21 12:44:34 (UTC)
commite6834009bf23492e009258e3881ce183cf9e27a0 (patch) (unidiff)
treeba5fb74b2ee5e70b5157cd5eb935f8760c5b208d
parent3be39e6c8af27a43d4b09bf08b4c739c342b5de3 (diff)
downloadopie-e6834009bf23492e009258e3881ce183cf9e27a0.zip
opie-e6834009bf23492e009258e3881ce183cf9e27a0.tar.gz
opie-e6834009bf23492e009258e3881ce183cf9e27a0.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp55
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp37
2 files changed, 72 insertions, 20 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 233eae6..7df1d6b 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -1,341 +1,380 @@
1// adadpted form qpe/qipkg 1// adadpted form qpe/qipkg
2 2
3 3
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/config.h> 9#include <qpe/config.h>
10#include <qpe/qpetoolbar.h> 10#include <qpe/qpetoolbar.h>
11#include <qpe/qcopenvelope_qws.h> 11#include <qpe/qcopenvelope_qws.h>
12#include <qaction.h> 12#include <qaction.h>
13#include <qmessagebox.h> 13#include <qmessagebox.h>
14#include <qpopupmenu.h> 14#include <qpopupmenu.h>
15#include <qtoolbutton.h> 15#include <qtoolbutton.h>
16#include <qstring.h> 16#include <qstring.h>
17#include <qlabel.h> 17#include <qlabel.h>
18#include <qfile.h> 18#include <qfile.h>
19#include <qlistview.h> 19#include <qlistview.h>
20#include <qtextview.h> 20#include <qtextview.h>
21#include <qcheckbox.h> 21#include <qcheckbox.h>
22#include <qlineedit.h> 22#include <qlineedit.h>
23#include <qtabwidget.h> 23#include <qtabwidget.h>
24#include <qcombobox.h> 24#include <qcombobox.h>
25#include <qmessagebox.h> 25#include <qmessagebox.h>
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27#include <qlayout.h> 27#include <qlayout.h>
28 28
29#include "pksettingsbase.h" 29#include "pksettingsbase.h"
30#include "utils.h" 30#include "utils.h"
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// packageListServers( QObject(parent), name ), 36// packageListServers( QObject(parent), name ),
37// packageListSearch( parent, name ), 37// packageListSearch( parent, name ),
38// packageListDocLnk( parent, name ) 38// packageListDocLnk( parent, name )
39 { 39 {
40 setCaption( tr("Package Manager") ); 40 setCaption( tr("Package Manager") );
41 settings = new PackageManagerSettings(this,0,TRUE); 41 settings = new PackageManagerSettings(this,0,TRUE);
42 listViewPackages = new PackageListView( this,"listViewPackages",settings ); 42 listViewPackages = new PackageListView( this,"listViewPackages",settings );
43 setCentralWidget( listViewPackages ); 43 setCentralWidget( listViewPackages );
44 listViewPackages->addList( tr("feeds"), &packageListServers ); 44 listViewPackages->addList( tr("feeds"), &packageListServers );
45 listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); 45 listViewPackages->addList( tr("ipkgfind"), &packageListSearch );
46 listViewPackages->addList( tr("documents"), &packageListDocLnk ); 46//listViewPackages->addList( tr("documents"), &packageListDocLnk );
47 ipkg = new PmIpkg( settings, this ); 47 ipkg = new PmIpkg( settings, this );
48 packageListServers.setSettings( settings ); 48 packageListServers.setSettings( settings );
49 packageListSearch.setSettings( settings ); 49 packageListSearch.setSettings( settings );
50 packageListDocLnk.setSettings( settings ); 50 packageListDocLnk.setSettings( settings );
51 pvDebug(9,"packageListServers.update"); 51 pvDebug(9,"packageListServers.update");
52 packageListServers.update(); 52 packageListServers.update();
53 pvDebug(9,"packageListDocLnk.update"); 53 pvDebug(9,"packageListDocLnk.update");
54 packageListDocLnk.update(); 54 pvDebug(0,"no UPDATE of DocLnk");
55// packageListDocLnk.update();
55 pvDebug(9,"makeMenu"); 56 pvDebug(9,"makeMenu");
56 makeMenu(); 57 makeMenu();
57 makeChannel(); 58 makeChannel();
58 //opie is hardcoded default ;) 59 //opie is hardcoded default ;)
59 //pvDebug(9,"section->setCurrentItem"); 60 //pvDebug(9,"section->setCurrentItem");
60// for (int i=0;i<section->count();i++) 61// for (int i=0;i<section->count();i++)
61 // if (section->text(i)=="opie") 62 // if (section->text(i)=="opie")
62 // section->setCurrentItem(i); 63 // section->setCurrentItem(i);
63// sectionChanged(); 64// sectionChanged();
64 65
65 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); 66 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
66 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); 67 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
67 68
68 connect( settings->removeLinksButton, SIGNAL( clicked()), 69 connect( settings->removeLinksButton, SIGNAL( clicked()),
69 SLOT(removeLinks()) ); 70 SLOT(removeLinks()) );
70 connect( settings->createLinksButton, SIGNAL( clicked()), 71 connect( settings->createLinksButton, SIGNAL( clicked()),
71 SLOT(createLinks()) ); 72 SLOT(createLinks()) );
72 73
73 pvDebug(9,"displayList"); 74 pvDebug(9,"displayList");
74 displayList(); 75 displayList();
75} 76}
76 77
77void MainWindow::makeMenu() 78void MainWindow::makeMenu()
78{ 79{
79 80
80 QPEToolBar *toolBar = new QPEToolBar( this ); 81 QPEToolBar *toolBar = new QPEToolBar( this );
81 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 82 QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
82 QPopupMenu *srvMenu = new QPopupMenu( menuBar ); 83 QPopupMenu *srvMenu = new QPopupMenu( menuBar );
83 QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 84 QPopupMenu *viewMenu = new QPopupMenu( menuBar );
84 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 85 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
85 // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); 86 QPopupMenu *helpMenu = new QPopupMenu( menuBar );
86 87
87 setToolBarsMovable( false ); 88 setToolBarsMovable( false );
88 toolBar->setHorizontalStretchable( true ); 89 toolBar->setHorizontalStretchable( true );
89 menuBar->insertItem( tr( "Package" ), srvMenu ); 90 menuBar->insertItem( tr( "Package" ), srvMenu );
90 menuBar->insertItem( tr( "View" ), viewMenu ); 91 menuBar->insertItem( tr( "View" ), viewMenu );
91 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 92 menuBar->insertItem( tr( "Settings" ), cfgMenu );
92 // menuBar->insertItem( tr( "Sections" ), sectMenu ); 93 menuBar->insertItem( tr( "Help" ), helpMenu );
93 94
94 QLabel *spacer; 95 QLabel *spacer;
95// spacer = new QLabel( "", toolBar ); 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 section = new QComboBox( false, sectionBar ); 146 section = new QComboBox( false, sectionBar );
146 label = new QLabel( " / ", sectionBar ); 147 label = new QLabel( " / ", sectionBar );
147 label->setBackgroundColor( sectionBar->backgroundColor() ); 148 label->setBackgroundColor( sectionBar->backgroundColor() );
148 subsection = new QComboBox( false, sectionBar ); 149 subsection = new QComboBox( false, sectionBar );
149 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 150 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
150 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); 151 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
151 a->addTo( sectionBar ); 152 a->addTo( sectionBar );
152 setSections(); 153 setSections();
153 setSubSections(); 154 setSubSections();
154 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); 155 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
155 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); 156 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
156 sectionAction->setToggleAction( true ); 157 sectionAction->setToggleAction( true );
157 sectionAction->addTo( viewMenu ); 158 sectionAction->addTo( viewMenu );
158 sectionBar->setStretchableWidget( section ); 159 sectionBar->setStretchableWidget( section );
159 160
160 //FIND 161 //FIND
161 findBar = new QPEToolBar(this); 162 findBar = new QPEToolBar(this);
162 addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); 163 addToolBar( findBar, "Filter", QMainWindow::Top, TRUE );
163 label = new QLabel( tr("Filter: "), findBar ); 164 label = new QLabel( tr("Filter: "), findBar );
164 label->setBackgroundColor( findBar->backgroundColor() ); 165 label->setBackgroundColor( findBar->backgroundColor() );
165 findBar->setHorizontalStretchable( TRUE ); 166 findBar->setHorizontalStretchable( TRUE );
166 findEdit = new QLineEdit( findBar, "findEdit" ); 167 findEdit = new QLineEdit( findBar, "findEdit" );
167 findBar->setStretchableWidget( findEdit ); 168 findBar->setStretchableWidget( findEdit );
168 connect( findEdit, SIGNAL( textChanged( const QString & ) ), 169 connect( findEdit, SIGNAL( textChanged( const QString & ) ),
169 this, SLOT( displayList() ) ); 170 this, SLOT( displayList() ) );
170 a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 171 a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
171 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); 172 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) );
172 a->addTo( findBar ); 173 a->addTo( findBar );
173 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 174 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
174 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 175 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
175 a->addTo( findBar ); 176 a->addTo( findBar );
176 findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); 177 findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 );
177 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); 178 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
178 findAction->setToggleAction( true ); 179 findAction->setToggleAction( true );
179 findAction->addTo( viewMenu ); 180 findAction->addTo( viewMenu );
180 181
181 //SEARCH 182 //SEARCH
182 searchBar = new QPEToolBar(this); 183 searchBar = new QPEToolBar(this);
183 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 184 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
184 label = new QLabel( tr("ipkgfind: "), searchBar ); 185 label = new QLabel( tr("ipkgfind: "), searchBar );
185 label->setBackgroundColor( searchBar->backgroundColor() ); 186 label->setBackgroundColor( searchBar->backgroundColor() );
186 searchBar->setHorizontalStretchable( TRUE ); 187 searchBar->setHorizontalStretchable( TRUE );
187 searchEdit = new QLineEdit( searchBar, "seachEdit" ); 188 searchEdit = new QLineEdit( searchBar, "seachEdit" );
188 searchBar->setStretchableWidget( searchEdit ); 189 searchBar->setStretchableWidget( searchEdit );
189// connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 190// connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
190// this, SLOT( displayList() ) ); 191// this, SLOT( displayList() ) );
191 a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 192 a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
192 connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); 193 connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) );
193 a->addTo( searchBar ); 194 a->addTo( searchBar );
194 searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 195 searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
195 connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); 196 connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) );
196 searchCommit->addTo( searchBar ); 197 searchCommit->addTo( searchBar );
197 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 198 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
198 connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); 199 connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) );
199 a->addTo( searchBar ); 200 a->addTo( searchBar );
200 searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); 201 searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 );
201 connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); 202 connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) );
202 searchAction->setToggleAction( true ); 203 searchAction->setToggleAction( true );
203 searchAction->addTo( viewMenu ); 204 searchAction->addTo( viewMenu );
204 205
205 //DEST 206 //DEST
206 destBar = new QPEToolBar(this); 207 destBar = new QPEToolBar(this);
207 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); 208 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE );
208 label = new QLabel( tr("Destination: "), destBar ); 209 label = new QLabel( tr("Destination: "), destBar );
209 label->setBackgroundColor( destBar->backgroundColor() ); 210 label->setBackgroundColor( destBar->backgroundColor() );
210 destBar->setHorizontalStretchable( TRUE ); 211 destBar->setHorizontalStretchable( TRUE );
211 destination = new QComboBox( false, destBar ); 212 destination = new QComboBox( false, destBar );
212 destination->insertStringList( settings->getDestinationNames() ); 213 destination->insertStringList( settings->getDestinationNames() );
213 setComboName(destination,settings->getDestinationName()); 214 setComboName(destination,settings->getDestinationName());
214 connect( destination, SIGNAL(activated(int)), 215 connect( destination, SIGNAL(activated(int)),
215 settings, SLOT(activeDestinationChange(int)) ); 216 settings, SLOT(activeDestinationChange(int)) );
216 spacer = new QLabel( " ", destBar ); 217 spacer = new QLabel( " ", destBar );
217 spacer->setBackgroundColor( destBar->backgroundColor() ); 218 spacer->setBackgroundColor( destBar->backgroundColor() );
218 CheckBoxLink = new QCheckBox( tr("Link"), destBar); 219 CheckBoxLink = new QCheckBox( tr("Link"), destBar);
219 CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); 220 CheckBoxLink->setBackgroundColor( destBar->backgroundColor() );
220 CheckBoxLink->setChecked( settings->createLinks() ); 221 CheckBoxLink->setChecked( settings->createLinks() );
221 connect( CheckBoxLink, SIGNAL(toggled(bool)), 222 connect( CheckBoxLink, SIGNAL(toggled(bool)),
222 settings, SLOT(linkEnabled(bool)) ); 223 settings, SLOT(linkEnabled(bool)) );
223 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); 224 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 );
224 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); 225 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) );
225 a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 226 a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
226 connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); 227 connect( a, SIGNAL( activated() ), SLOT( destClose() ) );
227 a->addTo( destBar ); 228 a->addTo( destBar );
228 destBar->setStretchableWidget( CheckBoxLink ); 229 destBar->setStretchableWidget( CheckBoxLink );
229 destAction->setToggleAction( true ); 230 destAction->setToggleAction( true );
230 // destAction->addTo( viewMenu ); 231 // destAction->addTo( viewMenu );
231 232
233// helpMenu
234 helpMenu->insertSeparator();
235 a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 );
236 a->addTo( helpMenu );
237 helpMenu->insertSeparator();
238 a = new QAction( tr( "Install" ),
239 Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 );
240 a->addTo( helpMenu );
241 a = new QAction( tr( "Remove" ),
242 Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 );
243 a->addTo( helpMenu );
244 helpMenu->insertSeparator();
245 a = new QAction( tr( "Package Status" ), QString::null, 0, this, 0 );
246 a->addTo( helpMenu );
247 helpMenu->insertSeparator();
248 a = new QAction( tr( "New version, installed" ),
249 Resource::loadPixmap( "oipkg/installed" ), QString::null, 0, this, 0 );
250 a->addTo( helpMenu );
251 a = new QAction( tr( "New version, not installed" ),
252 Resource::loadPixmap( "oipkg/uninstalled" ), QString::null, 0, this, 0 );
253 a->addTo( helpMenu );
254 a = new QAction( tr( "Old version, installed" ),
255 Resource::loadPixmap( "oipkg/installedOld" ), QString::null, 0, this, 0 );
256 a->addTo( helpMenu );
257 a = new QAction( tr( "Old version, not installed" ),
258 Resource::loadPixmap( "oipkg/uninstalledOld" ), QString::null, 0, this, 0 );
259 a->addTo( helpMenu );
260 a = new QAction( tr( "Old version, new version installed" ),
261 Resource::loadPixmap( "oipkg/uninstalledOldinstalledNew" ), QString::null, 0, this, 0 );
262 a->addTo( helpMenu );
263 a = new QAction( tr( "New version, old version installed" ),
264 Resource::loadPixmap( "oipkg/uninstalledInstalledOld" ), QString::null, 0, this, 0 );
265 a->addTo( helpMenu );
266 //a = new QAction( tr( "" ),
267 // Resource::loadPixmap( "oipkg/" ), QString::null, 0, this, 0 );
268 // a->addTo( helpMenu );
269
232 // configure the menus 270 // configure the menus
233 Config cfg( "oipkg", Config::User ); 271 Config cfg( "oipkg", Config::User );
234 cfg.setGroup( "gui" ); 272 cfg.setGroup( "gui" );
235 273
236 findShow( cfg.readBoolEntry( "findBar", true ) ); 274 findShow( cfg.readBoolEntry( "findBar", true ) );
237 searchShow( cfg.readBoolEntry( "searchBar", true ) ); 275 searchShow( cfg.readBoolEntry( "searchBar", true ) );
238 sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); 276 sectionShow( cfg.readBoolEntry( "sectionBar", true ) );
239 destShow( cfg.readBoolEntry( "destBar", false ) ); 277 destShow( cfg.readBoolEntry( "destBar", false ) );
240} 278}
241 279
242MainWindow::~MainWindow() 280MainWindow::~MainWindow()
243{ 281{
244 Config cfg( "oipkg", Config::User ); 282 Config cfg( "oipkg", Config::User );
245 cfg.setGroup( "gui" ); 283 cfg.setGroup( "gui" );
246 cfg.writeEntry( "findBar", !findBar->isHidden() ); 284 cfg.writeEntry( "findBar", !findBar->isHidden() );
247 cfg.writeEntry( "searchBar", !searchBar->isHidden() ); 285 cfg.writeEntry( "searchBar", !searchBar->isHidden() );
248 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); 286 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
249 cfg.writeEntry( "destBar", !destBar->isHidden() ); 287 cfg.writeEntry( "destBar", !destBar->isHidden() );
250 288
251} 289}
252 290
253void MainWindow::runIpkg() 291void MainWindow::runIpkg()
254{ 292{
255 packageListServers.allPackages(); 293 packageListServers.allPackages();
256 ipkg->loadList( &packageListSearch ); 294 ipkg->loadList( &packageListSearch );
257 ipkg->loadList( &packageListDocLnk ); 295//ipkg->loadList( &packageListDocLnk );
258 ipkg->loadList( &packageListServers ); 296 ipkg->loadList( &packageListServers );
259 ipkg->commit(); 297 ipkg->commit();
260 ipkg->clearLists(); 298 ipkg->clearLists();
261 // ##### If we looked in the list of files, we could send out accurate 299 // ##### If we looked in the list of files, we could send out accurate
262 // ##### messages. But we don't bother yet, and just do an "all". 300 // ##### messages. But we don't bother yet, and just do an "all".
263 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 301 QCopEnvelope e("QPE/System", "linkChanged(QString)");
264 QString lf = QString::null; 302 QString lf = QString::null;
265 e << lf; 303 e << lf;
266 displayList(); 304 displayList();
267} 305}
268 306
269void MainWindow::updateList() 307void MainWindow::updateList()
270{ 308{
271 packageListServers.clear(); 309 packageListServers.clear();
272 packageListSearch.clear(); 310 packageListSearch.clear();
273 packageListDocLnk.clear(); 311
312// packageListDocLnk.clear();
274 ipkg->update(); 313 ipkg->update();
275 packageListServers.update(); 314 packageListServers.update();
276 packageListSearch.update(); 315 packageListSearch.update();
277 packageListDocLnk.update(); 316// packageListDocLnk.update();
278} 317}
279 318
280void MainWindow::filterList() 319void MainWindow::filterList()
281{ 320{
282 QString f = ""; 321 QString f = "";
283 if ( findAction->isOn() ) f = findEdit->text(); 322 if ( findAction->isOn() ) f = findEdit->text();
284 packageListServers.filterPackages( f ); 323 packageListServers.filterPackages( f );
285} 324}
286 325
287void MainWindow::displayList() 326void MainWindow::displayList()
288{ 327{
289 filterList(); 328 filterList();
290 listViewPackages->display(); 329 listViewPackages->display();
291} 330}
292 331
293void MainWindow::sectionChanged() 332void MainWindow::sectionChanged()
294{ 333{
295 disconnect( section, SIGNAL( activated(int) ), 334 disconnect( section, SIGNAL( activated(int) ),
296 this, SLOT( sectionChanged() ) ); 335 this, SLOT( sectionChanged() ) );
297 disconnect( subsection, SIGNAL(activated(int) ), 336 disconnect( subsection, SIGNAL(activated(int) ),
298 this, SLOT( subSectionChanged() ) ); 337 this, SLOT( subSectionChanged() ) );
299 subsection->clear(); 338 subsection->clear();
300 packageListServers.setSection( section->currentText() ); 339 packageListServers.setSection( section->currentText() );
301 setSubSections(); 340 setSubSections();
302 connect( section, SIGNAL( activated(int) ), 341 connect( section, SIGNAL( activated(int) ),
303 this, SLOT( sectionChanged() ) ); 342 this, SLOT( sectionChanged() ) );
304 connect( subsection, SIGNAL(activated(int) ), 343 connect( subsection, SIGNAL(activated(int) ),
305 this, SLOT( subSectionChanged() ) ); 344 this, SLOT( subSectionChanged() ) );
306 displayList(); 345 displayList();
307} 346}
308 347
309void MainWindow::subSectionChanged() 348void MainWindow::subSectionChanged()
310{ 349{
311 disconnect( section, SIGNAL( activated(int) ), 350 disconnect( section, SIGNAL( activated(int) ),
312 this, SLOT( sectionChanged() ) ); 351 this, SLOT( sectionChanged() ) );
313 disconnect( subsection, SIGNAL(activated(int) ), 352 disconnect( subsection, SIGNAL(activated(int) ),
314 this, SLOT( subSectionChanged() ) ); 353 this, SLOT( subSectionChanged() ) );
315 packageListServers.setSubSection( subsection->currentText() ); 354 packageListServers.setSubSection( subsection->currentText() );
316 connect( section, SIGNAL( activated(int) ), 355 connect( section, SIGNAL( activated(int) ),
317 this, SLOT( sectionChanged() ) ); 356 this, SLOT( sectionChanged() ) );
318 connect( subsection, SIGNAL(activated(int) ), 357 connect( subsection, SIGNAL(activated(int) ),
319 this, SLOT( subSectionChanged() ) ); 358 this, SLOT( subSectionChanged() ) );
320 displayList(); 359 displayList();
321} 360}
322 361
323void MainWindow::setSections() 362void MainWindow::setSections()
324{ 363{
325 section->clear(); 364 section->clear();
326 section->insertStringList( packageListServers.getSections() ); 365 section->insertStringList( packageListServers.getSections() );
327} 366}
328 367
329void MainWindow::setSubSections() 368void MainWindow::setSubSections()
330{ 369{
331 subsection->clear(); 370 subsection->clear();
332 subsection->insertStringList( packageListServers.getSubSections() ); 371 subsection->insertStringList( packageListServers.getSubSections() );
333} 372}
334 373
335 374
336void MainWindow::showSettings() 375void MainWindow::showSettings()
337{ 376{
338 if ( settings->showDialog( 0 ) ) 377 if ( settings->showDialog( 0 ) )
339 updateList(); 378 updateList();
340} 379}
341void MainWindow::showSettingsSrv() 380void MainWindow::showSettingsSrv()
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 0817247..7d0e246 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -1,419 +1,432 @@
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//#infdef OPROCESS
7#include <opie/oprocess.h> 6#include <opie/oprocess.h>
8//#endif
9#include <qpe/resource.h> 7#include <qpe/resource.h>
10#include <qpe/config.h> 8#include <qpe/config.h>
11#include <qpe/stringutil.h> 9#include <qpe/stringutil.h>
12#include <qpe/qpeapplication.h> 10#include <qpe/qpeapplication.h>
13#include <qdir.h> 11#include <qdir.h>
14#include <qfile.h> 12#include <qfile.h>
15#include <qgroupbox.h> 13#include <qgroupbox.h>
16#include <qmultilineedit.h> 14#include <qmultilineedit.h>
17#include <qstring.h> 15#include <qstring.h>
18#include <qcheckbox.h> 16#include <qcheckbox.h>
19#include <qtextstream.h> 17#include <qtextstream.h>
20#include <qtextview.h> 18#include <qtextview.h>
21 19
22#include <qprogressbar.h> 20#include <qprogressbar.h>
23#include <qpushbutton.h> 21#include <qpushbutton.h>
24#include <qlayout.h> 22#include <qlayout.h>
25 23
26#include <stdlib.h> 24#include <stdlib.h>
27#include <unistd.h> 25#include <unistd.h>
28 26
29#include "mainwindow.h" 27#include "mainwindow.h"
30 28
31 29
30//#define OPROCESS
31
32PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) 32PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
33 : QObject ( p ) 33 : QObject ( p )
34{ 34{
35 settings = s; 35 settings = s;
36 runwindow = new RunWindow( p, name, true, f ); 36 runwindow = new RunWindow( p, name, true, f );
37#ifdef OPROCESS 37#ifdef OPROCESS
38 ipkgProcess = new OProcess(); 38 ipkgProcess = new OProcess();
39 connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), 39 connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)),
40 this, SLOT(getIpkgOutput(OProcess*,char*,int))); 40 this, SLOT(getIpkgOutput(OProcess*,char*,int)));
41 41
42 connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)), 42 connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)),
43 this, SLOT(getIpkgOutput(OProcess*,char*,int))); 43 this, SLOT(getIpkgOutput(OProcess*,char*,int)));
44 installDialog = 0; 44 installDialog = 0;
45#endif 45#endif
46} 46}
47 47
48PmIpkg::~PmIpkg() 48PmIpkg::~PmIpkg()
49{ 49{
50#ifdef OPROCESS 50#ifdef OPROCESS
51 delete ipkgProcess; 51 delete ipkgProcess;
52#endif 52#endif
53} 53}
54 54
55bool PmIpkg::runIpkg(const QString& args, const QString& dest ) 55bool PmIpkg::runIpkg(const QString& args, const QString& dest )
56{ 56{
57 bool ret=false; 57 bool ret=false;
58 QDir::setCurrent("/tmp"); 58 QDir::setCurrent("/tmp");
59 QString cmd = "/usr/bin/ipkg "; 59 QString cmd = "/usr/bin/ipkg ";
60#ifdef OPROCESS 60#ifdef OPROCESS
61 ipkgProcess->clearArguments(); 61 ipkgProcess->clearArguments();
62 *ipkgProcess << "/usr/bin/ipkg "; 62 *ipkgProcess << "/usr/bin/ipkg ";
63 QString cmd = ""; 63 QString cmd = "";
64#endif 64#endif
65 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); 65 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
66 if ( dest == "" ) 66 if ( dest == "" )
67 cmd += " -dest "+settings->getDestinationName(); 67 cmd += " -dest "+settings->getDestinationName();
68 else 68 else
69 cmd += " -dest "+ dest; 69 cmd += " -dest "+ dest;
70 70
71 cmd += " -force-defaults "; 71 cmd += " -force-defaults ";
72 72
73 if (installDialog && installDialog->_force_depends) 73 if (installDialog && installDialog->_force_depends)
74 { 74 {
75 if (installDialog->_force_depends->isChecked()) 75 if (installDialog->_force_depends->isChecked())
76 cmd += " -force-depends "; 76 cmd += " -force-depends ";
77 if (installDialog->_force_reinstall->isChecked()) 77 if (installDialog->_force_reinstall->isChecked())
78 cmd += " -force-reinstall "; 78 cmd += " -force-reinstall ";
79 if (installDialog->_force_remove->isChecked()) 79 if (installDialog->_force_remove->isChecked())
80 cmd += " -force-removal-of-essential-packages "; 80 cmd += " -force-removal-of-essential-packages ";
81 } 81 }
82 82
83 out( "Starting to "+ args+"\n"); 83 out( "Starting to "+ args+"\n");
84 cmd += args; 84 cmd += args;
85 out( "running:\n"+cmd+"\n" ); 85 out( "running:\n"+cmd+"\n" );
86 pvDebug(2,"running:"+cmd); 86 pvDebug(2,"running:"+cmd);
87#ifdef OPROCESS 87#ifdef OPROCESS
88 *ipkgProcess << args; 88 *ipkgProcess << args;
89 out( "running:\n" + cmd); 89 out( "running:\n" + cmd);
90 *ipkgProcess << cmd; 90 *ipkgProcess << cmd;
91 91
92//debug 92//debug
93 ipkgProcess->clearArguments(); 93 ipkgProcess->clearArguments();
94 *ipkgProcess << "/bin/ls "; 94 *ipkgProcess << "/bin/ls ";
95//debug 95//debug
96 QValueList<QCString> a = ipkgProcess->args(); 96 QValueList<QCString> a = ipkgProcess->args();
97 QValueList<QCString>::Iterator it; 97 QValueList<QCString>::Iterator it;
98 for( it = a.begin(); it != a.end(); ++it ) 98 for( it = a.begin(); it != a.end(); ++it )
99 { 99 {
100 out( *it ); 100 out( *it );
101 cmd += *it; 101 cmd += *it;
102 } 102 }
103 103
104 pvDebug(2,"running:"+cmd); 104 pvDebug(2,"running:"+cmd);
105 qApp->processEvents(); 105 qApp->processEvents();
106// sleep(1); 106// sleep(1);
107 ret = ipkgProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); 107 ret = ipkgProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput);
108 if ( !ret ) { 108 if ( !ret ) {
109 pvDebug(2,"Could not execute '" + cmd); 109 pvDebug(2,"Could not execute '" + cmd);
110 out("\nError while executing "+ cmd+"\n\n"); 110 out("\nError while executing "+ cmd+"\n\n");
111 out("\nError while executing\n\n"); 111 out("\nError while executing\n\n");
112 // return false; 112 // return false;
113 } 113 }
114 114
115 while ( ipkgProcess->isRunning() ) 115 while ( ipkgProcess->isRunning() )
116 { 116 {
117 out("."); 117 out(".");
118 pvDebug(7,"wait for oprocess to terminate"); 118 pvDebug(7,"wait for oprocess to terminate");
119 qApp->processEvents(); 119 qApp->processEvents();
120 }; 120 };
121#else 121#else
122 qApp->processEvents(); 122 qApp->processEvents();
123 FILE *fp; 123 FILE *fp;
124 char line[130]; 124 char line[130];
125 QString lineStr, lineStrOld; 125 QString lineStr, lineStrOld;
126 sleep(1); 126 sleep(1);
127 cmd +=" 2>&1"; 127 cmd +=" 2>&1";
128 fp = popen( (const char *) cmd, "r"); 128 fp = popen( (const char *) cmd, "r");
129 if ( !fp ) { 129 if ( fp == NULL ) {
130 qDebug("Could not execute '" + cmd + "'! err=%d", fp); 130 qDebug("Could not execute '" + cmd + "'! err=%d", fp);
131 pclose(fp);
132 out("\nError while executing "+ cmd+"\n\n"); 131 out("\nError while executing "+ cmd+"\n\n");
133 return false; 132 ret = false;
134 } else { 133 } else {
135 while ( fgets( line, sizeof line, fp)) { 134 while ( fgets( line, sizeof line, fp) != NULL)
135 {
136 lineStr = line; 136 lineStr = line;
137 lineStr=lineStr.left(lineStr.length()-1); 137 lineStr=lineStr.left(lineStr.length()-1);
138 //Configuring opie-oipkg...Done 138 //Configuring opie-oipkg...Done
139 if (lineStr.contains("Done")) 139 if (lineStr.contains("Done")) ret = true;
140 ret = true;
141 if (lineStr!=lineStrOld) 140 if (lineStr!=lineStrOld)
142 out(lineStr); 141 out(lineStr);
143 lineStrOld = lineStr; 142 lineStrOld = lineStr;
144 qApp->processEvents(); 143 qApp->processEvents();
145 } 144 }
146 pclose(fp);
147 } 145 }
146 pclose(fp);
148#endif 147#endif
149 //out( "Finished!"); 148 //out( "Finished!");
150 pvDebug(2,QString(ret?"success\n":"failure\n")); 149 pvDebug(2,QString(ret?"success\n":"failure\n"));
151 return ret; 150 return ret;
152} 151}
153 152
154void PmIpkg::makeLinks(Package *pack) 153void PmIpkg::makeLinks(Package *pack)
155{ 154{
156 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); 155 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
157 linkPackage( pack->name(), pack->dest() ); 156 linkPackage( pack->name(), pack->dest() );
158} 157}
159 158
160QStringList* PmIpkg::getList( QString packFileName, QString d ) 159QStringList* PmIpkg::getList( QString packFileName, QString d )
161{ 160{
162 QString dest = settings->getDestinationUrlByName( d ); 161 QString dest = settings->getDestinationUrlByName( d );
163 dest = dest==""?d:dest; 162 dest = dest==""?d:dest;
164 if (dest == "/" ) return 0; 163 if (dest == "/" ) return 0;
165 { 164 {
166 Config cfg( "oipkg", Config::User ); 165 Config cfg( "oipkg", Config::User );
167 cfg.setGroup( "Common" ); 166 cfg.setGroup( "Common" );
168 QString statusDir = cfg.readEntry( "statusDir", "" ); 167 QString statusDir = cfg.readEntry( "statusDir", "" );
169 } 168 }
170 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; 169 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list";
171 QFile f( packFileName ); 170 QFile f( packFileName );
172 if ( ! f.open(IO_ReadOnly) ) 171 if ( ! f.open(IO_ReadOnly) )
173 { 172 {
174 pvDebug(1," Panik! Could not open"); 173 pvDebug(1," Panik! Could not open");
175 out( "Panik!\n Could not open:\n"+packFileName ); 174 out( "Panik!\n Could not open:\n"+packFileName );
176 return (QStringList*)0; 175 return (QStringList*)0;
177 } 176 }
178 QStringList *fileList = new QStringList(); 177 QStringList *fileList = new QStringList();
179 QTextStream t( &f ); 178 QTextStream t( &f );
180 while ( !t.eof() ) 179 while ( !t.eof() )
181 { 180 {
182 *fileList += t.readLine(); 181 *fileList += t.readLine();
183 } 182 }
184 return fileList; 183 return fileList;
185} 184}
186 185
187void PmIpkg::linkPackage( QString packFileName, QString dest ) 186void PmIpkg::linkPackage( QString packFileName, QString dest )
188{ 187{
189 QStringList *fileList = getList( packFileName, dest ); 188 QStringList *fileList = getList( packFileName, dest );
190 processFileList( fileList, dest ); 189 processFileList( fileList, dest );
191 delete fileList; 190 delete fileList;
192} 191}
193 192
194void PmIpkg::processFileList( QStringList *fileList, QString d ) 193void PmIpkg::processFileList( QStringList *fileList, QString d )
195{ 194{
196 if (!fileList) return; 195 if (!fileList) return;
197 for (uint i=0; i < fileList->count(); i++) 196 for (uint i=0; i < fileList->count(); i++)
198 { 197 {
199 QString dest = settings->getDestinationUrlByName( d ); 198 QString dest = settings->getDestinationUrlByName( d );
200 dest = dest==""?d:dest; 199 dest = dest==""?d:dest;
201 processLinkDir( (*fileList)[i], dest ); 200 processLinkDir( (*fileList)[i], dest );
202 } 201 }
203} 202}
204 203
205 204
206void PmIpkg::processLinkDir( QString file, QString dest ) 205void PmIpkg::processLinkDir( QString file, QString dest )
207{ 206{
208 pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); 207 pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest);
209 if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); 208 if (linkOpp==createLink) pvDebug( 4,"opp: createLink");
210 if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); 209 if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink");
211 if ( dest == "???" || dest == "" ) return; 210 if ( dest == "???" || dest == "" ) return;
212 QString destFile = file; 211 QString destFile = file;
213 file = dest+"/"+file; 212 file = dest+"/"+file;
214 if (file == dest) return; 213 if (file == dest) return;
215// if (linkOpp==createLink) out( "\ncreating links\n" ); 214// if (linkOpp==createLink) out( "\ncreating links\n" );
216 // if (linkOpp==removeLink) out( "\nremoving links\n" ); 215 // if (linkOpp==removeLink) out( "\nremoving links\n" );
217 QFileInfo fileInfo( file ); 216 QFileInfo fileInfo( file );
218 if ( fileInfo.isDir() ) 217 if ( fileInfo.isDir() )
219 { 218 {
220 pvDebug(4, "process dir "+file); 219 pvDebug(4, "process dir "+file);
221 QDir destDir( destFile ); 220 QDir destDir( destFile );
222 if (linkOpp==createLink) destDir.mkdir( destFile, true ); 221 if (linkOpp==createLink) destDir.mkdir( destFile, true );
223 QDir d( file ); 222 QDir d( file );
224// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); 223// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
225 const QFileInfoList *list = d.entryInfoList(); 224 const QFileInfoList *list = d.entryInfoList();
226 QFileInfoListIterator it( *list ); 225 QFileInfoListIterator it( *list );
227 QFileInfo *fi; 226 QFileInfo *fi;
228 while ( (fi=it.current()) ) 227 while ( (fi=it.current()) )
229 { 228 {
230 pvDebug(4, "processLinkDir "+fi->absFilePath()); 229 pvDebug(4, "processLinkDir "+fi->absFilePath());
231 processLinkDir( fi->absFilePath(), dest ); 230 processLinkDir( fi->absFilePath(), dest );
232 ++it; 231 ++it;
233 } 232 }
234 } else 233 } else
235 if ( fileInfo.isFile() ) 234 if ( fileInfo.isFile() )
236 { 235 {
237 const char *instFile = strdup( (file).ascii() ); 236 const char *instFile = strdup( (file).latin1() );
238 const char *linkFile = strdup( (destFile).ascii()); 237 const char *linkFile = strdup( (destFile).latin1());
239 if( linkOpp==createLink ) 238 if( linkOpp==createLink )
240 { 239 {
241 pvDebug(4, "linking: "+file+" -> "+destFile ); 240 pvDebug(4, "linking: "+file+" -> "+destFile );
242 symlink( instFile, linkFile ); 241 symlink( instFile, linkFile );
243 } 242 }
244 } else { 243 } else {
245 const char *linkFile = strdup( (destFile).ascii()); 244 const char *linkFile = strdup( (destFile).latin1());
246 if( linkOpp==removeLink ) 245 if( linkOpp==removeLink )
247 { 246 {
248 QFileInfo toRemoveLink( destFile ); 247 QFileInfo toRemoveLink( destFile );
249 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) 248 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
250 { 249 {
251 pvDebug(4,"removing "+destFile+" no "+file); 250 pvDebug(4,"removing "+destFile+" no "+file);
252 unlink( linkFile ); 251 unlink( linkFile );
253 } 252 }
254 } 253 }
255 } 254 }
256} 255}
257 256
258void PmIpkg::loadList( PackageList *pl ) 257void PmIpkg::loadList( PackageList *pl )
259 { 258 {
260 for( Package *pack = pl->first();pack ; (pack = pl->next()) ) 259 for( Package *pack = pl->first();pack ; (pack = pl->next()) )
261 { 260 {
262 if ( pack && (pack->name() != "") && pack) 261 if ( pack && (pack->name() != "") && pack)
263 { 262 {
264 if ( pack->toInstall() ) 263 if ( pack->toInstall() )
265 to_install.append( pack ); 264 to_install.append( pack );
266 if ( pack->toRemove() ) 265 if ( pack->toRemove() )
267 to_remove.append( pack ); 266 to_remove.append( pack );
268 } 267 }
269 } 268 }
270} 269}
271 270
272void PmIpkg::commit() 271void PmIpkg::commit()
273 { 272 {
274 int sizecount = 0; 273 int sizecount = 0;
275 installDialog = new InstallDialog(settings,0,0,true); 274 installDialog = new InstallDialog(settings,0,0,true);
276 installDialog->toRemoveItem->setOpen( true ); 275 installDialog->toRemoveItem->setOpen( true );
277 installDialog->toInstallItem->setOpen( true ); 276 installDialog->toInstallItem->setOpen( true );
278 for (uint i=0; i < to_remove.count(); i++) 277 for (uint i=0; i < to_remove.count(); i++)
279 { 278 {
280 sizecount += 1; 279 sizecount += 1;
281 installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); 280 installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) );
282 } 281 }
283 for (uint i=0; i < to_install.count(); i++) 282 for (uint i=0; i < to_install.count(); i++)
284 { 283 {
285 sizecount += to_install.at(i)->size().toInt(); 284 sizecount += to_install.at(i)->size().toInt();
286 installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); 285 installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) );
287 } 286 }
288 runwindow->progress->setTotalSteps(sizecount); 287 runwindow->progress->setTotalSteps(sizecount);
289 qDebug("Install size %i",sizecount); 288 qDebug("Install size %i",sizecount);
290 installDialog->showMaximized(); 289 installDialog->showMaximized();
291 installDialog->show(); 290 installDialog->show();
292 if ( installDialog->exec() ) 291 if ( installDialog->exec() )
293 { 292 {
294 doIt(); 293 doIt();
295 runwindow->showMaximized(); 294 runwindow->showMaximized();
296 runwindow->show(); 295 runwindow->show();
297 } 296 }
298 installDialog->close(); 297 installDialog->close();
299 delete installDialog; 298 delete installDialog;
300 installDialog = 0; 299 installDialog = 0;
301 out(tr("\nAll done.")); 300 out(tr("\nAll done."));
302} 301}
303 302
304void PmIpkg::doIt() 303void PmIpkg::doIt()
305{ 304{
306 runwindow->progress->setProgress(0); 305 runwindow->progress->setProgress(0);
307 show(); 306 show();
308 remove(); 307 remove();
309 install(); 308 install();
310} 309}
311 310
312 311
313void PmIpkg::remove() 312void PmIpkg::remove()
314{ 313{
315 if ( to_remove.count() == 0 ) return; 314 if ( to_remove.count() == 0 ) return;
316 315
317 out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); 316 out(tr("Removing")+"\n"+tr("please wait")+"\n\n");
318 317
319 QStringList *fileList; 318 QStringList *fileList;
320 for (uint i=0; i < to_remove.count(); i++) 319 for (uint i=0; i < to_remove.count(); i++)
321 { 320 {
322 if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); 321 if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() );
323 if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) 322 if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() ))
324 { 323 {
325 runwindow->progress->setProgress( 1 ); 324 runwindow->progress->setProgress( 1 );
326 linkOpp = removeLink; 325 linkOpp = removeLink;
327 to_remove.at(i)->processed(); 326 to_remove.at(i)->processed();
328 pvDebug(3,"link "+QString::number(i)); 327 pvDebug(3,"link "+QString::number(i));
329 if ( to_remove.at(i)->link() ) 328 if ( to_remove.at(i)->link() )
330 processFileList( fileList, to_remove.at(i)->dest() ); 329 processFileList( fileList, to_remove.at(i)->dest() );
331 //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); 330 //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count()));
332 //if ( to_remove.at(i) ) to_remove.take( i ); 331 //if ( to_remove.at(i) ) to_remove.take( i );
333 332
334 out("\n"); 333 out("\n");
335 }else{ 334 }else{
336 out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); 335 out(tr("Error while removing ")+to_remove.at(i)->name()+"\n");
337 if ( to_remove.at(i)->link() ) 336 if ( to_remove.at(i)->link() )
338 processFileList( fileList, to_remove.at(i)->dest() ); 337 processFileList( fileList, to_remove.at(i)->dest() );
339 } 338 }
340 if ( to_remove.at(i)->link() ) 339 if ( to_remove.at(i)->link() )
341 processFileList( fileList, to_remove.at(i)->dest() ); 340 processFileList( fileList, to_remove.at(i)->dest() );
342 if ( to_remove.at(i)->link() )delete fileList; 341 if ( to_remove.at(i)->link() )delete fileList;
343 } 342 }
344 to_remove.clear(); 343 to_remove.clear();
345 out("\n"); 344 out("\n");
346} 345}
347 346
348 347
349void PmIpkg::install() 348void PmIpkg::install()
350{ 349{
351 if ( to_install.count() == 0 ) return; 350 if ( to_install.count() == 0 ) return;
352 out(tr("Installing")+"\n"+tr("please wait")+"\n"); 351 out(tr("Installing")+"\n"+tr("please wait")+"\n");
353 for (uint i=0; i < to_install.count(); i++) 352 for (uint i=0; i < to_install.count(); i++)
354 { 353 {
355 qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug 354 qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug
355 if (to_install.at(i)->link())
356 {
357 // hack to have package.list
358 // in "dest"/usr/lib/ipkg/info/
359 QString rds = settings->getDestinationUrlByName("root");
360 QString lds = settings->getDestinationUrlByName(to_install.at(i)->dest());
361 QString listFile = "usr/lib/ipkg/lists/"+to_install.at(i)->name()+".list";
362 rds += listFile;
363 lds += listFile;
364 const char *rd = rds.latin1();
365 const char *ld = lds.latin1();
366 pvDebug(4, "linking: "+rds+" -> "+lds );
367 symlink( rd, ld );
368 }
356 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) 369 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ))
357 { 370 {
358 runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); 371 runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress());
359 to_install.at(i)->processed(); 372 to_install.at(i)->processed();
360 linkOpp = createLink; 373 linkOpp = createLink;
361 if ( to_install.at(i)->link() ) 374 if ( to_install.at(i)->link() )
362 makeLinks( to_install.at(i) ); 375 makeLinks( to_install.at(i) );
363 // to_install.take( i ); 376 // to_install.take( i );
364 out("\n"); 377 out("\n");
365 }else{ 378 }else{
366 out(tr("Error while installing")+to_install.at(i)->name()+"\n"); 379 out(tr("Error while installing")+to_install.at(i)->name()+"\n");
367 linkOpp = createLink; 380 linkOpp = createLink;
368 if ( to_install.at(i)->link() ) 381 if ( to_install.at(i)->link() )
369 makeLinks( to_install.at(i) ); 382 makeLinks( to_install.at(i) );
370 } 383 }
371 } 384 }
372 out("\n"); 385 out("\n");
373 to_install.clear(); 386 to_install.clear();
374} 387}
375 388
376void PmIpkg::createLinks( const QString &dest ) 389void PmIpkg::createLinks( const QString &dest )
377{ 390{
378 pvDebug(2,"PmIpkg::createLinks "+dest); 391 pvDebug(2,"PmIpkg::createLinks "+dest);
379 linkOpp=createLink; 392 linkOpp=createLink;
380 QString url = settings->getDestinationUrlByName( dest ); 393 QString url = settings->getDestinationUrlByName( dest );
381 url = url==""?dest:url; 394 url = url==""?dest:url;
382 processLinkDir( "/opt", url ); 395 processLinkDir( "/opt", url );
383 processLinkDir( "/usr", url ); 396 processLinkDir( "/usr", url );
384} 397}
385 398
386void PmIpkg::removeLinks( const QString &dest ) 399void PmIpkg::removeLinks( const QString &dest )
387{ 400{
388 pvDebug(2,"PmIpkg::removeLinks "+dest); 401 pvDebug(2,"PmIpkg::removeLinks "+dest);
389 linkOpp=removeLink; 402 linkOpp=removeLink;
390 QString url = settings->getDestinationUrlByName( dest ); 403 QString url = settings->getDestinationUrlByName( dest );
391 url = url==""?dest:url; 404 url = url==""?dest:url;
392 processLinkDir( "/opt", url ); 405 processLinkDir( "/opt", url );
393 processLinkDir( "/usr", url ); 406 processLinkDir( "/usr", url );
394} 407}
395 408
396void PmIpkg::update() 409void PmIpkg::update()
397{ 410{
398 show(); 411 show();
399 if ( runIpkg( "update" ) ) 412 if ( runIpkg( "update" ) )
400 runwindow->close(); 413 runwindow->close();
401 else out("An error occurred!\nPlease check the log."); 414 else out("An error occurred!\nPlease check the log.");
402} 415}
403 416
404void PmIpkg::out( QString o ) 417void PmIpkg::out( QString o )
405{ 418{
406 runwindow->outPut->append(o); 419 runwindow->outPut->append(o);
407 runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); 420 runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE);
408} 421}
409 422
410 423
411 424
412 425
413void PmIpkg::show() 426void PmIpkg::show()
414{ 427{
415 if (!runwindow->isVisible()) 428 if (!runwindow->isVisible())
416 { 429 {
417 runwindow->showMaximized(); 430 runwindow->showMaximized();
418 runwindow->show(); 431 runwindow->show();
419 } 432 }