summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp3
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.h6
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp29
-rw-r--r--noncore/settings/aqpkg/mainwin.h3
4 files changed, 33 insertions, 8 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index 1f0bb5f..2bb8b4d 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -138,143 +138,144 @@ InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *tit
138} 138}
139 139
140 140
141InstallDlgImpl::~InstallDlgImpl() 141InstallDlgImpl::~InstallDlgImpl()
142{ 142{
143 if ( pIpkg ) 143 if ( pIpkg )
144 delete pIpkg; 144 delete pIpkg;
145} 145}
146 146
147void InstallDlgImpl :: init( bool displayextrainfo ) 147void InstallDlgImpl :: init( bool displayextrainfo )
148{ 148{
149 QGridLayout *layout = new QGridLayout( this ); 149 QGridLayout *layout = new QGridLayout( this );
150 layout->setSpacing( 4 ); 150 layout->setSpacing( 4 );
151 layout->setMargin( 4 ); 151 layout->setMargin( 4 );
152 152
153 if ( displayextrainfo ) 153 if ( displayextrainfo )
154 { 154 {
155 QLabel *label = new QLabel( tr( "Destination" ), this ); 155 QLabel *label = new QLabel( tr( "Destination" ), this );
156 layout->addWidget( label, 0, 0 ); 156 layout->addWidget( label, 0, 0 );
157 destination = new QComboBox( FALSE, this ); 157 destination = new QComboBox( FALSE, this );
158 layout->addWidget( destination, 0, 1 ); 158 layout->addWidget( destination, 0, 1 );
159 connect( destination, SIGNAL( highlighted( const QString & ) ), 159 connect( destination, SIGNAL( highlighted( const QString & ) ),
160 this, SLOT( displayAvailableSpace( const QString & ) ) ); 160 this, SLOT( displayAvailableSpace( const QString & ) ) );
161 161
162 QLabel *label2 = new QLabel( tr( "Space Avail" ), this ); 162 QLabel *label2 = new QLabel( tr( "Space Avail" ), this );
163 layout->addWidget( label2, 1, 0 ); 163 layout->addWidget( label2, 1, 0 );
164 txtAvailableSpace = new QLabel( "", this ); 164 txtAvailableSpace = new QLabel( "", this );
165 layout->addWidget( txtAvailableSpace, 1, 1 ); 165 layout->addWidget( txtAvailableSpace, 1, 1 );
166 } 166 }
167 else 167 else
168 { 168 {
169 destination = 0x0; 169 destination = 0x0;
170 txtAvailableSpace = 0x0; 170 txtAvailableSpace = 0x0;
171 } 171 }
172 172
173 QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); 173 QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this );
174 GroupBox2->layout()->setSpacing( 0 ); 174 GroupBox2->layout()->setSpacing( 0 );
175 GroupBox2->layout()->setMargin( 4 ); 175 GroupBox2->layout()->setMargin( 4 );
176 176
177 QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() ); 177 QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() );
178 output = new QMultiLineEdit( GroupBox2 ); 178 output = new QMultiLineEdit( GroupBox2 );
179 GroupBox2Layout->addWidget( output ); 179 GroupBox2Layout->addWidget( output );
180 layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 ); 180 layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 );
181 181
182 btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this ); 182 btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this );
183 layout->addWidget( btnInstall, 3, 0 ); 183 layout->addWidget( btnInstall, 3, 0 );
184 connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) ); 184 connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) );
185 185
186 btnOptions = new QPushButton( Resource::loadPixmap( "aqpkg/config" ), tr( "Options" ), this ); 186 btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this );
187 layout->addWidget( btnOptions, 3, 1 ); 187 layout->addWidget( btnOptions, 3, 1 );
188 connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) ); 188 connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) );
189} 189}
190 190
191void InstallDlgImpl :: optionsSelected() 191void InstallDlgImpl :: optionsSelected()
192{ 192{
193 InstallOptionsDlgImpl opt( flags, this, "Option", true ); 193 InstallOptionsDlgImpl opt( flags, this, "Option", true );
194 opt.exec(); 194 opt.exec();
195 195
196 // set options selected from dialog 196 // set options selected from dialog
197 flags = opt.getFlags(); 197 flags = opt.getFlags();
198 198
199#ifdef QWS 199#ifdef QWS
200 Config cfg( "aqpkg" ); 200 Config cfg( "aqpkg" );
201 cfg.setGroup( "settings" ); 201 cfg.setGroup( "settings" );
202 cfg.writeEntry( "installFlags", flags ); 202 cfg.writeEntry( "installFlags", flags );
203#endif 203#endif
204} 204}
205 205
206void InstallDlgImpl :: installSelected() 206void InstallDlgImpl :: installSelected()
207{ 207{
208 if ( btnInstall->text() == tr( "Abort" ) ) 208 if ( btnInstall->text() == tr( "Abort" ) )
209 { 209 {
210 if ( pIpkg ) 210 if ( pIpkg )
211 { 211 {
212 displayText( tr( "\n**** User Clicked ABORT ***" ) ); 212 displayText( tr( "\n**** User Clicked ABORT ***" ) );
213 pIpkg->abort(); 213 pIpkg->abort();
214 displayText( tr( "**** Process Aborted ****" ) ); 214 displayText( tr( "**** Process Aborted ****" ) );
215 } 215 }
216 216
217 btnInstall->setText( tr( "Close" ) ); 217 btnInstall->setText( tr( "Close" ) );
218 btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); 218 btnInstall->setIconSet( Resource::loadPixmap( "enter" ) );
219 return; 219 return;
220 } 220 }
221 else if ( btnInstall->text() == tr( "Close" ) ) 221 else if ( btnInstall->text() == tr( "Close" ) )
222 { 222 {
223 emit reloadData( this ); 223 emit reloadData( this );
224 return; 224 return;
225 } 225 }
226 226
227 // Disable buttons 227 // Disable buttons
228 btnOptions->setEnabled( false ); 228 btnOptions->setEnabled( false );
229// btnInstall->setEnabled( false ); 229// btnInstall->setEnabled( false );
230 230
231 btnInstall->setText( tr( "Abort" ) ); 231 btnInstall->setText( tr( "Abort" ) );
232 btnInstall->setIconSet( Resource::loadPixmap( "close" ) ); 232 btnInstall->setIconSet( Resource::loadPixmap( "close" ) );
233
233 if ( pIpkg ) 234 if ( pIpkg )
234 { 235 {
235 output->setText( "" ); 236 output->setText( "" );
236 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 237 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
237 pIpkg->runIpkg(); 238 pIpkg->runIpkg();
238 } 239 }
239 else 240 else
240 { 241 {
241 output->setText( "" ); 242 output->setText( "" );
242 Destination *d = dataMgr->getDestination( destination->currentText() ); 243 Destination *d = dataMgr->getDestination( destination->currentText() );
243 QString dest = d->getDestinationName(); 244 QString dest = d->getDestinationName();
244 QString destDir = d->getDestinationPath(); 245 QString destDir = d->getDestinationPath();
245 int instFlags = flags; 246 int instFlags = flags;
246 if ( d->linkToRoot() ) 247 if ( d->linkToRoot() )
247 instFlags |= MAKE_LINKS; 248 instFlags |= MAKE_LINKS;
248 249
249#ifdef QWS 250#ifdef QWS
250 // Save settings 251 // Save settings
251 Config cfg( "aqpkg" ); 252 Config cfg( "aqpkg" );
252 cfg.setGroup( "settings" ); 253 cfg.setGroup( "settings" );
253 cfg.writeEntry( "dest", dest ); 254 cfg.writeEntry( "dest", dest );
254#endif 255#endif
255 256
256 pIpkg = new Ipkg; 257 pIpkg = new Ipkg;
257 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 258 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
258 259
259 // First run through the remove list, then the install list then the upgrade list 260 // First run through the remove list, then the install list then the upgrade list
260 pIpkg->setOption( "remove" ); 261 pIpkg->setOption( "remove" );
261 QListIterator<InstallData> it( removeList ); 262 QListIterator<InstallData> it( removeList );
262 InstallData *idata; 263 InstallData *idata;
263 for ( ; it.current(); ++it ) 264 for ( ; it.current(); ++it )
264 { 265 {
265 idata = it.current(); 266 idata = it.current();
266 pIpkg->setDestination( idata->destination->getDestinationName() ); 267 pIpkg->setDestination( idata->destination->getDestinationName() );
267 pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); 268 pIpkg->setDestinationDir( idata->destination->getDestinationPath() );
268 pIpkg->setPackage( idata->packageName ); 269 pIpkg->setPackage( idata->packageName );
269 270
270 int tmpFlags = flags; 271 int tmpFlags = flags;
271 if ( idata->destination->linkToRoot() ) 272 if ( idata->destination->linkToRoot() )
272 tmpFlags |= MAKE_LINKS; 273 tmpFlags |= MAKE_LINKS;
273 274
274 pIpkg->setFlags( tmpFlags ); 275 pIpkg->setFlags( tmpFlags );
275 pIpkg->runIpkg(); 276 pIpkg->runIpkg();
276 } 277 }
277 278
278 pIpkg->setOption( "install" ); 279 pIpkg->setOption( "install" );
279 pIpkg->setDestination( dest ); 280 pIpkg->setDestination( dest );
280 pIpkg->setDestinationDir( destDir ); 281 pIpkg->setDestinationDir( destDir );
diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h
index d7509bb..c30963e 100644
--- a/noncore/settings/aqpkg/installdlgimpl.h
+++ b/noncore/settings/aqpkg/installdlgimpl.h
@@ -10,76 +10,76 @@
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17#ifndef INSTALLDLGIMPL_H 17#ifndef INSTALLDLGIMPL_H
18#define INSTALLDLGIMPL_H 18#define INSTALLDLGIMPL_H
19 19
20using namespace std; 20using namespace std;
21 21
22#include <qlist.h> 22#include <qlist.h>
23#include <qstring.h> 23#include <qstring.h>
24#include <qwidget.h> 24#include <qwidget.h>
25 25
26class QComboBox; 26class QComboBox;
27class QLabel; 27class QLabel;
28class QMultiLineEdit; 28class QMultiLineEdit;
29class QPushButton; 29class QPushButton;
30 30
31class DataManager; 31class DataManager;
32class Destination; 32class Destination;
33class Ipkg; 33class Ipkg;
34 34
35class InstallData 35class InstallData
36{ 36{
37public: 37public:
38 QString option; // I - install, D - delete, R- reinstall U - upgrade 38 QString option; // I - install, D - delete, R- reinstall U - upgrade
39 QString packageName; 39 QString packageName;
40 Destination *destination; 40 Destination *destination;
41 bool recreateLinks; 41 bool recreateLinks;
42}; 42};
43 43
44class InstallDlgImpl : public QWidget 44class InstallDlgImpl : public QWidget
45{ 45{
46 Q_OBJECT 46 Q_OBJECT
47public: 47public:
48 InstallDlgImpl( QList<InstallData> &packageList, DataManager *dataManager, const char *title = 0 ); 48 InstallDlgImpl( QList<InstallData> &packageList, DataManager *dataManager, const char *title = 0 );
49 InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 ); 49 InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 );
50 ~InstallDlgImpl(); 50 ~InstallDlgImpl();
51 51
52 bool upgradeServer( QString &server ); 52 bool upgradeServer( QString &server );
53 53
54protected: 54protected:
55 55
56private: 56private:
57 DataManager *dataMgr; 57 DataManager *dataMgr;
58 QList<InstallData> installList; 58 QList<InstallData> installList;
59 QList<InstallData> removeList; 59 QList<InstallData> removeList;
60 QList<InstallData> updateList; 60 QList<InstallData> updateList;
61 int flags; 61 int flags;
62 Ipkg *pIpkg; 62 Ipkg *pIpkg;
63 bool upgradePackages; 63 bool upgradePackages;
64 64
65 QComboBox *destination; 65 QComboBox *destination;
66 QPushButton *btnInstall; 66 QPushButton *btnInstall;
67 QPushButton *btnOptions; 67 QPushButton *btnOptions;
68 QMultiLineEdit *output; 68 QMultiLineEdit *output;
69 QLabel *txtAvailableSpace; 69 QLabel *txtAvailableSpace;
70 70
71 void init( bool ); 71 void init( bool );
72 72
73 bool runIpkg( QString &option, const QString& package, const QString& dest, int flags ); 73 bool runIpkg( QString &option, const QString& package, const QString& dest, int flags );
74 74
75signals: 75signals:
76 void reloadData( InstallDlgImpl * ); 76 void reloadData( InstallDlgImpl * );
77 77
78public slots: 78public slots:
79 void optionsSelected(); 79 void optionsSelected();
80 void installSelected(); 80 void installSelected();
81 void displayText(const QString &text ); 81 void displayText(const QString &text );
82 void displayAvailableSpace( const QString &text); 82 void displayAvailableSpace( const QString &text);
83}; 83};
84 84
85#endif 85#endif
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index dfe6d9c..7fa311d 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -295,96 +295,113 @@ void MainWindow :: init()
295 categoryFilterEnabled = false; 295 categoryFilterEnabled = false;
296 296
297 updateData(); 297 updateData();
298 298
299 stack->raiseWidget( networkPkgWindow ); 299 stack->raiseWidget( networkPkgWindow );
300} 300}
301/* 301/*
302void MainWindow :: setDocument( const QString &doc ) 302void MainWindow :: setDocument( const QString &doc )
303{ 303{
304 // Remove path from package 304 // Remove path from package
305 QString package = Utils::getPackageNameFromIpkFilename( doc ); 305 QString package = Utils::getPackageNameFromIpkFilename( doc );
306// std::cout << "Selecting package " << package << std::endl; 306// std::cout << "Selecting package " << package << std::endl;
307 307
308 // First select local server 308 // First select local server
309 for ( int i = 0 ; i < serversList->count() ; ++i ) 309 for ( int i = 0 ; i < serversList->count() ; ++i )
310 { 310 {
311 if ( serversList->text( i ) == LOCAL_IPKGS ) 311 if ( serversList->text( i ) == LOCAL_IPKGS )
312 { 312 {
313 serversList->setCurrentItem( i ); 313 serversList->setCurrentItem( i );
314 break; 314 break;
315 } 315 }
316 } 316 }
317 serverSelected( 0 ); 317 serverSelected( 0 );
318 318
319 // Now set the check box of the selected package 319 // Now set the check box of the selected package
320 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 320 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
321 item != 0 ; 321 item != 0 ;
322 item = (QCheckListItem *)item->nextSibling() ) 322 item = (QCheckListItem *)item->nextSibling() )
323 { 323 {
324 if ( item->text().startsWith( package ) ) 324 if ( item->text().startsWith( package ) )
325 { 325 {
326 item->setOn( true ); 326 item->setOn( true );
327 break; 327 break;
328 } 328 }
329 } 329 }
330} 330}
331*/ 331*/
332void MainWindow :: displaySettings() 332void MainWindow :: displaySettings()
333{ 333{
334 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); 334 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true );
335 if ( dlg->showDlg() ) 335 if ( dlg->showDlg() )
336 { 336 {
337 stack->raiseWidget( progressWindow ); 337 stack->raiseWidget( progressWindow );
338 updateData(); 338 updateData();
339 stack->raiseWidget( networkPkgWindow ); 339 stack->raiseWidget( networkPkgWindow );
340 } 340 }
341 delete dlg; 341 delete dlg;
342} 342}
343
344void MainWindow :: closeEvent( QCloseEvent *e )
345{
346 // If install dialog is visible, return to main view, otherwise close app
347 QWidget *widget = stack->visibleWidget();
348
349 if ( widget != networkPkgWindow && widget != progressWindow )
350 {
351 if ( widget ) delete widget;
352 stack->raiseWidget( networkPkgWindow );
353 e->ignore();
354 }
355 else
356 {
357 e->accept();
358 }
359}
343 360
344void MainWindow :: displayFindBar() 361void MainWindow :: displayFindBar()
345{ 362{
346 findBar->show(); 363 findBar->show();
347 findEdit->setFocus(); 364 findEdit->setFocus();
348} 365}
349 366
350void MainWindow :: displayJumpBar() 367void MainWindow :: displayJumpBar()
351{ 368{
352 jumpBar->show(); 369 jumpBar->show();
353} 370}
354 371
355void MainWindow :: repeatFind() 372void MainWindow :: repeatFind()
356{ 373{
357 searchForPackage( findEdit->text() ); 374 searchForPackage( findEdit->text() );
358} 375}
359 376
360void MainWindow :: findPackage( const QString &text ) 377void MainWindow :: findPackage( const QString &text )
361{ 378{
362 actionFindNext->setEnabled( !text.isEmpty() ); 379 actionFindNext->setEnabled( !text.isEmpty() );
363 searchForPackage( text ); 380 searchForPackage( text );
364} 381}
365 382
366void MainWindow :: hideFindBar() 383void MainWindow :: hideFindBar()
367{ 384{
368 findBar->hide(); 385 findBar->hide();
369} 386}
370 387
371void MainWindow :: hideJumpBar() 388void MainWindow :: hideJumpBar()
372{ 389{
373 jumpBar->hide(); 390 jumpBar->hide();
374} 391}
375 392
376void MainWindow :: filterUninstalledPackages() 393void MainWindow :: filterUninstalledPackages()
377{ 394{
378 showUninstalledPkgs = actionUninstalled->isOn(); 395 showUninstalledPkgs = actionUninstalled->isOn();
379 if ( showUninstalledPkgs ) 396 if ( showUninstalledPkgs )
380 { 397 {
381 showInstalledPkgs = FALSE; 398 showInstalledPkgs = FALSE;
382 showUpgradedPkgs = FALSE; 399 showUpgradedPkgs = FALSE;
383 } 400 }
384 serverSelected( -1 ); 401 serverSelected( -1 );
385 402
386 actionInstalled->setOn( FALSE ); 403 actionInstalled->setOn( FALSE );
387 actionUpdated->setOn( FALSE ); 404 actionUpdated->setOn( FALSE );
388} 405}
389 406
390void MainWindow :: filterInstalledPackages() 407void MainWindow :: filterInstalledPackages()
@@ -734,126 +751,128 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
734 751
735void MainWindow :: searchForPackage( const QString &text ) 752void MainWindow :: searchForPackage( const QString &text )
736{ 753{
737 if ( !text.isEmpty() ) 754 if ( !text.isEmpty() )
738 { 755 {
739// cout << "searching for " << text << endl; 756// cout << "searching for " << text << endl;
740 // look through package list for text startng at current position 757 // look through package list for text startng at current position
741// vector<InstallData> workingPackages; 758// vector<InstallData> workingPackages;
742 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 759 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
743// if ( start != 0 ) 760// if ( start != 0 )
744// start = (QCheckListItem *)start->nextSibling(); 761// start = (QCheckListItem *)start->nextSibling();
745 762
746 if ( start == 0 ) 763 if ( start == 0 )
747 start = (QCheckListItem *)packagesList->firstChild(); 764 start = (QCheckListItem *)packagesList->firstChild();
748 765
749 for ( QCheckListItem *item = start; item != 0 ; 766 for ( QCheckListItem *item = start; item != 0 ;
750 item = (QCheckListItem *)item->nextSibling() ) 767 item = (QCheckListItem *)item->nextSibling() )
751 { 768 {
752// cout << "checking " << item->text().lower() << endl; 769// cout << "checking " << item->text().lower() << endl;
753 if ( item->text().lower().find( text ) != -1 ) 770 if ( item->text().lower().find( text ) != -1 )
754 { 771 {
755// cout << "matched " << item->text() << endl; 772// cout << "matched " << item->text() << endl;
756 packagesList->ensureItemVisible( item ); 773 packagesList->ensureItemVisible( item );
757 packagesList->setCurrentItem( item ); 774 packagesList->setCurrentItem( item );
758 break; 775 break;
759 } 776 }
760 } 777 }
761 } 778 }
762} 779}
763 780
764void MainWindow :: updateServer() 781void MainWindow :: updateServer()
765{ 782{
766 QString serverName = serversList->currentText(); 783 QString serverName = serversList->currentText();
767 784
768 // Update the current server 785 // Update the current server
769 // Display dialog 786 // Display dialog
770 787
771 // Disable buttons to stop silly people clicking lots on them :) 788 // Disable buttons to stop silly people clicking lots on them :)
772 789
773 // First, write out ipkg_conf file so that ipkg can use it 790 // First, write out ipkg_conf file so that ipkg can use it
774 mgr->writeOutIpkgConf(); 791 mgr->writeOutIpkgConf();
775 792
776 Ipkg *ipkg = new Ipkg; 793 Ipkg *ipkg = new Ipkg;
777 ipkg->setOption( "update" ); 794 ipkg->setOption( "update" );
778 795
779 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), 796 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ),
780 tr( "Update lists" ) ); 797 tr( "Update lists" ) );
781 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 798 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
782 dlg->showMaximized(); 799 stack->addWidget( dlg, 3 );
800 stack->raiseWidget( dlg );
783 801
784// delete progDlg; 802// delete progDlg;
785} 803}
786 804
787void MainWindow :: upgradePackages() 805void MainWindow :: upgradePackages()
788{ 806{
789 // We're gonna do an upgrade of all packages 807 // We're gonna do an upgrade of all packages
790 // First warn user that this isn't recommended 808 // First warn user that this isn't recommended
791 // TODO - ODevice???? 809 // TODO - ODevice????
792 QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); 810 QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" );
793 QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, 811 QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning,
794 QMessageBox::Yes, 812 QMessageBox::Yes,
795 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , 813 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ,
796 0, this ); 814 0, this );
797 warn.adjustSize(); 815 warn.adjustSize();
798 816
799 if ( warn.exec() == QMessageBox::Yes ) 817 if ( warn.exec() == QMessageBox::Yes )
800 { 818 {
801 // First, write out ipkg_conf file so that ipkg can use it 819 // First, write out ipkg_conf file so that ipkg can use it
802 mgr->writeOutIpkgConf(); 820 mgr->writeOutIpkgConf();
803 821
804 // Now run upgrade 822 // Now run upgrade
805 Ipkg *ipkg = new Ipkg; 823 Ipkg *ipkg = new Ipkg;
806 ipkg->setOption( "upgrade" ); 824 ipkg->setOption( "upgrade" );
807 825
808 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), 826 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ),
809 tr ( "Upgrade" ) ); 827 tr ( "Upgrade" ) );
810 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 828 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
811 dlg->showMaximized(); 829 stack->addWidget( dlg, 3 );
830 stack->raiseWidget( dlg );
812 } 831 }
813} 832}
814 833
815void MainWindow :: downloadPackage() 834void MainWindow :: downloadPackage()
816{ 835{
817 bool doUpdate = true; 836 bool doUpdate = true;
818 if ( downloadEnabled ) 837 if ( downloadEnabled )
819 { 838 {
820 // See if any packages are selected 839 // See if any packages are selected
821 bool found = false; 840 bool found = false;
822 if ( serversList->currentText() != LOCAL_SERVER ) 841 if ( serversList->currentText() != LOCAL_SERVER )
823 { 842 {
824 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 843 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
825 item != 0 && !found; 844 item != 0 && !found;
826 item = (QCheckListItem *)item->nextSibling() ) 845 item = (QCheckListItem *)item->nextSibling() )
827 { 846 {
828 if ( item->isOn() ) 847 if ( item->isOn() )
829 found = true; 848 found = true;
830 } 849 }
831 } 850 }
832 851
833 // If user selected some packages then download the and store the locally 852 // If user selected some packages then download the and store the locally
834 // otherwise, display dialog asking user what package to download from an http server 853 // otherwise, display dialog asking user what package to download from an http server
835 // and whether to install it 854 // and whether to install it
836 if ( found ) 855 if ( found )
837 downloadSelectedPackages(); 856 downloadSelectedPackages();
838 else 857 else
839 downloadRemotePackage(); 858 downloadRemotePackage();
840 859
841 } 860 }
842 else 861 else
843 { 862 {
844 doUpdate = false; 863 doUpdate = false;
845 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 864 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
846 item != 0 ; 865 item != 0 ;
847 item = (QCheckListItem *)item->nextSibling() ) 866 item = (QCheckListItem *)item->nextSibling() )
848 { 867 {
849 if ( item->isOn() ) 868 if ( item->isOn() )
850 { 869 {
851 QString name = item->text(); 870 QString name = item->text();
852 int pos = name.find( "*" ); 871 int pos = name.find( "*" );
853 name.truncate( pos ); 872 name.truncate( pos );
854 873
855 // if (there is a (installed), remove it 874 // if (there is a (installed), remove it
856 pos = name.find( "(installed)" ); 875 pos = name.find( "(installed)" );
857 if ( pos > 0 ) 876 if ( pos > 0 )
858 name.truncate( pos - 1 ); 877 name.truncate( pos - 1 );
859 878
@@ -904,135 +923,137 @@ void MainWindow :: downloadSelectedPackages()
904 cfg.writeEntry( "downloadDir", dir ); 923 cfg.writeEntry( "downloadDir", dir );
905#endif 924#endif
906 925
907 // Get starting directory 926 // Get starting directory
908 char initDir[PATH_MAX]; 927 char initDir[PATH_MAX];
909 getcwd( initDir, PATH_MAX ); 928 getcwd( initDir, PATH_MAX );
910 929
911 // Download each package 930 // Download each package
912 Ipkg ipkg; 931 Ipkg ipkg;
913 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 932 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
914 933
915 ipkg.setOption( "download" ); 934 ipkg.setOption( "download" );
916 ipkg.setRuntimeDirectory( dir ); 935 ipkg.setRuntimeDirectory( dir );
917 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 936 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
918 item != 0 ; 937 item != 0 ;
919 item = (QCheckListItem *)item->nextSibling() ) 938 item = (QCheckListItem *)item->nextSibling() )
920 { 939 {
921 if ( item->isOn() ) 940 if ( item->isOn() )
922 { 941 {
923 ipkg.setPackage( item->text() ); 942 ipkg.setPackage( item->text() );
924 ipkg.runIpkg( ); 943 ipkg.runIpkg( );
925 } 944 }
926 } 945 }
927} 946}
928 947
929void MainWindow :: downloadRemotePackage() 948void MainWindow :: downloadRemotePackage()
930{ 949{
931 // Display dialog 950 // Display dialog
932 bool ok; 951 bool ok;
933 QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this ); 952 QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this );
934 if ( !ok || package.isEmpty() ) 953 if ( !ok || package.isEmpty() )
935 return; 954 return;
936// DownloadRemoteDlgImpl dlg( this, "Install", true ); 955// DownloadRemoteDlgImpl dlg( this, "Install", true );
937// if ( dlg.exec() == QDialog::Rejected ) 956// if ( dlg.exec() == QDialog::Rejected )
938// return; 957// return;
939 958
940 // grab details from dialog 959 // grab details from dialog
941// QString package = dlg.getPackageLocation(); 960// QString package = dlg.getPackageLocation();
942 961
943 InstallData *item = new InstallData(); 962 InstallData *item = new InstallData();
944 item->option = "I"; 963 item->option = "I";
945 item->packageName = package; 964 item->packageName = package;
946 QList<InstallData> workingPackages; 965 QList<InstallData> workingPackages;
947 workingPackages.setAutoDelete( TRUE ); 966 workingPackages.setAutoDelete( TRUE );
948 workingPackages.append( item ); 967 workingPackages.append( item );
949 968
950 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); 969 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) );
951 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 970 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
952 dlg->showMaximized(); 971 stack->addWidget( dlg, 3 );
972 stack->raiseWidget( dlg );
953} 973}
954 974
955 975
956void MainWindow :: applyChanges() 976void MainWindow :: applyChanges()
957{ 977{
958 stickyOption = ""; 978 stickyOption = "";
959 979
960 // First, write out ipkg_conf file so that ipkg can use it 980 // First, write out ipkg_conf file so that ipkg can use it
961 mgr->writeOutIpkgConf(); 981 mgr->writeOutIpkgConf();
962 982
963 // Now for each selected item 983 // Now for each selected item
964 // deal with it 984 // deal with it
965 985
966 QList<InstallData> workingPackages; 986 QList<InstallData> workingPackages;
967 workingPackages.setAutoDelete( TRUE ); 987 workingPackages.setAutoDelete( TRUE );
968 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 988 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
969 item != 0 ; 989 item != 0 ;
970 item = (QCheckListItem *)item->nextSibling() ) 990 item = (QCheckListItem *)item->nextSibling() )
971 { 991 {
972 if ( item->isOn() ) 992 if ( item->isOn() )
973 { 993 {
974 workingPackages.append( dealWithItem( item ) ); 994 workingPackages.append( dealWithItem( item ) );
975 } 995 }
976 } 996 }
977 997
978 if ( workingPackages.count() == 0 ) 998 if ( workingPackages.count() == 0 )
979 { 999 {
980 // Nothing to do 1000 // Nothing to do
981 QMessageBox::information( this, tr( "Nothing to do" ), 1001 QMessageBox::information( this, tr( "Nothing to do" ),
982 tr( "No packages selected" ), tr( "OK" ) ); 1002 tr( "No packages selected" ), tr( "OK" ) );
983 1003
984 return; 1004 return;
985 } 1005 }
986 1006
987 // do the stuff 1007 // do the stuff
988 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); 1008 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) );
989 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 1009 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
990 dlg->showMaximized(); 1010 stack->addWidget( dlg, 3 );
1011 stack->raiseWidget( dlg );
991} 1012}
992 1013
993// decide what to do - either remove, upgrade or install 1014// decide what to do - either remove, upgrade or install
994// Current rules: 1015// Current rules:
995// If not installed - install 1016// If not installed - install
996// If installed and different version available - upgrade 1017// If installed and different version available - upgrade
997// If installed and version up to date - remove 1018// If installed and version up to date - remove
998InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) 1019InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
999{ 1020{
1000 QString name = item->text(); 1021 QString name = item->text();
1001 1022
1002 // Get package 1023 // Get package
1003 Server *s = mgr->getServer( serversList->currentText() ); 1024 Server *s = mgr->getServer( serversList->currentText() );
1004 Package *p = s->getPackage( name ); 1025 Package *p = s->getPackage( name );
1005 1026
1006 // If the package has a filename then it is a local file 1027 // If the package has a filename then it is a local file
1007 if ( p->isPackageStoredLocally() ) 1028 if ( p->isPackageStoredLocally() )
1008 name = p->getFilename(); 1029 name = p->getFilename();
1009 1030
1010 QString option; 1031 QString option;
1011 QString dest = "root"; 1032 QString dest = "root";
1012 if ( !p->isInstalled() ) 1033 if ( !p->isInstalled() )
1013 { 1034 {
1014 InstallData *newitem = new InstallData();; 1035 InstallData *newitem = new InstallData();;
1015 newitem->option = "I"; 1036 newitem->option = "I";
1016 newitem->packageName = name; 1037 newitem->packageName = name;
1017 return newitem; 1038 return newitem;
1018 } 1039 }
1019 else 1040 else
1020 { 1041 {
1021 InstallData *newitem = new InstallData();; 1042 InstallData *newitem = new InstallData();;
1022 newitem->option = "D"; 1043 newitem->option = "D";
1023 if ( !p->isPackageStoredLocally() ) 1044 if ( !p->isPackageStoredLocally() )
1024 newitem->packageName = p->getInstalledPackageName(); 1045 newitem->packageName = p->getInstalledPackageName();
1025 else 1046 else
1026 newitem->packageName = name; 1047 newitem->packageName = name;
1027 1048
1028 if ( p->getInstalledTo() ) 1049 if ( p->getInstalledTo() )
1029 { 1050 {
1030 newitem->destination = p->getInstalledTo(); 1051 newitem->destination = p->getInstalledTo();
1031// cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; 1052// cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl;
1032// cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; 1053// cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl;
1033 } 1054 }
1034 else 1055 else
1035 { 1056 {
1036 newitem->destination = p->getLocalPackage()->getInstalledTo(); 1057 newitem->destination = p->getLocalPackage()->getInstalledTo();
1037 } 1058 }
1038 1059
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h
index d75e5d2..b2de871 100644
--- a/noncore/settings/aqpkg/mainwin.h
+++ b/noncore/settings/aqpkg/mainwin.h
@@ -1,93 +1,96 @@
1/*************************************************************************** 1/***************************************************************************
2 mainwin.h - description 2 mainwin.h - description
3 ------------------- 3 -------------------
4 begin : Mon Aug 26 13:32:30 BST 2002 4 begin : Mon Aug 26 13:32:30 BST 2002
5 copyright : (C) 2002 by Andy Qua 5 copyright : (C) 2002 by Andy Qua
6 email : andy.qua@blueyonder.co.uk 6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#ifndef MAINWIN_H 18#ifndef MAINWIN_H
19#define MAINWIN_H 19#define MAINWIN_H
20 20
21#include <qmainwindow.h> 21#include <qmainwindow.h>
22#include <qpixmap.h> 22#include <qpixmap.h>
23 23
24class DataManager; 24class DataManager;
25class InstallData; 25class InstallData;
26class InstallDlgImpl; 26class InstallDlgImpl;
27 27
28class QAction; 28class QAction;
29class QCheckListItem; 29class QCheckListItem;
30class QComboBox; 30class QComboBox;
31class QLabel; 31class QLabel;
32class QLineEdit; 32class QLineEdit;
33class QListView; 33class QListView;
34class QPEToolBar; 34class QPEToolBar;
35class QProgressBar; 35class QProgressBar;
36class QWidgetStack; 36class QWidgetStack;
37 37
38class MainWindow :public QMainWindow 38class MainWindow :public QMainWindow
39{ 39{
40 Q_OBJECT 40 Q_OBJECT
41public: 41public:
42 42
43 MainWindow(); 43 MainWindow();
44 ~MainWindow(); 44 ~MainWindow();
45 45
46protected:
47 void closeEvent( QCloseEvent* e );
48
46private: 49private:
47 DataManager *mgr; 50 DataManager *mgr;
48 51
49 QWidgetStack *stack; 52 QWidgetStack *stack;
50 53
51 QPEToolBar *findBar; 54 QPEToolBar *findBar;
52 QPEToolBar *jumpBar; 55 QPEToolBar *jumpBar;
53 QLineEdit *findEdit; 56 QLineEdit *findEdit;
54 QAction *actionFindNext; 57 QAction *actionFindNext;
55 QAction *actionFilter; 58 QAction *actionFilter;
56 QAction *actionUpgrade; 59 QAction *actionUpgrade;
57 QAction *actionDownload; 60 QAction *actionDownload;
58 QAction *actionUninstalled; 61 QAction *actionUninstalled;
59 QAction *actionInstalled; 62 QAction *actionInstalled;
60 QAction *actionUpdated; 63 QAction *actionUpdated;
61 64
62 QPixmap iconDownload; 65 QPixmap iconDownload;
63 QPixmap iconRemove; 66 QPixmap iconRemove;
64 67
65 int mnuShowUninstalledPkgsId; 68 int mnuShowUninstalledPkgsId;
66 int mnuShowInstalledPkgsId; 69 int mnuShowInstalledPkgsId;
67 int mnuShowUpgradedPkgsId; 70 int mnuShowUpgradedPkgsId;
68 int mnuFilterByCategory; 71 int mnuFilterByCategory;
69 int mnuSetFilterCategory; 72 int mnuSetFilterCategory;
70 73
71 // Main package list widget 74 // Main package list widget
72 QWidget *networkPkgWindow; 75 QWidget *networkPkgWindow;
73 QComboBox *serversList; 76 QComboBox *serversList;
74 QListView *packagesList; 77 QListView *packagesList;
75 QPixmap installedIcon; 78 QPixmap installedIcon;
76 QPixmap updatedIcon; 79 QPixmap updatedIcon;
77 QString currentlySelectedServer; 80 QString currentlySelectedServer;
78 QString categoryFilter; 81 QString categoryFilter;
79 QString stickyOption; 82 QString stickyOption;
80 83
81 bool categoryFilterEnabled; 84 bool categoryFilterEnabled;
82 bool showJumpTo; 85 bool showJumpTo;
83 bool showUninstalledPkgs; 86 bool showUninstalledPkgs;
84 bool showInstalledPkgs; 87 bool showInstalledPkgs;
85 bool showUpgradedPkgs; 88 bool showUpgradedPkgs;
86 bool downloadEnabled; 89 bool downloadEnabled;
87 90
88 void initMainWidget(); 91 void initMainWidget();
89 void updateData(); 92 void updateData();
90 void serverSelected( int index, bool showProgress ); 93 void serverSelected( int index, bool showProgress );
91 void searchForPackage( const QString & ); 94 void searchForPackage( const QString & );
92 bool filterByCategory( bool val ); 95 bool filterByCategory( bool val );
93 void downloadSelectedPackages(); 96 void downloadSelectedPackages();