summaryrefslogtreecommitdiff
authortille <tille>2002-05-12 12:49:58 (UTC)
committer tille <tille>2002-05-12 12:49:58 (UTC)
commit98229e01acc37562671b546a8aa955415a0f5843 (patch) (unidiff)
tree5e08cfe4b8526591d636c8e7ada5374ecc29a828
parentc1cc5edca5d6d71350f841892fb7828f7be9ed9f (diff)
downloadopie-98229e01acc37562671b546a8aa955415a0f5843.zip
opie-98229e01acc37562671b546a8aa955415a0f5843.tar.gz
opie-98229e01acc37562671b546a8aa955415a0f5843.tar.bz2
fixed install/remove segfault
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp19
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h1
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp22
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h2
4 files changed, 17 insertions, 27 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index a23c900..1c56aae 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -133,361 +133,348 @@ void MainWindow::makeMenu()
133 QString::null, 0, this, 0 ); 133 QString::null, 0, this, 0 );
134 connect( cfgact, SIGNAL( activated() ), 134 connect( cfgact, SIGNAL( activated() ),
135 SLOT( showSettingsDst() ) ); 135 SLOT( showSettingsDst() ) );
136 cfgact->addTo( cfgMenu ); 136 cfgact->addTo( cfgMenu );
137 137
138 QAction *a; 138 QAction *a;
139 139
140 // SECTIONS 140 // SECTIONS
141 sectionBar = new QPEToolBar( this ); 141 sectionBar = new QPEToolBar( this );
142 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); 142 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE );
143 sectionBar->setHorizontalStretchable( true ); 143 sectionBar->setHorizontalStretchable( true );
144 QLabel *label = new QLabel( tr("Section: "), sectionBar ); 144 QLabel *label = new QLabel( tr("Section: "), sectionBar );
145 label->setBackgroundColor( sectionBar->backgroundColor() ); 145 label->setBackgroundColor( sectionBar->backgroundColor() );
146 sectionBar->setStretchableWidget( label ); 146 sectionBar->setStretchableWidget( label );
147 section = new QComboBox( false, sectionBar ); 147 section = new QComboBox( false, sectionBar );
148 label = new QLabel( " / ", sectionBar ); 148 label = new QLabel( " / ", sectionBar );
149 label->setBackgroundColor( sectionBar->backgroundColor() ); 149 label->setBackgroundColor( sectionBar->backgroundColor() );
150 subsection = new QComboBox( false, sectionBar ); 150 subsection = new QComboBox( false, sectionBar );
151 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 151 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
152 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); 152 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
153 a->addTo( sectionBar ); 153 a->addTo( sectionBar );
154 setSections(); 154 setSections();
155 setSubSections(); 155 setSubSections();
156 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); 156 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
157 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); 157 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
158 sectionAction->setToggleAction( true ); 158 sectionAction->setToggleAction( true );
159 sectionAction->addTo( viewMenu ); 159 sectionAction->addTo( viewMenu );
160 160
161 //FIND 161 //FIND
162 findBar = new QPEToolBar(this); 162 findBar = new QPEToolBar(this);
163 addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); 163 addToolBar( findBar, "Filter", QMainWindow::Top, TRUE );
164 label = new QLabel( tr("Filter: "), findBar ); 164 label = new QLabel( tr("Filter: "), findBar );
165 label->setBackgroundColor( findBar->backgroundColor() ); 165 label->setBackgroundColor( findBar->backgroundColor() );
166 findBar->setHorizontalStretchable( TRUE ); 166 findBar->setHorizontalStretchable( TRUE );
167 findEdit = new QLineEdit( findBar, "findEdit" ); 167 findEdit = new QLineEdit( findBar, "findEdit" );
168 findBar->setStretchableWidget( findEdit ); 168 findBar->setStretchableWidget( findEdit );
169 connect( findEdit, SIGNAL( textChanged( const QString & ) ), 169 connect( findEdit, SIGNAL( textChanged( const QString & ) ),
170 this, SLOT( displayList() ) ); 170 this, SLOT( displayList() ) );
171 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 );
172 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); 172 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) );
173 a->addTo( findBar ); 173 a->addTo( findBar );
174 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 );
175 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 175 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
176 a->addTo( findBar ); 176 a->addTo( findBar );
177 findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); 177 findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 );
178 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); 178 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
179 findAction->setToggleAction( true ); 179 findAction->setToggleAction( true );
180 findAction->addTo( viewMenu ); 180 findAction->addTo( viewMenu );
181 181
182 //SEARCH 182 //SEARCH
183 searchBar = new QPEToolBar(this); 183 searchBar = new QPEToolBar(this);
184 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 184 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
185 label = new QLabel( tr("ipkgfind: "), searchBar ); 185 label = new QLabel( tr("ipkgfind: "), searchBar );
186 label->setBackgroundColor( searchBar->backgroundColor() ); 186 label->setBackgroundColor( searchBar->backgroundColor() );
187 searchBar->setHorizontalStretchable( TRUE ); 187 searchBar->setHorizontalStretchable( TRUE );
188 searchEdit = new QLineEdit( searchBar, "seachEdit" ); 188 searchEdit = new QLineEdit( searchBar, "seachEdit" );
189 searchBar->setStretchableWidget( searchEdit ); 189 searchBar->setStretchableWidget( searchEdit );
190// connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 190// connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
191// this, SLOT( displayList() ) ); 191// this, SLOT( displayList() ) );
192 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 );
193 connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); 193 connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) );
194 a->addTo( searchBar ); 194 a->addTo( searchBar );
195 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 );
196 connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); 196 connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) );
197 searchCommit->addTo( searchBar ); 197 searchCommit->addTo( searchBar );
198 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 );
199 connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); 199 connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) );
200 a->addTo( searchBar ); 200 a->addTo( searchBar );
201 searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); 201 searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 );
202 connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); 202 connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) );
203 searchAction->setToggleAction( true ); 203 searchAction->setToggleAction( true );
204 searchAction->addTo( viewMenu ); 204 searchAction->addTo( viewMenu );
205 205
206 //DEST 206 //DEST
207 destBar = new QPEToolBar(this); 207 destBar = new QPEToolBar(this);
208 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); 208 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE );
209 label = new QLabel( tr("Destination: "), destBar ); 209 label = new QLabel( tr("Destination: "), destBar );
210 label->setBackgroundColor( destBar->backgroundColor() ); 210 label->setBackgroundColor( destBar->backgroundColor() );
211 destBar->setHorizontalStretchable( TRUE ); 211 destBar->setHorizontalStretchable( TRUE );
212 destination = new QComboBox( false, destBar ); 212 destination = new QComboBox( false, destBar );
213 destination->insertStringList( settings->getDestinationNames() ); 213 destination->insertStringList( settings->getDestinationNames() );
214 setComboName(destination,settings->getDestinationName()); 214 setComboName(destination,settings->getDestinationName());
215 connect( destination, SIGNAL(activated(int)), 215 connect( destination, SIGNAL(activated(int)),
216 settings, SLOT(activeDestinationChange(int)) ); 216 settings, SLOT(activeDestinationChange(int)) );
217 spacer = new QLabel( " ", destBar ); 217 spacer = new QLabel( " ", destBar );
218 spacer->setBackgroundColor( destBar->backgroundColor() ); 218 spacer->setBackgroundColor( destBar->backgroundColor() );
219 CheckBoxLink = new QCheckBox( tr("Link"), destBar); 219 CheckBoxLink = new QCheckBox( tr("Link"), destBar);
220 CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); 220 CheckBoxLink->setBackgroundColor( destBar->backgroundColor() );
221 CheckBoxLink->setChecked( settings->createLinks() ); 221 CheckBoxLink->setChecked( settings->createLinks() );
222 connect( CheckBoxLink, SIGNAL(toggled(bool)), 222 connect( CheckBoxLink, SIGNAL(toggled(bool)),
223 settings, SLOT(linkEnabled(bool)) ); 223 settings, SLOT(linkEnabled(bool)) );
224 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); 224 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 );
225 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); 225 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) );
226 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 );
227 connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); 227 connect( a, SIGNAL( activated() ), SLOT( destClose() ) );
228 a->addTo( destBar ); 228 a->addTo( destBar );
229 destBar->setStretchableWidget( CheckBoxLink ); 229 destBar->setStretchableWidget( CheckBoxLink );
230 destAction->setToggleAction( true ); 230 destAction->setToggleAction( true );
231 // destAction->addTo( viewMenu ); 231 // destAction->addTo( viewMenu );
232 232
233 // configure the menus 233 // configure the menus
234 Config cfg( "oipkg", Config::User ); 234 Config cfg( "oipkg", Config::User );
235 cfg.setGroup( "gui" ); 235 cfg.setGroup( "gui" );
236 236
237 findShow( cfg.readBoolEntry( "findBar", true ) ); 237 findShow( cfg.readBoolEntry( "findBar", true ) );
238 searchShow( cfg.readBoolEntry( "searchBar", true ) ); 238 searchShow( cfg.readBoolEntry( "searchBar", true ) );
239 sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); 239 sectionShow( cfg.readBoolEntry( "sectionBar", true ) );
240 destShow( cfg.readBoolEntry( "destBar", false ) ); 240 destShow( cfg.readBoolEntry( "destBar", false ) );
241} 241}
242 242
243MainWindow::~MainWindow() 243MainWindow::~MainWindow()
244{ 244{
245 Config cfg( "oipkg", Config::User ); 245 Config cfg( "oipkg", Config::User );
246 cfg.setGroup( "gui" ); 246 cfg.setGroup( "gui" );
247 cfg.writeEntry( "findBar", !findBar->isHidden() ); 247 cfg.writeEntry( "findBar", !findBar->isHidden() );
248 cfg.writeEntry( "searchBar", !searchBar->isHidden() ); 248 cfg.writeEntry( "searchBar", !searchBar->isHidden() );
249 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); 249 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
250 cfg.writeEntry( "destBar", !destBar->isHidden() ); 250 cfg.writeEntry( "destBar", !destBar->isHidden() );
251 251
252} 252}
253 253
254void MainWindow::runIpkg() 254void MainWindow::runIpkg()
255{ 255{
256 packageListServers.allPackages(); 256 packageListServers.allPackages();
257 ipkg->loadList( &packageListSearch ); 257 ipkg->loadList( &packageListSearch );
258 ipkg->loadList( &packageListDocLnk ); 258 ipkg->loadList( &packageListDocLnk );
259 ipkg->loadList( &packageListServers ); 259 ipkg->loadList( &packageListServers );
260 ipkg->commit(); 260 ipkg->commit();
261 ipkg->clearLists();
261 // ##### If we looked in the list of files, we could send out accurate 262 // ##### 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". 263 // ##### messages. But we don't bother yet, and just do an "all".
263 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 264 QCopEnvelope e("QPE/System", "linkChanged(QString)");
264 QString lf = QString::null; 265 QString lf = QString::null;
265 e << lf; 266 e << lf;
266 displayList(); 267 displayList();
267} 268}
268 269
269void MainWindow::updateList() 270void MainWindow::updateList()
270{ 271{
271 //wait->show(); 272 //wait->show();
272 QTimer *t = new QTimer( this ); 273 QTimer *t = new QTimer( this );
273 connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); 274 connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) );
274 t->start( 0, false ); 275 t->start( 0, false );
275 packageListServers.clear(); 276 packageListServers.clear();
276 packageListSearch.clear(); 277 packageListSearch.clear();
277 packageListDocLnk.clear(); 278 packageListDocLnk.clear();
278 ipkg->update(); 279 ipkg->update();
279 packageListServers.update(); 280 packageListServers.update();
280 packageListSearch.update(); 281 packageListSearch.update();
281 packageListDocLnk.update(); 282 packageListDocLnk.update();
282 t->stop(); 283 t->stop();
283 // wait->hide(); 284 // wait->hide();
284} 285}
285 286
286void MainWindow::filterList() 287void MainWindow::filterList()
287{ 288{
288 //wait->show(); 289 //wait->show();
289 QString f = ""; 290 QString f = "";
290 if ( findAction->isOn() ) f = findEdit->text(); 291 if ( findAction->isOn() ) f = findEdit->text();
291 packageListServers.filterPackages( f ); 292 packageListServers.filterPackages( f );
292 //wait->hide(); 293 //wait->hide();
293} 294}
294 295
295void MainWindow::displayList() 296void MainWindow::displayList()
296{ 297{
297 //wait->hide(); 298 //wait->hide();
298 filterList(); 299 filterList();
299 listViewPackages->display(); 300 listViewPackages->display();
300} 301}
301 302
302void MainWindow::sectionChanged() 303void MainWindow::sectionChanged()
303{ 304{
304 disconnect( section, SIGNAL( activated(int) ), 305 disconnect( section, SIGNAL( activated(int) ),
305 this, SLOT( sectionChanged() ) ); 306 this, SLOT( sectionChanged() ) );
306 disconnect( subsection, SIGNAL(activated(int) ), 307 disconnect( subsection, SIGNAL(activated(int) ),
307 this, SLOT( subSectionChanged() ) ); 308 this, SLOT( subSectionChanged() ) );
308 subsection->clear(); 309 subsection->clear();
309 packageListServers.setSection( section->currentText() ); 310 packageListServers.setSection( section->currentText() );
310 setSubSections(); 311 setSubSections();
311 connect( section, SIGNAL( activated(int) ), 312 connect( section, SIGNAL( activated(int) ),
312 this, SLOT( sectionChanged() ) ); 313 this, SLOT( sectionChanged() ) );
313 connect( subsection, SIGNAL(activated(int) ), 314 connect( subsection, SIGNAL(activated(int) ),
314 this, SLOT( subSectionChanged() ) ); 315 this, SLOT( subSectionChanged() ) );
315 displayList(); 316 displayList();
316} 317}
317 318
318void MainWindow::subSectionChanged() 319void MainWindow::subSectionChanged()
319{ 320{
320 disconnect( section, SIGNAL( activated(int) ), 321 disconnect( section, SIGNAL( activated(int) ),
321 this, SLOT( sectionChanged() ) ); 322 this, SLOT( sectionChanged() ) );
322 disconnect( subsection, SIGNAL(activated(int) ), 323 disconnect( subsection, SIGNAL(activated(int) ),
323 this, SLOT( subSectionChanged() ) ); 324 this, SLOT( subSectionChanged() ) );
324 packageListServers.setSubSection( subsection->currentText() ); 325 packageListServers.setSubSection( subsection->currentText() );
325 connect( section, SIGNAL( activated(int) ), 326 connect( section, SIGNAL( activated(int) ),
326 this, SLOT( sectionChanged() ) ); 327 this, SLOT( sectionChanged() ) );
327 connect( subsection, SIGNAL(activated(int) ), 328 connect( subsection, SIGNAL(activated(int) ),
328 this, SLOT( subSectionChanged() ) ); 329 this, SLOT( subSectionChanged() ) );
329 displayList(); 330 displayList();
330} 331}
331 332
332void MainWindow::setSections() 333void MainWindow::setSections()
333{ 334{
334 section->clear(); 335 section->clear();
335 section->insertStringList( packageListServers.getSections() ); 336 section->insertStringList( packageListServers.getSections() );
336} 337}
337 338
338void MainWindow::setSubSections() 339void MainWindow::setSubSections()
339{ 340{
340 subsection->clear(); 341 subsection->clear();
341 subsection->insertStringList( packageListServers.getSubSections() ); 342 subsection->insertStringList( packageListServers.getSubSections() );
342} 343}
343 344
344 345
345void MainWindow::showSettings() 346void MainWindow::showSettings()
346{ 347{
347 if ( settings->showDialog( 0 ) ) 348 if ( settings->showDialog( 0 ) )
348 updateList(); 349 updateList();
349} 350}
350void MainWindow::showSettingsSrv() 351void MainWindow::showSettingsSrv()
351{ 352{
352 if ( settings->showDialog( 1 ) ) 353 if ( settings->showDialog( 1 ) )
353 updateList(); 354 updateList();
354} 355}
355void MainWindow::showSettingsDst() 356void MainWindow::showSettingsDst()
356{ 357{
357 if ( settings->showDialog( 2 ) ) 358 if ( settings->showDialog( 2 ) )
358 updateList(); 359 updateList();
359} 360}
360 361
361void MainWindow::sectionShow(bool b) 362void MainWindow::sectionShow(bool b)
362{ 363{
363 if (b) sectionBar->show(); 364 if (b) sectionBar->show();
364 else sectionBar->hide(); 365 else sectionBar->hide();
365 sectionAction->setOn( b ); 366 sectionAction->setOn( b );
366} 367}
367 368
368void MainWindow::sectionClose() 369void MainWindow::sectionClose()
369{ 370{
370 sectionAction->setOn( false ); 371 sectionAction->setOn( false );
371} 372}
372 373
373void MainWindow::findShow(bool b) 374void MainWindow::findShow(bool b)
374{ 375{
375 if (b) findBar->show(); 376 if (b) findBar->show();
376 else findBar->hide(); 377 else findBar->hide();
377 findAction->setOn( b ); 378 findAction->setOn( b );
378} 379}
379 380
380void MainWindow::findClose() 381void MainWindow::findClose()
381{ 382{
382 findAction->setOn( false ); 383 findAction->setOn( false );
383} 384}
384 385
385void MainWindow::searchShow(bool b) 386void MainWindow::searchShow(bool b)
386{ 387{
387 if (b) searchBar->show(); 388 if (b) searchBar->show();
388 else searchBar->hide(); 389 else searchBar->hide();
389 searchAction->setOn( b ); 390 searchAction->setOn( b );
390} 391}
391 392
392void MainWindow::searchClose() 393void MainWindow::searchClose()
393{ 394{
394 searchAction->setOn( false ); 395 searchAction->setOn( false );
395} 396}
396 397
397 398
398void MainWindow::destShow(bool b) 399void MainWindow::destShow(bool b)
399{ 400{
400 if (b) destBar->show(); 401 if (b) destBar->show();
401 else destBar->hide(); 402 else destBar->hide();
402 destAction->setOn( b ); 403 destAction->setOn( b );
403} 404}
404 405
405void MainWindow::destClose() 406void MainWindow::destClose()
406{ 407{
407 destAction->setOn( false ); 408 destAction->setOn( false );
408} 409}
409 410
410void MainWindow::rotateUpdateIcon() 411void MainWindow::rotateUpdateIcon()
411{ 412{
412 pvDebug(2, "MainWindow::rotateUpdateIcon"); 413 pvDebug(2, "MainWindow::rotateUpdateIcon");
413 if ( updateIcon ) 414 if ( updateIcon )
414 updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); 415 updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) );
415 else 416 else
416 updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); 417 updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) );
417 updateIcon = !updateIcon; 418 updateIcon = !updateIcon;
418} 419}
419 420
420 421
421void MainWindow::setDocument(const QString &fileName) 422void MainWindow::setDocument(const QString &fileName)
422{ 423{
423 installFile(fileName);
424 // ##### If we looked in the list of files, we could send out accurate
425 // ##### messages. But we don't bother yet, and just do an "all".
426 QCopEnvelope e("QPE/System", "linkChanged(QString)");
427 QString lf = QString::null;
428 e << lf;
429 // displayList();
430 exit;
431}
432
433void MainWindow::installFile(const QString &fileName)
434{
435 pvDebug(3, "MainWindow::installFile "+fileName);
436 if ( !QFile::exists( fileName ) ) return; 424 if ( !QFile::exists( fileName ) ) return;
437 ipkg->installFile( fileName ); 425 ipkg->installFile( fileName );
438 // ##### If we looked in the list of files, we could send out accurate
439 // ##### messages. But we don't bother yet, and just do an "all".
440 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 426 QCopEnvelope e("QPE/System", "linkChanged(QString)");
441 QString lf = QString::null; 427 QString lf = QString::null;
442 e << lf; 428 e << lf;
443 displayList(); 429 exit;
444} 430}
445 431
432
446void MainWindow::makeChannel() 433void MainWindow::makeChannel()
447 { 434 {
448 channel = new QCopChannel( "QPE/Application/oipkg", this ); 435 channel = new QCopChannel( "QPE/Application/oipkg", this );
449 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 436 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
450 this, SLOT(receive(const QCString&, const QByteArray&)) ); 437 this, SLOT(receive(const QCString&, const QByteArray&)) );
451} 438}
452 439
453 440
454 441
455void MainWindow::receive(const QCString &msg, const QByteArray &arg) 442void MainWindow::receive(const QCString &msg, const QByteArray &arg)
456{ 443{
457 pvDebug(3, "QCop "+msg+" "+QCString(arg)); 444 pvDebug(3, "QCop "+msg+" "+QCString(arg));
458 if ( msg == "installFile(QString)" ) 445 if ( msg == "installFile(QString)" )
459 { 446 {
460 ipkg->installFile( QString(arg) ); 447 ipkg->installFile( QString(arg) );
461 }else if( msg == "removeFile(QString)" ) 448 }else if( msg == "removeFile(QString)" )
462 { 449 {
463 ipkg->removeFile( QString(arg) ); 450 ipkg->removeFile( QString(arg) );
464 }else if( msg == "createLinks(QString)" ) 451 }else if( msg == "createLinks(QString)" )
465 { 452 {
466 ipkg->createLinks( QString(arg) ); 453 ipkg->createLinks( QString(arg) );
467 }else if( msg == "removeLinks(QString)" ) 454 }else if( msg == "removeLinks(QString)" )
468 { 455 {
469 ipkg->removeLinks( QString(arg) ); 456 ipkg->removeLinks( QString(arg) );
470 }else{ 457 }else{
471 pvDebug(2,"Huh what do ya want") 458 pvDebug(2,"Huh what do ya want")
472 } 459 }
473} 460}
474 461
475 462
476void MainWindow::createLinks() 463void MainWindow::createLinks()
477{ 464{
478 pvDebug(2,"creating links..."); 465 pvDebug(2,"creating links...");
479 ipkg->createLinks( settings->destinationurl->text() ); 466 ipkg->createLinks( settings->destinationurl->text() );
480} 467}
481 468
482void MainWindow::removeLinks() 469void MainWindow::removeLinks()
483{ 470{
484 pvDebug(2,"removing links..."); 471 pvDebug(2,"removing links...");
485 ipkg->removeLinks( settings->destinationurl->text() ); 472 ipkg->removeLinks( settings->destinationurl->text() );
486} 473}
487 474
488void MainWindow::remotePackageQuery() 475void MainWindow::remotePackageQuery()
489{ 476{
490 packageListSearch.query( searchEdit->text() ); 477 packageListSearch.query( searchEdit->text() );
491 packageListSearch.update(); 478 packageListSearch.update();
492 displayList(); 479 displayList();
493} 480}
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h
index 7c93dad..ce3e761 100644
--- a/noncore/unsupported/oipkg/mainwindow.h
+++ b/noncore/unsupported/oipkg/mainwindow.h
@@ -1,98 +1,97 @@
1#ifndef MAINWINDOW_H 1#ifndef MAINWINDOW_H
2#define MAINWINDOW_H 2#define MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qaction.h> 5#include <qaction.h>
6#include <qtimer.h> 6#include <qtimer.h>
7#include <qpopupmenu.h> 7#include <qpopupmenu.h>
8 8
9#include "packagelist.h" 9#include "packagelist.h"
10#include "packagelistremote.h" 10#include "packagelistremote.h"
11#include "packagelistlocal.h" 11#include "packagelistlocal.h"
12#include "packagelistdoclnk.h" 12#include "packagelistdoclnk.h"
13#include "pmipkg.h" 13#include "pmipkg.h"
14#include "pksettings.h" 14#include "pksettings.h"
15#include "packagelistview.h" 15#include "packagelistview.h"
16 16
17class QComboBox; 17class QComboBox;
18class QPEToolBar; 18class QPEToolBar;
19class QLineEdit; 19class QLineEdit;
20class PackageListItem; 20class PackageListItem;
21class QCopChannel; 21class QCopChannel;
22class QMessageBox; 22class QMessageBox;
23class QCheckBox; 23class QCheckBox;
24 24
25class MainWindow : public QMainWindow 25class MainWindow : public QMainWindow
26{ 26{
27 Q_OBJECT 27 Q_OBJECT
28 28
29 29
30public: 30public:
31 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 31 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
32 ~MainWindow(); 32 ~MainWindow();
33 void makeChannel(); 33 void makeChannel();
34 34
35 QCopChannel *channel; 35 QCopChannel *channel;
36 36
37protected slots: 37protected slots:
38 void runIpkg(); 38 void runIpkg();
39 void updateList(); 39 void updateList();
40 void displayList(); 40 void displayList();
41 void subSectionChanged(); 41 void subSectionChanged();
42 void sectionChanged(); 42 void sectionChanged();
43 void showSettings(); 43 void showSettings();
44 void showSettingsSrv(); 44 void showSettingsSrv();
45 void showSettingsDst(); 45 void showSettingsDst();
46 46
47public slots: 47public slots:
48 void sectionClose(); 48 void sectionClose();
49 void sectionShow(bool); 49 void sectionShow(bool);
50 void findClose(); 50 void findClose();
51 void findShow(bool); 51 void findShow(bool);
52 void searchClose(); 52 void searchClose();
53 void searchShow(bool); 53 void searchShow(bool);
54 void destClose(); 54 void destClose();
55 void destShow(bool); 55 void destShow(bool);
56 void filterList(); 56 void filterList();
57 void createLinks(); 57 void createLinks();
58 void removeLinks(); 58 void removeLinks();
59 void receive (const QCString &, const QByteArray &); 59 void receive (const QCString &, const QByteArray &);
60 void setDocument (const QString &); 60 void setDocument (const QString &);
61 void remotePackageQuery(); 61 void remotePackageQuery();
62 62
63private: 63private:
64 void makeMenu(); 64 void makeMenu();
65 void setSections(); 65 void setSections();
66 void setSubSections(); 66 void setSubSections();
67 void installFile(const QString &);
68 bool updateIcon; 67 bool updateIcon;
69 68
70 PmIpkg* ipkg; 69 PmIpkg* ipkg;
71 PackageManagerSettings *settings; 70 PackageManagerSettings *settings;
72 PackageListLocal packageListServers; 71 PackageListLocal packageListServers;
73 PackageListRemote packageListSearch; 72 PackageListRemote packageListSearch;
74 PackageListDocLnk packageListDocLnk; 73 PackageListDocLnk packageListDocLnk;
75 PackageListView *listViewPackages; 74 PackageListView *listViewPackages;
76 QAction *runAction; 75 QAction *runAction;
77 QAction *updateAction; 76 QAction *updateAction;
78 QAction *findAction; 77 QAction *findAction;
79 QPEToolBar *findBar; 78 QPEToolBar *findBar;
80 QLineEdit *findEdit; 79 QLineEdit *findEdit;
81 QAction *searchAction; 80 QAction *searchAction;
82 QAction *searchCommit; 81 QAction *searchCommit;
83 QPEToolBar *searchBar; 82 QPEToolBar *searchBar;
84 QLineEdit *searchEdit; 83 QLineEdit *searchEdit;
85 QAction *sectionAction; 84 QAction *sectionAction;
86 QPEToolBar *sectionBar; 85 QPEToolBar *sectionBar;
87 QComboBox *section; 86 QComboBox *section;
88 QComboBox *subsection; 87 QComboBox *subsection;
89 QAction *destAction; 88 QAction *destAction;
90 QPEToolBar *destBar; 89 QPEToolBar *destBar;
91 QComboBox *destination; 90 QComboBox *destination;
92 QCheckBox* CheckBoxLink; 91 QCheckBox* CheckBoxLink;
93// QMessageBox *wait; 92// QMessageBox *wait;
94private slots: 93private slots:
95 void rotateUpdateIcon(); 94 void rotateUpdateIcon();
96}; 95};
97 96
98#endif 97#endif
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 0401a5b..30777c2 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -116,280 +116,282 @@ QStringList* PmIpkg::getList( QString packFileName, QString d )
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 out(tr("\nAll done.")); 245 out(tr("\nAll done."));
245} 246}
246 247
247void PmIpkg::doIt() 248void PmIpkg::doIt()
248{ 249{
249 runwindow->progress->setProgress(0); 250 runwindow->progress->setProgress(0);
250 show(); 251 show();
251 remove(); 252 remove();
252 install(); 253 install();
253} 254}
254 255
255 256
256void PmIpkg::remove() 257void PmIpkg::remove()
257{ 258{
258 if ( to_remove.count() == 0 ) return; 259 if ( to_remove.count() == 0 ) return;
259 260
260 out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); 261 out(tr("Removing")+"\n"+tr("please wait")+"\n\n");
261 262
262 QStringList *fileList; 263 QStringList *fileList;
263 for (uint i=0; i < to_remove.count(); i++) 264 for (uint i=0; i < to_remove.count(); i++)
264 { 265 {
265 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() );
266 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() ))
267 { 268 {
268 runwindow->progress->setProgress( 1 ); 269 runwindow->progress->setProgress( 1 );
269 linkOpp = removeLink; 270 linkOpp = removeLink;
270 to_remove.at(i)->processed(); 271 to_remove.at(i)->processed();
271 pvDebug(4,"link "+QString::number(i)); 272 pvDebug(3,"link "+QString::number(i));
272 if ( to_remove.at(i)->link() ) 273 if ( to_remove.at(i)->link() )
273 processFileList( fileList, to_remove.at(i)->dest() ); 274 processFileList( fileList, to_remove.at(i)->dest() );
274 pvDebug(4,"take "+QString::number(i)); 275 //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count()));
275 to_remove.take( i ); 276 //if ( to_remove.at(i) ) to_remove.take( i );
276 277
277 out("\n"); 278 out("\n");
278 }else{ 279 }else{
279 out(tr("Error while removing")+to_remove.at(i)->name()+"\n"); 280 out(tr("Error while removing ")+to_remove.at(i)->name()+"\n");
280 if ( to_remove.at(i)->link() ) 281 if ( to_remove.at(i)->link() )
281 processFileList( fileList, to_remove.at(i)->dest() ); 282 processFileList( fileList, to_remove.at(i)->dest() );
282 } 283 }
283 if ( to_remove.at(i)->link() ) 284 if ( to_remove.at(i)->link() )
284 processFileList( fileList, to_remove.at(i)->dest() ); 285 processFileList( fileList, to_remove.at(i)->dest() );
285 if ( to_remove.at(i)->link() )delete fileList; 286 if ( to_remove.at(i)->link() )delete fileList;
286 } 287 }
287 to_remove.clear(); 288 to_remove.clear();
288 out("\n"); 289 out("\n");
289} 290}
290 291
291 292
292void PmIpkg::install() 293void PmIpkg::install()
293{ 294{
294 if ( to_install.count() == 0 ) return; 295 if ( to_install.count() == 0 ) return;
295 out(tr("Installing")+"\n"+tr("please wait")+"\n"); 296 out(tr("Installing")+"\n"+tr("please wait")+"\n");
296 for (uint i=0; i < to_install.count(); i++) 297 for (uint i=0; i < to_install.count(); i++)
297 { 298 {
298 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
299 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() ))
300 { 301 {
301 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());
302 to_install.at(i)->processed(); 303 to_install.at(i)->processed();
303 linkOpp = createLink; 304 linkOpp = createLink;
304 if ( to_install.at(i)->link() ) 305 if ( to_install.at(i)->link() )
305 makeLinks( to_install.at(i) ); 306 makeLinks( to_install.at(i) );
306 to_install.take( i ); 307 // to_install.take( i );
307 out("\n"); 308 out("\n");
308 }else{ 309 }else{
309 out(tr("Error while installing")+to_install.at(i)->name()+"\n"); 310 out(tr("Error while installing")+to_install.at(i)->name()+"\n");
310 linkOpp = createLink; 311 linkOpp = createLink;
311 if ( to_install.at(i)->link() ) 312 if ( to_install.at(i)->link() )
312 makeLinks( to_install.at(i) ); 313 makeLinks( to_install.at(i) );
313 } 314 }
314 } 315 }
315 out("\n"); 316 out("\n");
316 to_install.clear(); 317 to_install.clear();
317} 318}
318 319
319void PmIpkg::createLinks( const QString &dest ) 320void PmIpkg::createLinks( const QString &dest )
320{ 321{
321 pvDebug(2,"PmIpkg::createLinks "+dest); 322 pvDebug(2,"PmIpkg::createLinks "+dest);
322 linkOpp=createLink; 323 linkOpp=createLink;
323 QString url = settings->getDestinationUrlByName( dest ); 324 QString url = settings->getDestinationUrlByName( dest );
324 url = url==""?dest:url; 325 url = url==""?dest:url;
325 processLinkDir( "/opt", url ); 326 processLinkDir( "/opt", url );
326 processLinkDir( "/usr", url ); 327 processLinkDir( "/usr", url );
327} 328}
328 329
329void PmIpkg::removeLinks( const QString &dest ) 330void PmIpkg::removeLinks( const QString &dest )
330{ 331{
331 pvDebug(2,"PmIpkg::removeLinks "+dest); 332 pvDebug(2,"PmIpkg::removeLinks "+dest);
332 linkOpp=removeLink; 333 linkOpp=removeLink;
333 QString url = settings->getDestinationUrlByName( dest ); 334 QString url = settings->getDestinationUrlByName( dest );
334 url = url==""?dest:url; 335 url = url==""?dest:url;
335 processLinkDir( "/opt", url ); 336 processLinkDir( "/opt", url );
336 processLinkDir( "/usr", url ); 337 processLinkDir( "/usr", url );
337} 338}
338 339
339void PmIpkg::update() 340void PmIpkg::update()
340{ 341{
341 show(); 342 show();
342 runIpkg( "update" ); 343 runIpkg( "update" );
343 runwindow->close(); 344 runwindow->close();
344} 345}
345 346
346void PmIpkg::out( QString o ) 347void PmIpkg::out( QString o )
347{ 348{
348 runwindow->outPut->append(o); 349 runwindow->outPut->append(o);
349 runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); 350 runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE);
350} 351}
351 352
352 353
353 354
354 355
355void PmIpkg::show() 356void PmIpkg::show()
356{ 357{
357 if (!runwindow->isVisible()) 358 if (!runwindow->isVisible())
358 { 359 {
359 runwindow->showMaximized(); 360 runwindow->showMaximized();
360 runwindow->show(); 361 runwindow->show();
361 } 362 }
362 runwindow->outPut->setText(""); 363 runwindow->outPut->setText("");
363 //showButtons(b);
364 //if ( !b )
365 // runwindow->progress->hide();
366// else
367 // runwindow->progress->show();
368} 364}
369 365
370void PmIpkg::installFile(const QString &fileName, const QString &dest) 366void PmIpkg::installFile(const QString &fileName, const QString &dest)
371{ 367{
372 368
373 to_install.clear(); 369 to_install.clear();
374 to_remove.clear(); 370 to_remove.clear();
375 pvDebug( 2,"PmIpkg::installFile "+ fileName); 371 pvDebug( 2,"PmIpkg::installFile "+ fileName);
376 Package *p = new Package(fileName,settings); 372 Package *p = new Package(fileName,settings);
377 if ( dest!="") p->setDest( dest ); 373 if ( dest!="") p->setDest( dest );
378 to_install.append( p ); 374 to_install.append( p );
379 commit(); 375 commit();
380 delete p; 376 delete p;
381} 377}
382 378
383void PmIpkg::removeFile(const QString &fileName, const QString &dest) 379void PmIpkg::removeFile(const QString &fileName, const QString &dest)
384{ 380{
385 381
386 to_install.clear(); 382 to_install.clear();
387 to_remove.clear(); 383 to_remove.clear();
388 pvDebug( 2,"PmIpkg::removeFile "+ fileName); 384 pvDebug( 2,"PmIpkg::removeFile "+ fileName);
389 Package *p = new Package(fileName,settings); 385 Package *p = new Package(fileName,settings);
390 if ( dest!="") p->setDest( dest ); 386 if ( dest!="") p->setDest( dest );
391 to_remove.append( p ); 387 to_remove.append( p );
392 commit(); 388 commit();
393 delete p; 389 delete p;
394} 390}
395 391
392
393void PmIpkg::clearLists()
394{
395 to_remove.clear();
396 to_install.clear();
397}
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h
index c543304..d53a74d 100644
--- a/noncore/unsupported/oipkg/pmipkg.h
+++ b/noncore/unsupported/oipkg/pmipkg.h
@@ -1,63 +1,65 @@
1#ifndef PMIPKG_H 1#ifndef PMIPKG_H
2#define PMIPKG_H 2#define PMIPKG_H
3 3
4 4
5#include <qobject.h> 5#include <qobject.h>
6#include <qlist.h> 6#include <qlist.h>
7#include <qstring.h> 7#include <qstring.h>
8#include <qwidget.h> 8#include <qwidget.h>
9#include "pksettings.h" 9#include "pksettings.h"
10#include "runwindow.h" 10#include "runwindow.h"
11#include "packagelist.h" 11#include "packagelist.h"
12#include "installdialog.h" 12#include "installdialog.h"
13#include "debug.h" 13#include "debug.h"
14 14
15#define createLink 0 15#define createLink 0
16#define removeLink 1 16#define removeLink 1
17 17
18class Package; 18class Package;
19class PmIpkg : public QObject 19class PmIpkg : public QObject
20{ 20{
21 Q_OBJECT 21 Q_OBJECT
22public: 22public:
23 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); 23 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 );
24 ~PmIpkg(); 24 ~PmIpkg();
25 25
26 int linkOpp; 26 int linkOpp;
27 void loadList( PackageList* ); 27 void loadList( PackageList* );
28 void commit(); 28 void commit();
29 void update(); 29 void update();
30 void show(); 30 void show();
31 /** No descriptions */
32 void clearLists();
31 33
32public slots: 34public slots:
33 void doIt(); 35 void doIt();
34 void install(); 36 void install();
35 void remove(); 37 void remove();
36 void installFile(const QString &fileName, const QString &dest=""); 38 void installFile(const QString &fileName, const QString &dest="");
37 void removeFile(const QString &fileName, const QString &dest=""); 39 void removeFile(const QString &fileName, const QString &dest="");
38 void createLinks( const QString &dest ); 40 void createLinks( const QString &dest );
39 void removeLinks( const QString &dest ); 41 void removeLinks( const QString &dest );
40 42
41private: 43private:
42 PackageManagerSettings* settings; 44 PackageManagerSettings* settings;
43 RunWindow *runwindow; 45 RunWindow *runwindow;
44 InstallDialog *installDialog; 46 InstallDialog *installDialog;
45 QList<Package> to_remove; 47 QList<Package> to_remove;
46 QList<Package> to_install; 48 QList<Package> to_install;
47 QString fileNameToInstall; 49 QString fileNameToInstall;
48 QCheckBox *_force_reinstall; 50 QCheckBox *_force_reinstall;
49 QCheckBox *_force_remove; 51 QCheckBox *_force_remove;
50 QCheckBox *_force_depends; 52 QCheckBox *_force_depends;
51// void startDialog(); 53// void startDialog();
52 void makeLinks(Package*); 54 void makeLinks(Package*);
53 void linkPackage( QString, QString ); 55 void linkPackage( QString, QString );
54 void processLinkDir( QString , QString ); 56 void processLinkDir( QString , QString );
55 bool runIpkg(const QString& args, const QString& dest="" ); 57 bool runIpkg(const QString& args, const QString& dest="" );
56 void out( QString ); 58 void out( QString );
57 QStringList* getList( QString, QString ); 59 QStringList* getList( QString, QString );
58 void processFileList( QStringList*, QString ); 60 void processFileList( QStringList*, QString );
59 61
60 62
61}; 63};
62 64
63#endif 65#endif