summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp2
-rw-r--r--noncore/unsupported/oipkg/package.cpp2
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp5
3 files changed, 5 insertions, 4 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 9c4c752..27c9f4c 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -1,456 +1,456 @@
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 { 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 ipkg = new PmIpkg( settings, this ); 44 ipkg = new PmIpkg( settings, this );
45 packageListServers.setSettings( settings ); 45 packageListServers.setSettings( settings );
46 packageListSearch.setSettings( settings ); 46 packageListSearch.setSettings( settings );
47 packageListDocLnk.setSettings( settings ); 47 packageListDocLnk.setSettings( settings );
48 pvDebug(9,"packageListServers.update"); 48 pvDebug(9,"packageListServers.update");
49 packageListServers.update(); 49 packageListServers.update();
50 pvDebug(9,"packageListDocLnk.update"); 50 pvDebug(9,"packageListDocLnk.update");
51 packageListDocLnk.update(); 51 packageListDocLnk.update();
52 pvDebug(9,"makeMenu"); 52 pvDebug(9,"makeMenu");
53 makeMenu(); 53 makeMenu();
54 makeChannel(); 54 makeChannel();
55 //opie is hardcoded default ;) 55 //opie is hardcoded default ;)
56 //pvDebug(9,"section->setCurrentItem"); 56 //pvDebug(9,"section->setCurrentItem");
57// for (int i=0;i<section->count();i++) 57// for (int i=0;i<section->count();i++)
58 // if (section->text(i)=="opie") 58 // if (section->text(i)=="opie")
59 // section->setCurrentItem(i); 59 // section->setCurrentItem(i);
60// sectionChanged(); 60// sectionChanged();
61 61
62 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); 62 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
63 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); 63 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
64 64
65 connect( settings->removeLinksButton, SIGNAL( clicked()), 65 connect( settings->removeLinksButton, SIGNAL( clicked()),
66 SLOT(removeLinks()) ); 66 SLOT(removeLinks()) );
67 connect( settings->createLinksButton, SIGNAL( clicked()), 67 connect( settings->createLinksButton, SIGNAL( clicked()),
68 SLOT(createLinks()) ); 68 SLOT(createLinks()) );
69 69
70 pvDebug(9,"displayList"); 70 pvDebug(9,"displayList");
71 displayList(); 71 displayList();
72} 72}
73 73
74void MainWindow::makeMenu() 74void MainWindow::makeMenu()
75{ 75{
76 76
77 QPEToolBar *toolBar = new QPEToolBar( this ); 77 QPEToolBar *toolBar = new QPEToolBar( this );
78 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 78 QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
79 QPopupMenu *srvMenu = new QPopupMenu( menuBar ); 79 QPopupMenu *srvMenu = new QPopupMenu( menuBar );
80 QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 80 QPopupMenu *viewMenu = new QPopupMenu( menuBar );
81 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 81 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
82 // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); 82 // QPopupMenu *sectMenu = new QPopupMenu( menuBar );
83 83
84 setToolBarsMovable( false ); 84 setToolBarsMovable( false );
85 toolBar->setHorizontalStretchable( true ); 85 toolBar->setHorizontalStretchable( true );
86 menuBar->insertItem( tr( "Package" ), srvMenu ); 86 menuBar->insertItem( tr( "Package" ), srvMenu );
87 menuBar->insertItem( tr( "View" ), viewMenu ); 87 menuBar->insertItem( tr( "View" ), viewMenu );
88 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 88 menuBar->insertItem( tr( "Settings" ), cfgMenu );
89 // menuBar->insertItem( tr( "Sections" ), sectMenu ); 89 // menuBar->insertItem( tr( "Sections" ), sectMenu );
90 90
91 QLabel *spacer; 91 QLabel *spacer;
92// spacer = new QLabel( "", toolBar ); 92// spacer = new QLabel( "", toolBar );
93// spacer->setBackgroundColor( toolBar->backgroundColor() ); 93// spacer->setBackgroundColor( toolBar->backgroundColor() );
94// toolBar->setStretchableWidget( spacer ); 94// toolBar->setStretchableWidget( spacer );
95 95
96 96
97 runAction = new QAction( tr( "Apply" ), 97 runAction = new QAction( tr( "Apply" ),
98 Resource::loadPixmap( "oipkg/install" ), 98 Resource::loadPixmap( "oipkg/install" ),
99 QString::null, 0, this, 0 ); 99 QString::null, 0, this, 0 );
100 connect( runAction, SIGNAL( activated() ), 100 connect( runAction, SIGNAL( activated() ),
101 this, SLOT( runIpkg() ) ); 101 this, SLOT( runIpkg() ) );
102 runAction->addTo( toolBar ); 102 runAction->addTo( toolBar );
103 runAction->addTo( srvMenu ); 103 runAction->addTo( srvMenu );
104 104
105 srvMenu->insertSeparator (); 105 srvMenu->insertSeparator ();
106 106
107 updateAction = new QAction( tr( "Update" ), 107 updateAction = new QAction( tr( "Update" ),
108 Resource::loadIconSet( "oipkg/update" ), 108 Resource::loadIconSet( "oipkg/update" ),
109 QString::null, 0, this, 0 ); 109 QString::null, 0, this, 0 );
110 connect( updateAction, SIGNAL( activated() ), 110 connect( updateAction, SIGNAL( activated() ),
111 this , SLOT( updateList() ) ); 111 this , SLOT( updateList() ) );
112 updateAction->addTo( toolBar ); 112 updateAction->addTo( toolBar );
113 updateAction->addTo( srvMenu ); 113 updateAction->addTo( srvMenu );
114 114
115 QAction *cfgact; 115 QAction *cfgact;
116 116
117 cfgact = new QAction( tr( "Setups" ), 117 cfgact = new QAction( tr( "Setups" ),
118 QString::null, 0, this, 0 ); 118 QString::null, 0, this, 0 );
119 connect( cfgact, SIGNAL( activated() ), 119 connect( cfgact, SIGNAL( activated() ),
120 SLOT( showSettings() ) ); 120 SLOT( showSettings() ) );
121 cfgact->addTo( cfgMenu ); 121 cfgact->addTo( cfgMenu );
122 122
123 cfgact = new QAction( tr( "Servers" ), 123 cfgact = new QAction( tr( "Servers" ),
124 QString::null, 0, this, 0 ); 124 QString::null, 0, this, 0 );
125 connect( cfgact, SIGNAL( activated() ), 125 connect( cfgact, SIGNAL( activated() ),
126 SLOT( showSettingsSrv() ) ); 126 SLOT( showSettingsSrv() ) );
127 cfgact->addTo( cfgMenu ); 127 cfgact->addTo( cfgMenu );
128 cfgact = new QAction( tr( "Destinations" ), 128 cfgact = new QAction( tr( "Destinations" ),
129 QString::null, 0, this, 0 ); 129 QString::null, 0, this, 0 );
130 connect( cfgact, SIGNAL( activated() ), 130 connect( cfgact, SIGNAL( activated() ),
131 SLOT( showSettingsDst() ) ); 131 SLOT( showSettingsDst() ) );
132 cfgact->addTo( cfgMenu ); 132 cfgact->addTo( cfgMenu );
133 133
134 QAction *a; 134 QAction *a;
135 135
136 // SECTIONS 136 // SECTIONS
137 sectionBar = new QPEToolBar( this ); 137 sectionBar = new QPEToolBar( this );
138 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); 138 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE );
139 sectionBar->setHorizontalStretchable( true ); 139 sectionBar->setHorizontalStretchable( true );
140 QLabel *label = new QLabel( tr("Section: "), sectionBar ); 140 QLabel *label = new QLabel( tr("Section: "), sectionBar );
141 label->setBackgroundColor( sectionBar->backgroundColor() ); 141 label->setBackgroundColor( sectionBar->backgroundColor() );
142 sectionBar->setStretchableWidget( label );
143 section = new QComboBox( false, sectionBar ); 142 section = new QComboBox( false, sectionBar );
144 label = new QLabel( " / ", sectionBar ); 143 label = new QLabel( " / ", sectionBar );
145 label->setBackgroundColor( sectionBar->backgroundColor() ); 144 label->setBackgroundColor( sectionBar->backgroundColor() );
146 subsection = new QComboBox( false, sectionBar ); 145 subsection = new QComboBox( false, sectionBar );
147 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 146 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
148 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); 147 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
149 a->addTo( sectionBar ); 148 a->addTo( sectionBar );
150 setSections(); 149 setSections();
151 setSubSections(); 150 setSubSections();
152 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); 151 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
153 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); 152 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
154 sectionAction->setToggleAction( true ); 153 sectionAction->setToggleAction( true );
155 sectionAction->addTo( viewMenu ); 154 sectionAction->addTo( viewMenu );
155 sectionBar->setStretchableWidget( section );
156 156
157 //FIND 157 //FIND
158 findBar = new QPEToolBar(this); 158 findBar = new QPEToolBar(this);
159 addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); 159 addToolBar( findBar, "Filter", QMainWindow::Top, TRUE );
160 label = new QLabel( tr("Filter: "), findBar ); 160 label = new QLabel( tr("Filter: "), findBar );
161 label->setBackgroundColor( findBar->backgroundColor() ); 161 label->setBackgroundColor( findBar->backgroundColor() );
162 findBar->setHorizontalStretchable( TRUE ); 162 findBar->setHorizontalStretchable( TRUE );
163 findEdit = new QLineEdit( findBar, "findEdit" ); 163 findEdit = new QLineEdit( findBar, "findEdit" );
164 findBar->setStretchableWidget( findEdit ); 164 findBar->setStretchableWidget( findEdit );
165 connect( findEdit, SIGNAL( textChanged( const QString & ) ), 165 connect( findEdit, SIGNAL( textChanged( const QString & ) ),
166 this, SLOT( displayList() ) ); 166 this, SLOT( displayList() ) );
167 a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 167 a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
168 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); 168 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) );
169 a->addTo( findBar ); 169 a->addTo( findBar );
170 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 170 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
171 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 171 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
172 a->addTo( findBar ); 172 a->addTo( findBar );
173 findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); 173 findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 );
174 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); 174 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
175 findAction->setToggleAction( true ); 175 findAction->setToggleAction( true );
176 findAction->addTo( viewMenu ); 176 findAction->addTo( viewMenu );
177 177
178 //SEARCH 178 //SEARCH
179 searchBar = new QPEToolBar(this); 179 searchBar = new QPEToolBar(this);
180 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 180 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
181 label = new QLabel( tr("ipkgfind: "), searchBar ); 181 label = new QLabel( tr("ipkgfind: "), searchBar );
182 label->setBackgroundColor( searchBar->backgroundColor() ); 182 label->setBackgroundColor( searchBar->backgroundColor() );
183 searchBar->setHorizontalStretchable( TRUE ); 183 searchBar->setHorizontalStretchable( TRUE );
184 searchEdit = new QLineEdit( searchBar, "seachEdit" ); 184 searchEdit = new QLineEdit( searchBar, "seachEdit" );
185 searchBar->setStretchableWidget( searchEdit ); 185 searchBar->setStretchableWidget( searchEdit );
186// connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 186// connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
187// this, SLOT( displayList() ) ); 187// this, SLOT( displayList() ) );
188 a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 188 a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
189 connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); 189 connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) );
190 a->addTo( searchBar ); 190 a->addTo( searchBar );
191 searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 191 searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
192 connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); 192 connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) );
193 searchCommit->addTo( searchBar ); 193 searchCommit->addTo( searchBar );
194 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 194 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
195 connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); 195 connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) );
196 a->addTo( searchBar ); 196 a->addTo( searchBar );
197 searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); 197 searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 );
198 connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); 198 connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) );
199 searchAction->setToggleAction( true ); 199 searchAction->setToggleAction( true );
200 searchAction->addTo( viewMenu ); 200 searchAction->addTo( viewMenu );
201 201
202 //DEST 202 //DEST
203 destBar = new QPEToolBar(this); 203 destBar = new QPEToolBar(this);
204 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); 204 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE );
205 label = new QLabel( tr("Destination: "), destBar ); 205 label = new QLabel( tr("Destination: "), destBar );
206 label->setBackgroundColor( destBar->backgroundColor() ); 206 label->setBackgroundColor( destBar->backgroundColor() );
207 destBar->setHorizontalStretchable( TRUE ); 207 destBar->setHorizontalStretchable( TRUE );
208 destination = new QComboBox( false, destBar ); 208 destination = new QComboBox( false, destBar );
209 destination->insertStringList( settings->getDestinationNames() ); 209 destination->insertStringList( settings->getDestinationNames() );
210 setComboName(destination,settings->getDestinationName()); 210 setComboName(destination,settings->getDestinationName());
211 connect( destination, SIGNAL(activated(int)), 211 connect( destination, SIGNAL(activated(int)),
212 settings, SLOT(activeDestinationChange(int)) ); 212 settings, SLOT(activeDestinationChange(int)) );
213 spacer = new QLabel( " ", destBar ); 213 spacer = new QLabel( " ", destBar );
214 spacer->setBackgroundColor( destBar->backgroundColor() ); 214 spacer->setBackgroundColor( destBar->backgroundColor() );
215 CheckBoxLink = new QCheckBox( tr("Link"), destBar); 215 CheckBoxLink = new QCheckBox( tr("Link"), destBar);
216 CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); 216 CheckBoxLink->setBackgroundColor( destBar->backgroundColor() );
217 CheckBoxLink->setChecked( settings->createLinks() ); 217 CheckBoxLink->setChecked( settings->createLinks() );
218 connect( CheckBoxLink, SIGNAL(toggled(bool)), 218 connect( CheckBoxLink, SIGNAL(toggled(bool)),
219 settings, SLOT(linkEnabled(bool)) ); 219 settings, SLOT(linkEnabled(bool)) );
220 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); 220 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 );
221 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); 221 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) );
222 a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 222 a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
223 connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); 223 connect( a, SIGNAL( activated() ), SLOT( destClose() ) );
224 a->addTo( destBar ); 224 a->addTo( destBar );
225 destBar->setStretchableWidget( CheckBoxLink ); 225 destBar->setStretchableWidget( CheckBoxLink );
226 destAction->setToggleAction( true ); 226 destAction->setToggleAction( true );
227 // destAction->addTo( viewMenu ); 227 // destAction->addTo( viewMenu );
228 228
229 // configure the menus 229 // configure the menus
230 Config cfg( "oipkg", Config::User ); 230 Config cfg( "oipkg", Config::User );
231 cfg.setGroup( "gui" ); 231 cfg.setGroup( "gui" );
232 232
233 findShow( cfg.readBoolEntry( "findBar", true ) ); 233 findShow( cfg.readBoolEntry( "findBar", true ) );
234 searchShow( cfg.readBoolEntry( "searchBar", true ) ); 234 searchShow( cfg.readBoolEntry( "searchBar", true ) );
235 sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); 235 sectionShow( cfg.readBoolEntry( "sectionBar", true ) );
236 destShow( cfg.readBoolEntry( "destBar", false ) ); 236 destShow( cfg.readBoolEntry( "destBar", false ) );
237} 237}
238 238
239MainWindow::~MainWindow() 239MainWindow::~MainWindow()
240{ 240{
241 Config cfg( "oipkg", Config::User ); 241 Config cfg( "oipkg", Config::User );
242 cfg.setGroup( "gui" ); 242 cfg.setGroup( "gui" );
243 cfg.writeEntry( "findBar", !findBar->isHidden() ); 243 cfg.writeEntry( "findBar", !findBar->isHidden() );
244 cfg.writeEntry( "searchBar", !searchBar->isHidden() ); 244 cfg.writeEntry( "searchBar", !searchBar->isHidden() );
245 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); 245 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
246 cfg.writeEntry( "destBar", !destBar->isHidden() ); 246 cfg.writeEntry( "destBar", !destBar->isHidden() );
247 247
248} 248}
249 249
250void MainWindow::runIpkg() 250void MainWindow::runIpkg()
251{ 251{
252 packageListServers.allPackages(); 252 packageListServers.allPackages();
253 ipkg->loadList( &packageListSearch ); 253 ipkg->loadList( &packageListSearch );
254 ipkg->loadList( &packageListDocLnk ); 254 ipkg->loadList( &packageListDocLnk );
255 ipkg->loadList( &packageListServers ); 255 ipkg->loadList( &packageListServers );
256 ipkg->commit(); 256 ipkg->commit();
257 ipkg->clearLists(); 257 ipkg->clearLists();
258 // ##### If we looked in the list of files, we could send out accurate 258 // ##### If we looked in the list of files, we could send out accurate
259 // ##### messages. But we don't bother yet, and just do an "all". 259 // ##### messages. But we don't bother yet, and just do an "all".
260 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 260 QCopEnvelope e("QPE/System", "linkChanged(QString)");
261 QString lf = QString::null; 261 QString lf = QString::null;
262 e << lf; 262 e << lf;
263 displayList(); 263 displayList();
264} 264}
265 265
266void MainWindow::updateList() 266void MainWindow::updateList()
267{ 267{
268 packageListServers.clear(); 268 packageListServers.clear();
269 packageListSearch.clear(); 269 packageListSearch.clear();
270 packageListDocLnk.clear(); 270 packageListDocLnk.clear();
271 ipkg->update(); 271 ipkg->update();
272 packageListServers.update(); 272 packageListServers.update();
273 packageListSearch.update(); 273 packageListSearch.update();
274 packageListDocLnk.update(); 274 packageListDocLnk.update();
275} 275}
276 276
277void MainWindow::filterList() 277void MainWindow::filterList()
278{ 278{
279 QString f = ""; 279 QString f = "";
280 if ( findAction->isOn() ) f = findEdit->text(); 280 if ( findAction->isOn() ) f = findEdit->text();
281 packageListServers.filterPackages( f ); 281 packageListServers.filterPackages( f );
282} 282}
283 283
284void MainWindow::displayList() 284void MainWindow::displayList()
285{ 285{
286 filterList(); 286 filterList();
287 listViewPackages->display(); 287 listViewPackages->display();
288} 288}
289 289
290void MainWindow::sectionChanged() 290void MainWindow::sectionChanged()
291{ 291{
292 disconnect( section, SIGNAL( activated(int) ), 292 disconnect( section, SIGNAL( activated(int) ),
293 this, SLOT( sectionChanged() ) ); 293 this, SLOT( sectionChanged() ) );
294 disconnect( subsection, SIGNAL(activated(int) ), 294 disconnect( subsection, SIGNAL(activated(int) ),
295 this, SLOT( subSectionChanged() ) ); 295 this, SLOT( subSectionChanged() ) );
296 subsection->clear(); 296 subsection->clear();
297 packageListServers.setSection( section->currentText() ); 297 packageListServers.setSection( section->currentText() );
298 setSubSections(); 298 setSubSections();
299 connect( section, SIGNAL( activated(int) ), 299 connect( section, SIGNAL( activated(int) ),
300 this, SLOT( sectionChanged() ) ); 300 this, SLOT( sectionChanged() ) );
301 connect( subsection, SIGNAL(activated(int) ), 301 connect( subsection, SIGNAL(activated(int) ),
302 this, SLOT( subSectionChanged() ) ); 302 this, SLOT( subSectionChanged() ) );
303 displayList(); 303 displayList();
304} 304}
305 305
306void MainWindow::subSectionChanged() 306void MainWindow::subSectionChanged()
307{ 307{
308 disconnect( section, SIGNAL( activated(int) ), 308 disconnect( section, SIGNAL( activated(int) ),
309 this, SLOT( sectionChanged() ) ); 309 this, SLOT( sectionChanged() ) );
310 disconnect( subsection, SIGNAL(activated(int) ), 310 disconnect( subsection, SIGNAL(activated(int) ),
311 this, SLOT( subSectionChanged() ) ); 311 this, SLOT( subSectionChanged() ) );
312 packageListServers.setSubSection( subsection->currentText() ); 312 packageListServers.setSubSection( subsection->currentText() );
313 connect( section, SIGNAL( activated(int) ), 313 connect( section, SIGNAL( activated(int) ),
314 this, SLOT( sectionChanged() ) ); 314 this, SLOT( sectionChanged() ) );
315 connect( subsection, SIGNAL(activated(int) ), 315 connect( subsection, SIGNAL(activated(int) ),
316 this, SLOT( subSectionChanged() ) ); 316 this, SLOT( subSectionChanged() ) );
317 displayList(); 317 displayList();
318} 318}
319 319
320void MainWindow::setSections() 320void MainWindow::setSections()
321{ 321{
322 section->clear(); 322 section->clear();
323 section->insertStringList( packageListServers.getSections() ); 323 section->insertStringList( packageListServers.getSections() );
324} 324}
325 325
326void MainWindow::setSubSections() 326void MainWindow::setSubSections()
327{ 327{
328 subsection->clear(); 328 subsection->clear();
329 subsection->insertStringList( packageListServers.getSubSections() ); 329 subsection->insertStringList( packageListServers.getSubSections() );
330} 330}
331 331
332 332
333void MainWindow::showSettings() 333void MainWindow::showSettings()
334{ 334{
335 if ( settings->showDialog( 0 ) ) 335 if ( settings->showDialog( 0 ) )
336 updateList(); 336 updateList();
337} 337}
338void MainWindow::showSettingsSrv() 338void MainWindow::showSettingsSrv()
339{ 339{
340 if ( settings->showDialog( 1 ) ) 340 if ( settings->showDialog( 1 ) )
341 updateList(); 341 updateList();
342} 342}
343void MainWindow::showSettingsDst() 343void MainWindow::showSettingsDst()
344{ 344{
345 if ( settings->showDialog( 2 ) ) 345 if ( settings->showDialog( 2 ) )
346 updateList(); 346 updateList();
347} 347}
348 348
349void MainWindow::sectionShow(bool b) 349void MainWindow::sectionShow(bool b)
350{ 350{
351 if (b) sectionBar->show(); 351 if (b) sectionBar->show();
352 else sectionBar->hide(); 352 else sectionBar->hide();
353 sectionAction->setOn( b ); 353 sectionAction->setOn( b );
354} 354}
355 355
356void MainWindow::sectionClose() 356void MainWindow::sectionClose()
357{ 357{
358 sectionAction->setOn( false ); 358 sectionAction->setOn( false );
359} 359}
360 360
361void MainWindow::findShow(bool b) 361void MainWindow::findShow(bool b)
362{ 362{
363 if (b) findBar->show(); 363 if (b) findBar->show();
364 else findBar->hide(); 364 else findBar->hide();
365 findAction->setOn( b ); 365 findAction->setOn( b );
366} 366}
367 367
368void MainWindow::findClose() 368void MainWindow::findClose()
369{ 369{
370 findAction->setOn( false ); 370 findAction->setOn( false );
371} 371}
372 372
373void MainWindow::searchShow(bool b) 373void MainWindow::searchShow(bool b)
374{ 374{
375 if (b) searchBar->show(); 375 if (b) searchBar->show();
376 else searchBar->hide(); 376 else searchBar->hide();
377 searchAction->setOn( b ); 377 searchAction->setOn( b );
378} 378}
379 379
380void MainWindow::searchClose() 380void MainWindow::searchClose()
381{ 381{
382 searchAction->setOn( false ); 382 searchAction->setOn( false );
383} 383}
384 384
385 385
386void MainWindow::destShow(bool b) 386void MainWindow::destShow(bool b)
387{ 387{
388 if (b) destBar->show(); 388 if (b) destBar->show();
389 else destBar->hide(); 389 else destBar->hide();
390 destAction->setOn( b ); 390 destAction->setOn( b );
391} 391}
392 392
393void MainWindow::destClose() 393void MainWindow::destClose()
394{ 394{
395 destAction->setOn( false ); 395 destAction->setOn( false );
396} 396}
397 397
398void MainWindow::setDocument(const QString &fileName) 398void MainWindow::setDocument(const QString &fileName)
399{ 399{
400 if ( !QFile::exists( fileName ) ) return; 400 if ( !QFile::exists( fileName ) ) return;
401 ipkg->installFile( fileName ); 401 ipkg->installFile( fileName );
402 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 402 QCopEnvelope e("QPE/System", "linkChanged(QString)");
403 QString lf = QString::null; 403 QString lf = QString::null;
404 e << lf; 404 e << lf;
405 exit; 405 exit;
406} 406}
407 407
408 408
409void MainWindow::makeChannel() 409void MainWindow::makeChannel()
410 { 410 {
411 channel = new QCopChannel( "QPE/Application/oipkg", this ); 411 channel = new QCopChannel( "QPE/Application/oipkg", this );
412 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 412 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
413 this, SLOT(receive(const QCString&, const QByteArray&)) ); 413 this, SLOT(receive(const QCString&, const QByteArray&)) );
414} 414}
415 415
416 416
417 417
418void MainWindow::receive(const QCString &msg, const QByteArray &arg) 418void MainWindow::receive(const QCString &msg, const QByteArray &arg)
419{ 419{
420 pvDebug(3, "QCop "+msg+" "+QCString(arg)); 420 pvDebug(3, "QCop "+msg+" "+QCString(arg));
421 if ( msg == "installFile(QString)" ) 421 if ( msg == "installFile(QString)" )
422 { 422 {
423 ipkg->installFile( QString(arg) ); 423 ipkg->installFile( QString(arg) );
424 }else if( msg == "removeFile(QString)" ) 424 }else if( msg == "removeFile(QString)" )
425 { 425 {
426 ipkg->removeFile( QString(arg) ); 426 ipkg->removeFile( QString(arg) );
427 }else if( msg == "createLinks(QString)" ) 427 }else if( msg == "createLinks(QString)" )
428 { 428 {
429 ipkg->createLinks( QString(arg) ); 429 ipkg->createLinks( QString(arg) );
430 }else if( msg == "removeLinks(QString)" ) 430 }else if( msg == "removeLinks(QString)" )
431 { 431 {
432 ipkg->removeLinks( QString(arg) ); 432 ipkg->removeLinks( QString(arg) );
433 }else{ 433 }else{
434 pvDebug(2,"Huh what do ya want") 434 pvDebug(2,"Huh what do ya want")
435 } 435 }
436} 436}
437 437
438 438
439void MainWindow::createLinks() 439void MainWindow::createLinks()
440{ 440{
441 pvDebug(2,"creating links..."); 441 pvDebug(2,"creating links...");
442 ipkg->createLinks( settings->destinationurl->text() ); 442 ipkg->createLinks( settings->destinationurl->text() );
443} 443}
444 444
445void MainWindow::removeLinks() 445void MainWindow::removeLinks()
446{ 446{
447 pvDebug(2,"removing links..."); 447 pvDebug(2,"removing links...");
448 ipkg->removeLinks( settings->destinationurl->text() ); 448 ipkg->removeLinks( settings->destinationurl->text() );
449} 449}
450 450
451void MainWindow::remotePackageQuery() 451void MainWindow::remotePackageQuery()
452{ 452{
453 packageListSearch.query( searchEdit->text() ); 453 packageListSearch.query( searchEdit->text() );
454 packageListSearch.update(); 454 packageListSearch.update();
455 displayList(); 455 displayList();
456} 456}
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 8c5f0ea..bfb48b3 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -1,436 +1,436 @@
1#include "package.h" 1#include "package.h"
2 2
3#include <qpe/process.h> 3#include <qpe/process.h>
4#include <qpe/stringutil.h> 4#include <qpe/stringutil.h>
5#include <qfile.h> 5#include <qfile.h>
6#include <qtextstream.h> 6#include <qtextstream.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <unistd.h> 8#include <unistd.h>
9 9
10#include "debug.h" 10#include "debug.h"
11 11
12//Package::~Package() 12//Package::~Package()
13//{ 13//{
14//} 14//}
15 15
16Package::Package( PackageManagerSettings *s ) 16Package::Package( PackageManagerSettings *s )
17{ 17{
18 init(s); 18 init(s);
19} 19}
20 20
21void Package::init( PackageManagerSettings *s ) 21void Package::init( PackageManagerSettings *s )
22{ 22{
23 settings = s; 23 settings = s;
24 _size = ""; 24 _size = "";
25 _section = ""; 25 _section = "";
26 _subsection = ""; 26 _subsection = "";
27 _shortDesc = ""; 27 _shortDesc = "";
28 _desc = ""; 28 _desc = "";
29 _name = ""; 29 _name = "";
30 _toProcess = false; 30 _toProcess = false;
31 _useFileName = false; 31 _useFileName = false;
32 _old = false; 32 _old = false;
33 _status = ""; 33 _status = "";
34 _dest = settings->getDestinationName(); 34 _dest = settings->getDestinationName();
35 _link = settings->createLinks(); 35 _link = settings->createLinks();
36 _versions=0; 36 _versions=0;
37 _version=""; 37 _version="";
38} 38}
39 39
40Package::Package( QStringList pack, PackageManagerSettings *s ) 40Package::Package( QStringList pack, PackageManagerSettings *s )
41 { 41 {
42 init(s); 42 init(s);
43 parsePackage( pack ); 43 parsePackage( pack );
44} 44}
45 45
46Package::Package( QString n, PackageManagerSettings *s ) 46Package::Package( QString n, PackageManagerSettings *s )
47 { 47 {
48 init(s); 48 init(s);
49 if ( !QFile::exists( n ) ) 49 if ( !QFile::exists( n ) )
50 { 50 {
51 _name = QString( n ); 51 _name = QString( n );
52 }else{ 52 }else{
53 pvDebug(2,"remote file: "+n); 53 pvDebug(4,"remote file: "+n);
54 parseIpkgFile( n ); 54 parseIpkgFile( n );
55 _useFileName = true; 55 _useFileName = true;
56 _fileName = QString( n ); 56 _fileName = QString( n );
57 } 57 }
58} 58}
59 59
60Package::Package( Package *pi ) 60Package::Package( Package *pi )
61{ 61{
62 init(pi->settings); 62 init(pi->settings);
63 copyValues( pi ); 63 copyValues( pi );
64} 64}
65 65
66 66
67void Package::setValue( QString n, QString t ) 67void Package::setValue( QString n, QString t )
68{ 68{
69 if ( n == "Package" ) 69 if ( n == "Package" )
70 { 70 {
71 _name = QString( t ); 71 _name = QString( t );
72 }else if ( n == "Installed-Size" ) 72 }else if ( n == "Installed-Size" )
73 { 73 {
74 _size = t; 74 _size = t;
75// }else if ( n == "Priority") 75// }else if ( n == "Priority")
76// { 76// {
77 77
78 }else if ( n == "Section") 78 }else if ( n == "Section")
79 { 79 {
80 setSection( t ); 80 setSection( t );
81// }else if ( n == "Maintainer") 81// }else if ( n == "Maintainer")
82// { 82// {
83// 83//
84// }else if ( n == "Architecture") 84// }else if ( n == "Architecture")
85// { 85// {
86 86
87 }else if ( n == "Version") 87 }else if ( n == "Version")
88 { 88 {
89 _version = t; 89 _version = t;
90// }else if ( n == "Pre-Depends") 90// }else if ( n == "Pre-Depends")
91// { 91// {
92// 92//
93// }else if ( n == "Depends") 93// }else if ( n == "Depends")
94// { 94// {
95 95
96 }else if ( n == "Filename") 96 }else if ( n == "Filename")
97 { 97 {
98 _fileName = t; 98 _fileName = t;
99// }else if ( n == "Size") 99// }else if ( n == "Size")
100 // { 100 // {
101 // 101 //
102 //}else if ( n == "MD5Sum") 102 //}else if ( n == "MD5Sum")
103 //{ 103 //{
104 104
105 }else if ( n == "Description") 105 }else if ( n == "Description")
106 { 106 {
107 setDesc( t ); 107 setDesc( t );
108 }else if ( n == "Status") 108 }else if ( n == "Status")
109 { 109 {
110 if ( installed() ) return; 110 if ( installed() ) return;
111 _status = t; 111 _status = t;
112// }else if ( n == "Essential") 112// }else if ( n == "Essential")
113// { 113// {
114 114
115 }else{ 115 }else{
116 _values.insert(n,new QString(t)); 116 _values.insert(n,new QString(t));
117 } 117 }
118} 118}
119 119
120QString Package::name() 120QString Package::name()
121{ 121{
122 if (_displayName.isEmpty() ) return _name; 122 if (_displayName.isEmpty() ) return _name;
123 else return _displayName; 123 else return _displayName;
124} 124}
125 125
126 126
127QString Package::installName() 127QString Package::installName()
128{ 128{
129 if (_useFileName) return _fileName; 129 if (_useFileName) return _fileName;
130 else return _name; 130 else return _name;
131} 131}
132 132
133bool Package::installed() 133bool Package::installed()
134{ 134{
135 if (_status.contains("installed")) return true; 135 if (_status.contains("installed")) return true;
136 else 136 else
137 if (_versions) 137 if (_versions)
138 { 138 {
139 QDictIterator<Package> other( *_versions ); 139 QDictIterator<Package> other( *_versions );
140 while ( other.current() ) 140 while ( other.current() )
141 { 141 {
142 if (other.current()->status().contains("installed") 142 if (other.current()->status().contains("installed")
143 && other.current()->version() == version()) 143 && other.current()->version() == version())
144 return true; 144 return true;
145 ++other; 145 ++other;
146 } 146 }
147 } 147 }
148 return false; 148 return false;
149} 149}
150 150
151bool Package::otherInstalled() 151bool Package::otherInstalled()
152{ 152{
153 if (_versions) 153 if (_versions)
154 { 154 {
155 QDictIterator<Package> other( *_versions ); 155 QDictIterator<Package> other( *_versions );
156 while ( other.current() ) 156 while ( other.current() )
157 { 157 {
158 if (other.current()->installed()) return true; 158 if (other.current()->installed()) return true;
159 ++other; 159 ++other;
160 } 160 }
161 } 161 }
162 return false; 162 return false;
163} 163}
164 164
165void Package::setDesc( QString s ) 165void Package::setDesc( QString s )
166{ 166{
167 _desc = s; 167 _desc = s;
168 _shortDesc = s.left( s.find("\n") ); 168 _shortDesc = s.left( s.find("\n") );
169} 169}
170 170
171QString Package::desc() 171QString Package::desc()
172{ 172{
173 return _desc; 173 return _desc;
174} 174}
175 175
176QString Package::shortDesc() 176QString Package::shortDesc()
177{ 177{
178 return _shortDesc; 178 return _shortDesc;
179} 179}
180 180
181QString Package::size() 181QString Package::size()
182{ 182{
183 return _size; 183 return _size;
184} 184}
185 185
186 186
187QString Package::version() 187QString Package::version()
188{ 188{
189 return _version; 189 return _version;
190} 190}
191 191
192QString Package::sizeUnits() 192QString Package::sizeUnits()
193{ 193{
194 int i = _size.toInt(); 194 int i = _size.toInt();
195 int c = 0; 195 int c = 0;
196 QString ret; 196 QString ret;
197 QStringList unit; 197 QStringList unit;
198 unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;) 198 unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;)
199 while (i > 1) 199 while (i > 1)
200 { 200 {
201 ret=QString::number(i)+" "+unit[c]; 201 ret=QString::number(i)+" "+unit[c];
202 c++; 202 c++;
203 i /= 1024; 203 i /= 1024;
204 } 204 }
205 return ret; 205 return ret;
206} 206}
207 207
208bool Package::toProcess() 208bool Package::toProcess()
209{ 209{
210 return _toProcess; 210 return _toProcess;
211} 211}
212 212
213bool Package::toRemove() 213bool Package::toRemove()
214{ 214{
215 if ( _toProcess && installed() ) return true; 215 if ( _toProcess && installed() ) return true;
216 else return false; 216 else return false;
217} 217}
218 218
219bool Package::toInstall() 219bool Package::toInstall()
220{ 220{
221 if ( _toProcess && !installed() ) return true; 221 if ( _toProcess && !installed() ) return true;
222 else return false; 222 else return false;
223} 223}
224 224
225void Package::toggleProcess() 225void Package::toggleProcess()
226{ 226{
227 _toProcess = ! _toProcess; 227 _toProcess = ! _toProcess;
228} 228}
229 229
230 230
231 231
232void Package::copyValues( Package* pack ) 232void Package::copyValues( Package* pack )
233{ 233{
234 if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size ); 234 if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size );
235 if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section ); 235 if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section );
236 if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection ); 236 if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection );
237 if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc ); 237 if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc );
238 if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc ); 238 if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc );
239 if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name ); 239 if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name );
240 if (_dest.isEmpty() && !pack->_dest.isEmpty()) _dest= QString( pack->_dest ); 240 if (_dest.isEmpty() && !pack->_dest.isEmpty()) _dest= QString( pack->_dest );
241 if (_displayName.isEmpty()&& !pack->_displayName.isEmpty()) _displayName = QString( pack->_displayName ); 241 if (_displayName.isEmpty()&& !pack->_displayName.isEmpty()) _displayName = QString( pack->_displayName );
242 if (_fileName.isEmpty() && !pack->_fileName.isEmpty()) _fileName = QString( pack->_fileName ); 242 if (_fileName.isEmpty() && !pack->_fileName.isEmpty()) _fileName = QString( pack->_fileName );
243 if (_version.isEmpty() && !pack->_version.isEmpty()) _version = QString( pack->_version ); 243 if (_version.isEmpty() && !pack->_version.isEmpty()) _version = QString( pack->_version );
244 if (_values.isEmpty() && !pack->_values.isEmpty())_values = QDict<QString>( pack->_values ); 244 if (_values.isEmpty() && !pack->_values.isEmpty())_values = QDict<QString>( pack->_values );
245 if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); 245 if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status );
246} 246}
247 247
248QString Package::section() 248QString Package::section()
249{ 249{
250 return _section; 250 return _section;
251} 251}
252 252
253void Package::setSection( QString s) 253void Package::setSection( QString s)
254{ 254{
255 int i = s.find("/"); 255 int i = s.find("/");
256 if ( i > 0 ) 256 if ( i > 0 )
257 { 257 {
258 _section = s.left(i); 258 _section = s.left(i);
259 _subsection = s.mid(i+1); 259 _subsection = s.mid(i+1);
260 }else{ 260 }else{
261 _section = s; 261 _section = s;
262 _subsection = ""; 262 _subsection = "";
263 } 263 }
264} 264}
265 265
266QString Package::subSection() 266QString Package::subSection()
267{ 267{
268 return _subsection; 268 return _subsection;
269} 269}
270 270
271void Package::parsePackage( QStringList pack ) 271void Package::parsePackage( QStringList pack )
272{ 272{
273 if ( pack.isEmpty() ) return; 273 if ( pack.isEmpty() ) return;
274 int count = pack.count(); 274 int count = pack.count();
275 for( int i = 0; i < count; i++ ) 275 for( int i = 0; i < count; i++ )
276 { 276 {
277 QString line = pack[i]; 277 QString line = pack[i];
278 int sep = line.find( QRegExp(":[\t ]+") ); 278 int sep = line.find( QRegExp(":[\t ]+") );
279 if ( sep >= 0 ) 279 if ( sep >= 0 )
280 { 280 {
281 QString tag = line.left(sep); 281 QString tag = line.left(sep);
282 QString value = line.mid(sep+2).simplifyWhiteSpace(); 282 QString value = line.mid(sep+2).simplifyWhiteSpace();
283 setValue( tag, value ); 283 setValue( tag, value );
284 }else{ 284 }else{
285 } 285 }
286 } 286 }
287 return; 287 return;
288} 288}
289 289
290QString Package::details() 290QString Package::details()
291{ 291{
292 QString status; 292 QString status;
293 Process ipkg_status(QStringList() << "ipkg" << "info" << name() ); 293 Process ipkg_status(QStringList() << "ipkg" << "info" << name() );
294 QString description; 294 QString description;
295 if ( ipkg_status.exec("",status) ) 295 if ( ipkg_status.exec("",status) )
296 { 296 {
297 QStringList lines = QStringList::split('\n',status,TRUE); 297 QStringList lines = QStringList::split('\n',status,TRUE);
298 for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) { 298 for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) {
299 QString line = *it; 299 QString line = *it;
300 if ( line == " ." ) 300 if ( line == " ." )
301 { 301 {
302 description.append("<p>"); 302 description.append("<p>");
303 } else 303 } else
304 if ( line[0] == ' ' || line[0] == '\t' ) 304 if ( line[0] == ' ' || line[0] == '\t' )
305 { 305 {
306 // continuation 306 // continuation
307 description.append(" "); 307 description.append(" ");
308 description.append(Qtopia::escapeString(line)); 308 description.append(Qtopia::escapeString(line));
309 } else { 309 } else {
310 int sep = line.find(QRegExp(":[\t ]+")); 310 int sep = line.find(QRegExp(":[\t ]+"));
311 if ( sep >= 0 ) 311 if ( sep >= 0 )
312 { 312 {
313 QString tag = line.left(sep); 313 QString tag = line.left(sep);
314 description.append("<br>"); 314 description.append("<br>");
315 description.append("<b>"); 315 description.append("<b>");
316 description.append(Qtopia::escapeString(tag)); 316 description.append(Qtopia::escapeString(tag));
317 description.append(":</b> "); 317 description.append(":</b> ");
318 description.append(Qtopia::escapeString(line.mid(sep+2))); 318 description.append(Qtopia::escapeString(line.mid(sep+2)));
319 } else { 319 } else {
320 description.append(" "); 320 description.append(" ");
321 description.append(Qtopia::escapeString(line)); 321 description.append(Qtopia::escapeString(line));
322 } 322 }
323 } 323 }
324 } 324 }
325 } 325 }
326 return description; 326 return description;
327} 327}
328 328
329void Package::processed() 329void Package::processed()
330{ 330{
331 _toProcess = false; 331 _toProcess = false;
332 //hack, but we're not writing status anyway... 332 //hack, but we're not writing status anyway...
333 if ( installed() ) _status = "install"; 333 if ( installed() ) _status = "install";
334 else _status = "installed"; 334 else _status = "installed";
335} 335}
336 336
337QString Package::dest() 337QString Package::dest()
338{ 338{
339 if ( installed()||(!installed() && _toProcess) ) 339 if ( installed()||(!installed() && _toProcess) )
340 return _dest!=""?_dest:settings->getDestinationName(); 340 return _dest!=""?_dest:settings->getDestinationName();
341 else return ""; 341 else return "";
342} 342}
343 343
344void Package::setDest( QString d ) 344void Package::setDest( QString d )
345{ 345{
346 if ( d == "remote") _useFileName = true; 346 if ( d == "remote") _useFileName = true;
347 else _dest = d; 347 else _dest = d;
348} 348}
349 349
350void Package::setOn() 350void Package::setOn()
351{ 351{
352 _toProcess = true; 352 _toProcess = true;
353} 353}
354 354
355bool Package::link() 355bool Package::link()
356{ 356{
357 if ( _dest == "root" || (!installed() && !_toProcess) ) return false; 357 if ( _dest == "root" || (!installed() && !_toProcess) ) return false;
358 return _link; 358 return _link;
359} 359}
360 360
361void Package::setLink(bool b) 361void Package::setLink(bool b)
362{ 362{
363 _link = b; 363 _link = b;
364} 364}
365 365
366void Package::parseIpkgFile( QString file) 366void Package::parseIpkgFile( QString file)
367{ 367{
368 system("tar xzf "+file+" -C /tmp"); 368 system("tar xzf "+file+" -C /tmp");
369 system("tar xzf /tmp/control.tar.gz -C /tmp"); 369 system("tar xzf /tmp/control.tar.gz -C /tmp");
370 QFile f("/tmp/control"); 370 QFile f("/tmp/control");
371 if ( f.open(IO_ReadOnly) ) 371 if ( f.open(IO_ReadOnly) )
372 { 372 {
373 QTextStream t( &f ); 373 QTextStream t( &f );
374 QStringList pack; 374 QStringList pack;
375 while ( !t.eof() ) 375 while ( !t.eof() )
376 { 376 {
377 pack << t.readLine(); 377 pack << t.readLine();
378 } 378 }
379 f.close(); 379 f.close();
380 parsePackage( pack ); 380 parsePackage( pack );
381 } 381 }
382 382
383} 383}
384 384
385//QString Package::getPackageName() 385//QString Package::getPackageName()
386//{ 386//{
387 //if ( _packageName.isEmpty() ) return _name; 387 //if ( _packageName.isEmpty() ) return _name;
388 //else return _packageName; 388 //else return _packageName;
389//} 389//}
390 390
391void Package::instalFromFile(bool iff) 391void Package::instalFromFile(bool iff)
392{ 392{
393 _useFileName = iff; 393 _useFileName = iff;
394} 394}
395 395
396void Package::setName(QString n) 396void Package::setName(QString n)
397{ 397{
398 _displayName = n; 398 _displayName = n;
399} 399}
400 400
401QDict<QString>* Package::getFields() 401QDict<QString>* Package::getFields()
402{ 402{
403 return &_values; 403 return &_values;
404} 404}
405 405
406QString Package::status() 406QString Package::status()
407{ 407{
408 return _status; 408 return _status;
409} 409}
410 410
411bool Package::isOld() 411bool Package::isOld()
412{ 412{
413 if (!_versions) return false; 413 if (!_versions) return false;
414 QDictIterator<Package> other( *_versions ); 414 QDictIterator<Package> other( *_versions );
415 while ( other.current() ) { 415 while ( other.current() ) {
416 if (other.current()->version() > version() ) return true; 416 if (other.current()->version() > version() ) return true;
417 ++other; 417 ++other;
418 } 418 }
419 return false; 419 return false;
420} 420}
421 421
422bool Package::hasVersions() 422bool Package::hasVersions()
423{ 423{
424 if (!_versions) return false; 424 if (!_versions) return false;
425 else return true; 425 else return true;
426} 426}
427 427
428QDict<Package>* Package::getOtherVersions() 428QDict<Package>* Package::getOtherVersions()
429{ 429{
430 return _versions; 430 return _versions;
431} 431}
432 432
433void Package::setOtherVersions(QDict<Package> *v) 433void Package::setOtherVersions(QDict<Package> *v)
434{ 434{
435 _versions=v; 435 _versions=v;
436} 436}
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 30777c2..0fa4c61 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -1,397 +1,398 @@
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 && 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 qApp->processEvents();
91 } 91 }
92 pclose(fp); 92 pclose(fp);
93 } 93 }
94 //out( "Finished!"); 94 //out( "Finished!");
95 pvDebug(2,QString(ret?"success\n":"failure\n")); 95 pvDebug(2,QString(ret?"success\n":"failure\n"));
96 return ret; 96 return ret;
97} 97}
98 98
99void PmIpkg::makeLinks(Package *pack) 99void PmIpkg::makeLinks(Package *pack)
100{ 100{
101 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); 101 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
102 linkPackage( pack->name(), pack->dest() ); 102 linkPackage( pack->name(), pack->dest() );
103} 103}
104 104
105QStringList* PmIpkg::getList( QString packFileName, QString d ) 105QStringList* PmIpkg::getList( QString packFileName, QString d )
106{ 106{
107 QString dest = settings->getDestinationUrlByName( d ); 107 QString dest = settings->getDestinationUrlByName( d );
108 dest = dest==""?d:dest; 108 dest = dest==""?d:dest;
109 if (dest == "/" ) return 0; 109 if (dest == "/" ) return 0;
110 { 110 {
111 Config cfg( "oipkg", Config::User ); 111 Config cfg( "oipkg", Config::User );
112 cfg.setGroup( "Common" ); 112 cfg.setGroup( "Common" );
113 QString statusDir = cfg.readEntry( "statusDir", "" ); 113 QString statusDir = cfg.readEntry( "statusDir", "" );
114 } 114 }
115 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; 115 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list";
116 QFile f( packFileName ); 116 QFile f( packFileName );
117 if ( ! f.open(IO_ReadOnly) ) 117 if ( ! f.open(IO_ReadOnly) )
118 { 118 {
119 pvDebug(1," Panik! Could not open"); 119 pvDebug(1," Panik! Could not open");
120 out( "Panik!\n Could not open:\n"+packFileName ); 120 out( "Panik!\n Could not open:\n"+packFileName );
121 return (QStringList*)0; 121 return (QStringList*)0;
122 } 122 }
123 QStringList *fileList = new QStringList(); 123 QStringList *fileList = new QStringList();
124 QTextStream t( &f ); 124 QTextStream t( &f );
125 while ( !t.eof() ) 125 while ( !t.eof() )
126 { 126 {
127 *fileList += t.readLine(); 127 *fileList += t.readLine();
128 } 128 }
129 return fileList; 129 return fileList;
130} 130}
131 131
132void PmIpkg::linkPackage( QString packFileName, QString dest ) 132void PmIpkg::linkPackage( QString packFileName, QString dest )
133{ 133{
134 QStringList *fileList = getList( packFileName, dest ); 134 QStringList *fileList = getList( packFileName, dest );
135 processFileList( fileList, dest ); 135 processFileList( fileList, dest );
136 delete fileList; 136 delete fileList;
137} 137}
138 138
139void PmIpkg::processFileList( QStringList *fileList, QString d ) 139void PmIpkg::processFileList( QStringList *fileList, QString d )
140{ 140{
141 if (!fileList) return; 141 if (!fileList) return;
142 for (uint i=0; i < fileList->count(); i++) 142 for (uint i=0; i < fileList->count(); i++)
143 { 143 {
144 QString dest = settings->getDestinationUrlByName( d ); 144 QString dest = settings->getDestinationUrlByName( d );
145 dest = dest==""?d:dest; 145 dest = dest==""?d:dest;
146 processLinkDir( (*fileList)[i], dest ); 146 processLinkDir( (*fileList)[i], dest );
147 } 147 }
148} 148}
149 149
150 150
151void PmIpkg::processLinkDir( QString file, QString dest ) 151void PmIpkg::processLinkDir( QString file, QString dest )
152{ 152{
153 pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); 153 pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest);
154 if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); 154 if (linkOpp==createLink) pvDebug( 4,"opp: createLink");
155 if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); 155 if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink");
156 if ( dest == "???" || dest == "" ) return; 156 if ( dest == "???" || dest == "" ) return;
157 QString destFile = file; 157 QString destFile = file;
158 file = dest+"/"+file; 158 file = dest+"/"+file;
159 if (file == dest) return; 159 if (file == dest) return;
160// if (linkOpp==createLink) out( "\ncreating links\n" ); 160// if (linkOpp==createLink) out( "\ncreating links\n" );
161 // if (linkOpp==removeLink) out( "\nremoving links\n" ); 161 // if (linkOpp==removeLink) out( "\nremoving links\n" );
162 QFileInfo fileInfo( file ); 162 QFileInfo fileInfo( file );
163 if ( fileInfo.isDir() ) 163 if ( fileInfo.isDir() )
164 { 164 {
165 pvDebug(4, "process dir "+file); 165 pvDebug(4, "process dir "+file);
166 QDir destDir( destFile ); 166 QDir destDir( destFile );
167 if (linkOpp==createLink) destDir.mkdir( destFile, true ); 167 if (linkOpp==createLink) destDir.mkdir( destFile, true );
168 QDir d( file ); 168 QDir d( file );
169// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); 169// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
170 const QFileInfoList *list = d.entryInfoList(); 170 const QFileInfoList *list = d.entryInfoList();
171 QFileInfoListIterator it( *list ); 171 QFileInfoListIterator it( *list );
172 QFileInfo *fi; 172 QFileInfo *fi;
173 while ( (fi=it.current()) ) 173 while ( (fi=it.current()) )
174 { 174 {
175 pvDebug(4, "processLinkDir "+fi->absFilePath()); 175 pvDebug(4, "processLinkDir "+fi->absFilePath());
176 processLinkDir( fi->absFilePath(), dest ); 176 processLinkDir( fi->absFilePath(), dest );
177 ++it; 177 ++it;
178 } 178 }
179 } else 179 } else
180 if ( fileInfo.isFile() ) 180 if ( fileInfo.isFile() )
181 { 181 {
182 const char *instFile = strdup( (file).ascii() ); 182 const char *instFile = strdup( (file).ascii() );
183 const char *linkFile = strdup( (destFile).ascii()); 183 const char *linkFile = strdup( (destFile).ascii());
184 if( linkOpp==createLink ) 184 if( linkOpp==createLink )
185 { 185 {
186 pvDebug(4, "linking: "+file+" -> "+destFile ); 186 pvDebug(4, "linking: "+file+" -> "+destFile );
187 symlink( instFile, linkFile ); 187 symlink( instFile, linkFile );
188 } 188 }
189 } else { 189 } else {
190 const char *linkFile = strdup( (destFile).ascii()); 190 const char *linkFile = strdup( (destFile).ascii());
191 if( linkOpp==removeLink ) 191 if( linkOpp==removeLink )
192 { 192 {
193 QFileInfo toRemoveLink( destFile ); 193 QFileInfo toRemoveLink( destFile );
194 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) 194 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
195 { 195 {
196 pvDebug(4,"removing "+destFile+" no "+file); 196 pvDebug(4,"removing "+destFile+" no "+file);
197 unlink( linkFile ); 197 unlink( linkFile );
198 } 198 }
199 } 199 }
200 } 200 }
201} 201}
202 202
203void PmIpkg::loadList( PackageList *pl ) 203void PmIpkg::loadList( PackageList *pl )
204 { 204 {
205 for( Package *pack = pl->first();pack ; (pack = pl->next()) ) 205 for( Package *pack = pl->first();pack ; (pack = pl->next()) )
206 { 206 {
207 if ( pack && (pack->name() != "") && pack) 207 if ( pack && (pack->name() != "") && pack)
208 { 208 {
209 if ( pack->toInstall() ) 209 if ( pack->toInstall() )
210 to_install.append( pack ); 210 to_install.append( pack );
211 if ( pack->toRemove() ) 211 if ( pack->toRemove() )
212 to_remove.append( pack ); 212 to_remove.append( pack );
213 } 213 }
214 } 214 }
215} 215}
216 216
217void PmIpkg::commit() 217void PmIpkg::commit()
218 { 218 {
219 int sizecount = 0; 219 int sizecount = 0;
220 installDialog = new InstallDialog(settings,0,0,true); 220 installDialog = new InstallDialog(settings,0,0,true);
221 installDialog->toRemoveItem->setOpen( true ); 221 installDialog->toRemoveItem->setOpen( true );
222 installDialog->toInstallItem->setOpen( true ); 222 installDialog->toInstallItem->setOpen( true );
223 for (uint i=0; i < to_remove.count(); i++) 223 for (uint i=0; i < to_remove.count(); i++)
224 { 224 {
225 sizecount += 1; 225 sizecount += 1;
226 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) );
227 } 227 }
228 for (uint i=0; i < to_install.count(); i++) 228 for (uint i=0; i < to_install.count(); i++)
229 { 229 {
230 sizecount += to_install.at(i)->size().toInt(); 230 sizecount += to_install.at(i)->size().toInt();
231 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) );
232 } 232 }
233 runwindow->progress->setTotalSteps(sizecount); 233 runwindow->progress->setTotalSteps(sizecount);
234 qDebug("Install size %i",sizecount); 234 qDebug("Install size %i",sizecount);
235 installDialog->showMaximized(); 235 installDialog->showMaximized();
236 installDialog->show(); 236 installDialog->show();
237 if ( installDialog->exec() ) 237 if ( installDialog->exec() )
238 { 238 {
239 doIt(); 239 doIt();
240 runwindow->showMaximized(); 240 runwindow->showMaximized();
241 runwindow->show(); 241 runwindow->show();
242 } 242 }
243 installDialog->close(); 243 installDialog->close();
244 delete installDialog; 244 delete installDialog;
245 out(tr("\nAll done.")); 245 out(tr("\nAll done."));
246} 246}
247 247
248void PmIpkg::doIt() 248void PmIpkg::doIt()
249{ 249{
250 runwindow->progress->setProgress(0); 250 runwindow->progress->setProgress(0);
251 show(); 251 show();
252 remove(); 252 remove();
253 install(); 253 install();
254} 254}
255 255
256 256
257void PmIpkg::remove() 257void PmIpkg::remove()
258{ 258{
259 if ( to_remove.count() == 0 ) return; 259 if ( to_remove.count() == 0 ) return;
260 260
261 out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); 261 out(tr("Removing")+"\n"+tr("please wait")+"\n\n");
262 262
263 QStringList *fileList; 263 QStringList *fileList;
264 for (uint i=0; i < to_remove.count(); i++) 264 for (uint i=0; i < to_remove.count(); i++)
265 { 265 {
266 if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); 266 if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() );
267 if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) 267 if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() ))
268 { 268 {
269 runwindow->progress->setProgress( 1 ); 269 runwindow->progress->setProgress( 1 );
270 linkOpp = removeLink; 270 linkOpp = removeLink;
271 to_remove.at(i)->processed(); 271 to_remove.at(i)->processed();
272 pvDebug(3,"link "+QString::number(i)); 272 pvDebug(3,"link "+QString::number(i));
273 if ( to_remove.at(i)->link() ) 273 if ( to_remove.at(i)->link() )
274 processFileList( fileList, to_remove.at(i)->dest() ); 274 processFileList( fileList, to_remove.at(i)->dest() );
275 //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); 275 //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count()));
276 //if ( to_remove.at(i) ) to_remove.take( i ); 276 //if ( to_remove.at(i) ) to_remove.take( i );
277 277
278 out("\n"); 278 out("\n");
279 }else{ 279 }else{
280 out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); 280 out(tr("Error while removing ")+to_remove.at(i)->name()+"\n");
281 if ( to_remove.at(i)->link() ) 281 if ( to_remove.at(i)->link() )
282 processFileList( fileList, to_remove.at(i)->dest() ); 282 processFileList( fileList, to_remove.at(i)->dest() );
283 } 283 }
284 if ( to_remove.at(i)->link() ) 284 if ( to_remove.at(i)->link() )
285 processFileList( fileList, to_remove.at(i)->dest() ); 285 processFileList( fileList, to_remove.at(i)->dest() );
286 if ( to_remove.at(i)->link() )delete fileList; 286 if ( to_remove.at(i)->link() )delete fileList;
287 } 287 }
288 to_remove.clear(); 288 to_remove.clear();
289 out("\n"); 289 out("\n");
290} 290}
291 291
292 292
293void PmIpkg::install() 293void PmIpkg::install()
294{ 294{
295 if ( to_install.count() == 0 ) return; 295 if ( to_install.count() == 0 ) return;
296 out(tr("Installing")+"\n"+tr("please wait")+"\n"); 296 out(tr("Installing")+"\n"+tr("please wait")+"\n");
297 for (uint i=0; i < to_install.count(); i++) 297 for (uint i=0; i < to_install.count(); i++)
298 { 298 {
299 qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug 299 qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug
300 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) 300 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ))
301 { 301 {
302 runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); 302 runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress());
303 to_install.at(i)->processed(); 303 to_install.at(i)->processed();
304 linkOpp = createLink; 304 linkOpp = createLink;
305 if ( to_install.at(i)->link() ) 305 if ( to_install.at(i)->link() )
306 makeLinks( to_install.at(i) ); 306 makeLinks( to_install.at(i) );
307 // to_install.take( i ); 307 // to_install.take( i );
308 out("\n"); 308 out("\n");
309 }else{ 309 }else{
310 out(tr("Error while installing")+to_install.at(i)->name()+"\n"); 310 out(tr("Error while installing")+to_install.at(i)->name()+"\n");
311 linkOpp = createLink; 311 linkOpp = createLink;
312 if ( to_install.at(i)->link() ) 312 if ( to_install.at(i)->link() )
313 makeLinks( to_install.at(i) ); 313 makeLinks( to_install.at(i) );
314 } 314 }
315 } 315 }
316 out("\n"); 316 out("\n");
317 to_install.clear(); 317 to_install.clear();
318} 318}
319 319
320void PmIpkg::createLinks( const QString &dest ) 320void PmIpkg::createLinks( const QString &dest )
321{ 321{
322 pvDebug(2,"PmIpkg::createLinks "+dest); 322 pvDebug(2,"PmIpkg::createLinks "+dest);
323 linkOpp=createLink; 323 linkOpp=createLink;
324 QString url = settings->getDestinationUrlByName( dest ); 324 QString url = settings->getDestinationUrlByName( dest );
325 url = url==""?dest:url; 325 url = url==""?dest:url;
326 processLinkDir( "/opt", url ); 326 processLinkDir( "/opt", url );
327 processLinkDir( "/usr", url ); 327 processLinkDir( "/usr", url );
328} 328}
329 329
330void PmIpkg::removeLinks( const QString &dest ) 330void PmIpkg::removeLinks( const QString &dest )
331{ 331{
332 pvDebug(2,"PmIpkg::removeLinks "+dest); 332 pvDebug(2,"PmIpkg::removeLinks "+dest);
333 linkOpp=removeLink; 333 linkOpp=removeLink;
334 QString url = settings->getDestinationUrlByName( dest ); 334 QString url = settings->getDestinationUrlByName( dest );
335 url = url==""?dest:url; 335 url = url==""?dest:url;
336 processLinkDir( "/opt", url ); 336 processLinkDir( "/opt", url );
337 processLinkDir( "/usr", url ); 337 processLinkDir( "/usr", url );
338} 338}
339 339
340void PmIpkg::update() 340void PmIpkg::update()
341{ 341{
342 show(); 342 show();
343 runIpkg( "update" ); 343 if ( runIpkg( "update" ) )
344 runwindow->close(); 344 runwindow->close();
345 else out("An error occurred!\nPlease check the log.");
345} 346}
346 347
347void PmIpkg::out( QString o ) 348void PmIpkg::out( QString o )
348{ 349{
349 runwindow->outPut->append(o); 350 runwindow->outPut->append(o);
350 runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); 351 runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE);
351} 352}
352 353
353 354
354 355
355 356
356void PmIpkg::show() 357void PmIpkg::show()
357{ 358{
358 if (!runwindow->isVisible()) 359 if (!runwindow->isVisible())
359 { 360 {
360 runwindow->showMaximized(); 361 runwindow->showMaximized();
361 runwindow->show(); 362 runwindow->show();
362 } 363 }
363 runwindow->outPut->setText(""); 364 runwindow->outPut->setText("");
364} 365}
365 366
366void PmIpkg::installFile(const QString &fileName, const QString &dest) 367void PmIpkg::installFile(const QString &fileName, const QString &dest)
367{ 368{
368 369
369 to_install.clear(); 370 to_install.clear();
370 to_remove.clear(); 371 to_remove.clear();
371 pvDebug( 2,"PmIpkg::installFile "+ fileName); 372 pvDebug( 2,"PmIpkg::installFile "+ fileName);
372 Package *p = new Package(fileName,settings); 373 Package *p = new Package(fileName,settings);
373 if ( dest!="") p->setDest( dest ); 374 if ( dest!="") p->setDest( dest );
374 to_install.append( p ); 375 to_install.append( p );
375 commit(); 376 commit();
376 delete p; 377 delete p;
377} 378}
378 379
379void PmIpkg::removeFile(const QString &fileName, const QString &dest) 380void PmIpkg::removeFile(const QString &fileName, const QString &dest)
380{ 381{
381 382
382 to_install.clear(); 383 to_install.clear();
383 to_remove.clear(); 384 to_remove.clear();
384 pvDebug( 2,"PmIpkg::removeFile "+ fileName); 385 pvDebug( 2,"PmIpkg::removeFile "+ fileName);
385 Package *p = new Package(fileName,settings); 386 Package *p = new Package(fileName,settings);
386 if ( dest!="") p->setDest( dest ); 387 if ( dest!="") p->setDest( dest );
387 to_remove.append( p ); 388 to_remove.append( p );
388 commit(); 389 commit();
389 delete p; 390 delete p;
390} 391}
391 392
392 393
393void PmIpkg::clearLists() 394void PmIpkg::clearLists()
394{ 395{
395 to_remove.clear(); 396 to_remove.clear();
396 to_install.clear(); 397 to_install.clear();
397} 398}