summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp7
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.h2
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp8
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp4
4 files changed, 13 insertions, 8 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index f5aef94..83f983a 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -1,237 +1,240 @@
1/*************************************************************************** 1/***************************************************************************
2 installdlgimpl.cpp - description 2 installdlgimpl.cpp - description
3 ------------------- 3 -------------------
4 begin : Mon Aug 26 2002 4 begin : Mon Aug 26 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#ifdef QWS 18#ifdef QWS
19#include <qpe/config.h> 19#include <qpe/config.h>
20#endif 20#endif
21 21
22#include <qmultilineedit.h> 22#include <qmultilineedit.h>
23#include <qdialog.h> 23#include <qdialog.h>
24#include <qcombobox.h> 24#include <qcombobox.h>
25#include <qcheckbox.h> 25#include <qcheckbox.h>
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27 27
28 28
29#include "datamgr.h" 29#include "datamgr.h"
30#include "instoptionsimpl.h" 30#include "instoptionsimpl.h"
31#include "destination.h" 31#include "destination.h"
32#include "installdlgimpl.h" 32#include "installdlgimpl.h"
33#include "global.h" 33#include "global.h"
34 34
35InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) 35InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
36 : InstallDlg( parent, name, modal, fl ) 36 : InstallDlg( parent, name, modal, fl )
37{ 37{
38 pIpkg = 0; 38 pIpkg = 0;
39 upgradePackages = false; 39 upgradePackages = false;
40 dataMgr = dataManager; 40 dataMgr = dataManager;
41 vector<Destination>::iterator dit; 41 vector<Destination>::iterator dit;
42 42
43 QString defaultDest = "root"; 43 QString defaultDest = "root";
44#ifdef QWS 44#ifdef QWS
45 Config cfg( "aqpkg" ); 45 Config cfg( "aqpkg" );
46 cfg.setGroup( "settings" ); 46 cfg.setGroup( "settings" );
47 defaultDest = cfg.readEntry( "dest", "root" ); 47 defaultDest = cfg.readEntry( "dest", "root" );
48 48
49 // Grab flags - Turn MAKE_LINKS on by default (if no flags found) 49 // Grab flags - Turn MAKE_LINKS on by default (if no flags found)
50// flags = cfg.readNumEntry( "installFlags", MAKE_LINKS ); 50// flags = cfg.readNumEntry( "installFlags", MAKE_LINKS );
51 flags = 0; 51 flags = 0;
52#else 52#else
53 flags = 0; 53 flags = 0;
54#endif 54#endif
55 55
56 // Output text is read only 56 // Output text is read only
57 output->setReadOnly( true ); 57 output->setReadOnly( true );
58 QFont f( "helvetica" ); 58 QFont f( "helvetica" );
59 f.setPointSize( 10 ); 59 f.setPointSize( 10 );
60 output->setFont( f ); 60 output->setFont( f );
61 61
62 62
63 // setup destination data 63 // setup destination data
64 int defIndex = 0; 64 int defIndex = 0;
65 int i; 65 int i;
66 for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i ) 66 for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i )
67 { 67 {
68 destination->insertItem( dit->getDestinationName() ); 68 destination->insertItem( dit->getDestinationName() );
69 if ( dit->getDestinationName() == defaultDest ) 69 if ( dit->getDestinationName() == defaultDest )
70 defIndex = i; 70 defIndex = i;
71 } 71 }
72 72
73 destination->setCurrentItem( defIndex ); 73 destination->setCurrentItem( defIndex );
74 74
75 vector<InstallData>::iterator it; 75 vector<InstallData>::iterator it;
76 // setup package data 76 // setup package data
77 QString remove = "Remove\n"; 77 QString remove = "Remove\n";
78 QString install = "\nInstall\n"; 78 QString install = "\nInstall\n";
79 QString upgrade = "\nUpgrade\n"; 79 QString upgrade = "\nUpgrade\n";
80 for ( it = packageList.begin() ; it != packageList.end() ; ++it ) 80 for ( it = packageList.begin() ; it != packageList.end() ; ++it )
81 { 81 {
82 InstallData item = *it; 82 InstallData item = *it;
83 if ( item.option == "I" ) 83 if ( item.option == "I" )
84 { 84 {
85 installList.push_back( item ); 85 installList.push_back( item );
86 install += " " + item.packageName + "\n"; 86 install += " " + item.packageName + "\n";
87 } 87 }
88 else if ( item.option == "D" ) 88 else if ( item.option == "D" )
89 { 89 {
90 removeList.push_back( item ); 90 removeList.push_back( item );
91 remove += " " + item.packageName + "\n"; 91 remove += " " + item.packageName + "\n";
92 } 92 }
93 else if ( item.option == "U" ) 93 else if ( item.option == "U" || item.option == "R" )
94 { 94 {
95 updateList.push_back( item ); 95 updateList.push_back( item );
96 upgrade += " " + item.packageName + "\n"; 96 upgrade += " " + item.packageName + "\n";
97 } 97 }
98 } 98 }
99 99
100 output->setText( remove + install + upgrade ); 100 output->setText( remove + install + upgrade );
101} 101}
102 102
103InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl ) 103InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl )
104 : InstallDlg( parent, name, modal, fl ) 104 : InstallDlg( parent, name, modal, fl )
105{ 105{
106 pIpkg = ipkg; 106 pIpkg = ipkg;
107 output->setText( initialText ); 107 output->setText( initialText );
108} 108}
109 109
110 110
111InstallDlgImpl::~InstallDlgImpl() 111InstallDlgImpl::~InstallDlgImpl()
112{ 112{
113} 113}
114 114
115bool InstallDlgImpl :: showDlg() 115bool InstallDlgImpl :: showDlg()
116{ 116{
117 showMaximized(); 117 showMaximized();
118 bool ret = exec(); 118 bool ret = exec();
119 119
120 return ret; 120 return ret;
121} 121}
122 122
123void InstallDlgImpl :: optionsSelected() 123void InstallDlgImpl :: optionsSelected()
124{ 124{
125 InstallOptionsDlgImpl opt( flags, this, "Option", true ); 125 InstallOptionsDlgImpl opt( flags, this, "Option", true );
126 opt.exec(); 126 opt.exec();
127 127
128 // set options selected from dialog 128 // set options selected from dialog
129 flags = 0; 129 flags = 0;
130 if ( opt.forceDepends->isChecked() ) 130 if ( opt.forceDepends->isChecked() )
131 flags |= FORCE_DEPENDS; 131 flags |= FORCE_DEPENDS;
132 if ( opt.forceReinstall->isChecked() ) 132 if ( opt.forceReinstall->isChecked() )
133 flags |= FORCE_REINSTALL; 133 flags |= FORCE_REINSTALL;
134 if ( opt.forceRemove->isChecked() ) 134 if ( opt.forceRemove->isChecked() )
135 flags |= FORCE_REMOVE; 135 flags |= FORCE_REMOVE;
136 if ( opt.forceOverwrite->isChecked() ) 136 if ( opt.forceOverwrite->isChecked() )
137 flags |= FORCE_OVERWRITE; 137 flags |= FORCE_OVERWRITE;
138 138
139#ifdef QWS 139#ifdef QWS
140 Config cfg( "aqpkg" ); 140 Config cfg( "aqpkg" );
141 cfg.setGroup( "settings" ); 141 cfg.setGroup( "settings" );
142 cfg.writeEntry( "installFlags", flags ); 142 cfg.writeEntry( "installFlags", flags );
143#endif 143#endif
144} 144}
145 145
146void InstallDlgImpl :: installSelected() 146void InstallDlgImpl :: installSelected()
147{ 147{
148 if ( btnInstall->text() == "Close" ) 148 if ( btnInstall->text() == "Close" )
149 { 149 {
150 done( 1 ); 150 done( 1 );
151 return; 151 return;
152 } 152 }
153 153
154 btnInstall->setEnabled( false ); 154 btnInstall->setEnabled( false );
155 155
156 if ( pIpkg ) 156 if ( pIpkg )
157 { 157 {
158 output->setText( "" ); 158 output->setText( "" );
159 159
160 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 160 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
161 pIpkg->runIpkg(); 161 pIpkg->runIpkg();
162 } 162 }
163 else 163 else
164 { 164 {
165 output->setText( "" ); 165 output->setText( "" );
166 Destination *d = dataMgr->getDestination( destination->currentText() ); 166 Destination *d = dataMgr->getDestination( destination->currentText() );
167 QString dest = d->getDestinationName(); 167 QString dest = d->getDestinationName();
168 QString destDir = d->getDestinationPath(); 168 QString destDir = d->getDestinationPath();
169 int instFlags = flags; 169 int instFlags = flags;
170 if ( d->linkToRoot() ) 170 if ( d->linkToRoot() )
171 instFlags |= MAKE_LINKS; 171 instFlags |= MAKE_LINKS;
172 172
173#ifdef QWS 173#ifdef QWS
174 // Save settings 174 // Save settings
175 Config cfg( "aqpkg" ); 175 Config cfg( "aqpkg" );
176 cfg.setGroup( "settings" ); 176 cfg.setGroup( "settings" );
177 cfg.writeEntry( "dest", dest ); 177 cfg.writeEntry( "dest", dest );
178#endif 178#endif
179 179
180 pIpkg = new Ipkg; 180 pIpkg = new Ipkg;
181 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 181 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
182 182
183 // First run through the remove list, then the install list then the upgrade list 183 // First run through the remove list, then the install list then the upgrade list
184 vector<InstallData>::iterator it; 184 vector<InstallData>::iterator it;
185 pIpkg->setOption( "remove" ); 185 pIpkg->setOption( "remove" );
186 for ( it = removeList.begin() ; it != removeList.end() ; ++it ) 186 for ( it = removeList.begin() ; it != removeList.end() ; ++it )
187 { 187 {
188 pIpkg->setDestination( it->destination->getDestinationName() ); 188 pIpkg->setDestination( it->destination->getDestinationName() );
189 pIpkg->setDestinationDir( it->destination->getDestinationPath() ); 189 pIpkg->setDestinationDir( it->destination->getDestinationPath() );
190 pIpkg->setPackage( it->packageName ); 190 pIpkg->setPackage( it->packageName );
191 191
192 int tmpFlags = flags; 192 int tmpFlags = flags;
193 if ( it->destination->linkToRoot() ) 193 if ( it->destination->linkToRoot() )
194 tmpFlags |= MAKE_LINKS; 194 tmpFlags |= MAKE_LINKS;
195 195
196 pIpkg->setFlags( tmpFlags ); 196 pIpkg->setFlags( tmpFlags );
197 pIpkg->runIpkg(); 197 pIpkg->runIpkg();
198 } 198 }
199 199
200 pIpkg->setOption( "install" ); 200 pIpkg->setOption( "install" );
201 pIpkg->setDestination( dest ); 201 pIpkg->setDestination( dest );
202 pIpkg->setDestinationDir( destDir ); 202 pIpkg->setDestinationDir( destDir );
203 pIpkg->setFlags( instFlags ); 203 pIpkg->setFlags( instFlags );
204 for ( it = installList.begin() ; it != installList.end() ; ++it ) 204 for ( it = installList.begin() ; it != installList.end() ; ++it )
205 { 205 {
206 pIpkg->setPackage( it->packageName ); 206 pIpkg->setPackage( it->packageName );
207 pIpkg->runIpkg(); 207 pIpkg->runIpkg();
208 } 208 }
209 209
210 flags |= FORCE_REINSTALL; 210 flags |= FORCE_REINSTALL;
211 pIpkg->setOption( "reinstall" );
212 for ( it = updateList.begin() ; it != updateList.end() ; ++it ) 211 for ( it = updateList.begin() ; it != updateList.end() ; ++it )
213 { 212 {
213 if ( it->option == "R" )
214 pIpkg->setOption( "reinstall" );
215 else
216 pIpkg->setOption( "upgrade" );
214 pIpkg->setDestination( it->destination->getDestinationName() ); 217 pIpkg->setDestination( it->destination->getDestinationName() );
215 pIpkg->setDestinationDir( it->destination->getDestinationPath() ); 218 pIpkg->setDestinationDir( it->destination->getDestinationPath() );
216 pIpkg->setPackage( it->packageName ); 219 pIpkg->setPackage( it->packageName );
217 220
218 int tmpFlags = flags; 221 int tmpFlags = flags;
219 if ( it->destination->linkToRoot() && it->recreateLinks ) 222 if ( it->destination->linkToRoot() && it->recreateLinks )
220 tmpFlags |= MAKE_LINKS; 223 tmpFlags |= MAKE_LINKS;
221 pIpkg->setFlags( tmpFlags ); 224 pIpkg->setFlags( tmpFlags );
222 pIpkg->runIpkg(); 225 pIpkg->runIpkg();
223 } 226 }
224 227
225 delete pIpkg; 228 delete pIpkg;
226 } 229 }
227 230
228 btnInstall->setEnabled( true ); 231 btnInstall->setEnabled( true );
229 btnInstall->setText( tr( "Close" ) ); 232 btnInstall->setText( tr( "Close" ) );
230} 233}
231 234
232void InstallDlgImpl :: displayText(const QString &text ) 235void InstallDlgImpl :: displayText(const QString &text )
233{ 236{
234 QString t = output->text() + "\n" + text; 237 QString t = output->text() + "\n" + text;
235 output->setText( t ); 238 output->setText( t );
236 output->setCursorPosition( output->numLines(), 0 ); 239 output->setCursorPosition( output->numLines(), 0 );
237} 240}
diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h
index 6716ced..9819b2e 100644
--- a/noncore/settings/aqpkg/installdlgimpl.h
+++ b/noncore/settings/aqpkg/installdlgimpl.h
@@ -1,65 +1,65 @@
1/*************************************************************************** 1/***************************************************************************
2 installdlgimpl.h - description 2 installdlgimpl.h - description
3 ------------------- 3 -------------------
4 begin : Mon Aug 26 2002 4 begin : Mon Aug 26 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#ifndef INSTALLDLGIMPL_H 17#ifndef INSTALLDLGIMPL_H
18#define INSTALLDLGIMPL_H 18#define INSTALLDLGIMPL_H
19 19
20#include <vector> 20#include <vector>
21using namespace std; 21using namespace std;
22 22
23#include <qstring.h> 23#include <qstring.h>
24 24
25#include "ipkg.h" 25#include "ipkg.h"
26#include "install.h" 26#include "install.h"
27 27
28class InstallData 28class InstallData
29{ 29{
30public: 30public:
31 QString option; // I - install, D - delete, U - upgrade 31 QString option; // I - install, D - delete, R- reinstall U - upgrade
32 QString packageName; 32 QString packageName;
33 Destination *destination; 33 Destination *destination;
34 bool recreateLinks; 34 bool recreateLinks;
35}; 35};
36 36
37class InstallDlgImpl : public InstallDlg 37class InstallDlgImpl : public InstallDlg
38{ 38{
39public: 39public:
40 InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); 40 InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
41 InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); 41 InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
42 ~InstallDlgImpl(); 42 ~InstallDlgImpl();
43 43
44 bool showDlg(); 44 bool showDlg();
45 bool upgradeServer( QString &server ); 45 bool upgradeServer( QString &server );
46 46
47protected: 47protected:
48 48
49private: 49private:
50 DataManager *dataMgr; 50 DataManager *dataMgr;
51 vector<InstallData> installList; 51 vector<InstallData> installList;
52 vector<InstallData> removeList; 52 vector<InstallData> removeList;
53 vector<InstallData> updateList; 53 vector<InstallData> updateList;
54 int flags; 54 int flags;
55 Ipkg *pIpkg; 55 Ipkg *pIpkg;
56 bool upgradePackages; 56 bool upgradePackages;
57 57
58 bool runIpkg( QString &option, const QString& package, const QString& dest, int flags ); 58 bool runIpkg( QString &option, const QString& package, const QString& dest, int flags );
59 59
60 void optionsSelected(); 60 void optionsSelected();
61 void installSelected(); 61 void installSelected();
62 void displayText(const QString &text ); 62 void displayText(const QString &text );
63}; 63};
64 64
65#endif 65#endif
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
index 368548b..731a336 100644
--- a/noncore/settings/aqpkg/ipkg.cpp
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -1,296 +1,294 @@
1/*************************************************************************** 1/***************************************************************************
2 ipkg.cpp - description 2 ipkg.cpp - description
3 ------------------- 3 -------------------
4 begin : Sat Aug 31 2002 4 begin : Sat Aug 31 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#include <fstream> 18#include <fstream>
19using namespace std; 19using namespace std;
20 20
21#include <stdio.h> 21#include <stdio.h>
22#include <unistd.h> 22#include <unistd.h>
23 23
24#ifdef QWS 24#ifdef QWS
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#else 26#else
27#include <qapplication.h> 27#include <qapplication.h>
28#endif 28#endif
29#include <qdir.h> 29#include <qdir.h>
30#include <qtextstream.h> 30#include <qtextstream.h>
31 31
32#include "utils.h" 32#include "utils.h"
33#include "ipkg.h" 33#include "ipkg.h"
34#include "global.h" 34#include "global.h"
35 35
36Ipkg :: Ipkg() 36Ipkg :: Ipkg()
37{ 37{
38} 38}
39 39
40Ipkg :: ~Ipkg() 40Ipkg :: ~Ipkg()
41{ 41{
42} 42}
43 43
44// Option is what we are going to do - install, upgrade, download, reinstall 44// Option is what we are going to do - install, upgrade, download, reinstall
45// package is the package name to install - either a fully qualified path and ipk 45// package is the package name to install - either a fully qualified path and ipk
46// file (if stored locally) or just the name of the package (for a network package) 46// file (if stored locally) or just the name of the package (for a network package)
47// packageName is the package name - (for a network package this will be the same as 47// packageName is the package name - (for a network package this will be the same as
48// package parameter) 48// package parameter)
49// dest is the destination alias (from ipk.conf) 49// dest is the destination alias (from ipk.conf)
50// destDir is the dir that the destination alias points to (used to link to root) 50// destDir is the dir that the destination alias points to (used to link to root)
51// flags is the ipkg options flags 51// flags is the ipkg options flags
52// dir is the directory to run ipkg in (defaults to "") 52// dir is the directory to run ipkg in (defaults to "")
53bool Ipkg :: runIpkg( ) 53bool Ipkg :: runIpkg( )
54{ 54{
55 bool ret = false; 55 bool ret = false;
56 56
57 QDir::setCurrent( "/tmp" ); 57 QDir::setCurrent( "/tmp" );
58 QString cmd = ""; 58 QString cmd = "";
59 59
60 if ( runtimeDir != "" ) 60 if ( runtimeDir != "" )
61 { 61 {
62 cmd += "cd "; 62 cmd += "cd ";
63 cmd += runtimeDir; 63 cmd += runtimeDir;
64 cmd += " ; "; 64 cmd += " ; ";
65 } 65 }
66 cmd += "ipkg"; 66 cmd += "ipkg -force-defaults";
67 67 if ( option != "update" && option != "download" )
68 if ( option != "update" && option != "download" && option != "upgrade" )
69 { 68 {
70 cmd += " -dest "+ destination; 69 cmd += " -dest "+ destination;
71 cmd += " -force-defaults";
72 70
73 if ( flags & FORCE_DEPENDS ) 71 if ( flags & FORCE_DEPENDS )
74 cmd += " -force-depends"; 72 cmd += " -force-depends";
75 if ( flags & FORCE_REINSTALL ) 73 if ( flags & FORCE_REINSTALL )
76 cmd += " -force-reinstall"; 74 cmd += " -force-reinstall";
77 if ( flags & FORCE_REMOVE ) 75 if ( flags & FORCE_REMOVE )
78 cmd += " -force-removal-of-essential-packages"; 76 cmd += " -force-removal-of-essential-packages";
79 if ( flags & FORCE_OVERWRITE ) 77 if ( flags & FORCE_OVERWRITE )
80 cmd += " -force-overwrite"; 78 cmd += " -force-overwrite";
81 79
82 // Handle make links 80 // Handle make links
83 // Rules - If make links is switched on, create links to root 81 // Rules - If make links is switched on, create links to root
84 // if destDir is NOT / 82 // if destDir is NOT /
85 if ( flags & MAKE_LINKS ) 83 if ( flags & MAKE_LINKS )
86 { 84 {
87 // If destDir == / turn off make links as package is being insalled 85 // If destDir == / turn off make links as package is being insalled
88 // to root already. 86 // to root already.
89 if ( destDir == "/" ) 87 if ( destDir == "/" )
90 flags ^= MAKE_LINKS; 88 flags ^= MAKE_LINKS;
91 } 89 }
92 } 90 }
93 91
94#ifdef X86 92#ifdef X86
95 cmd += " -f "; 93 cmd += " -f ";
96 cmd += IPKG_CONF; 94 cmd += IPKG_CONF;
97#endif 95#endif
98 96
99 97
100 if ( option == "reinstall" ) 98 if ( option == "reinstall" )
101 cmd += " install"; 99 cmd += " install";
102 else 100 else
103 cmd += " " + option; 101 cmd += " " + option;
104 if ( option != "upgrade" ) 102 if ( package != "" )
105 cmd += " " + package; 103 cmd += " " + package;
106 cmd += " 2>&1"; 104 cmd += " 2>&1";
107 105
108 106
109 if ( package != "" ) 107 if ( package != "" )
110 emit outputText( QString( "Dealing with package " ) + package ); 108 emit outputText( QString( "Dealing with package " ) + package );
111 109
112 qApp->processEvents(); 110 qApp->processEvents();
113 111
114 // If we are removing packages and make links option is selected 112 // If we are removing packages and make links option is selected
115 // create the links 113 // create the links
116 if ( option == "remove" || option == "reinstall" ) 114 if ( option == "remove" || option == "reinstall" )
117 { 115 {
118 createLinks = false; 116 createLinks = false;
119 if ( flags & MAKE_LINKS ) 117 if ( flags & MAKE_LINKS )
120 { 118 {
121 emit outputText( QString( "Removing symbolic links...\n" ) ); 119 emit outputText( QString( "Removing symbolic links...\n" ) );
122 linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); 120 linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
123 emit outputText( QString( " " ) ); 121 emit outputText( QString( " " ) );
124 } 122 }
125 } 123 }
126 124
127 emit outputText( cmd ); 125 emit outputText( cmd );
128 126
129 // Execute command 127 // Execute command
130 dependantPackages = new QList<QString>; 128 dependantPackages = new QList<QString>;
131 dependantPackages->setAutoDelete( true ); 129 dependantPackages->setAutoDelete( true );
132 130
133 ret = executeIpkgCommand( cmd, option ); 131 ret = executeIpkgCommand( cmd, option );
134 132
135 if ( option == "install" || option == "reinstall" ) 133 if ( option == "install" || option == "reinstall" )
136 { 134 {
137 // If we are not removing packages and make links option is selected 135 // If we are not removing packages and make links option is selected
138 // create the links 136 // create the links
139 createLinks = true; 137 createLinks = true;
140 if ( flags & MAKE_LINKS ) 138 if ( flags & MAKE_LINKS )
141 { 139 {
142 emit outputText( " " ); 140 emit outputText( " " );
143 emit outputText( QString( "Creating symbolic links for " )+ package ); 141 emit outputText( QString( "Creating symbolic links for " )+ package );
144 142
145 linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); 143 linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
146 144
147 // link dependant packages that were installed with this release 145 // link dependant packages that were installed with this release
148 QString *pkg; 146 QString *pkg;
149 for ( pkg = dependantPackages->first(); pkg != 0; pkg = dependantPackages->next() ) 147 for ( pkg = dependantPackages->first(); pkg != 0; pkg = dependantPackages->next() )
150 { 148 {
151 if ( *pkg == package ) 149 if ( *pkg == package )
152 continue; 150 continue;
153 emit outputText( " " ); 151 emit outputText( " " );
154 emit outputText( QString( "Creating symbolic links for " )+ (*pkg) ); 152 emit outputText( QString( "Creating symbolic links for " )+ (*pkg) );
155 linkPackage( Utils::getPackageNameFromIpkFilename( *pkg ), destination, destDir ); 153 linkPackage( Utils::getPackageNameFromIpkFilename( *pkg ), destination, destDir );
156 } 154 }
157 } 155 }
158 } 156 }
159 157
160 delete dependantPackages; 158 delete dependantPackages;
161 159
162 emit outputText( QString( "Finished - status=" ) + (ret ? "success" : "failure") ); 160 emit outputText( QString( "Finished - status=" ) + (ret ? "success" : "failure") );
163 emit outputText( "" ); 161 emit outputText( "" );
164 return ret; 162 return ret;
165} 163}
166 164
167 165
168int Ipkg :: executeIpkgCommand( QString &cmd, const QString option ) 166int Ipkg :: executeIpkgCommand( QString &cmd, const QString option )
169{ 167{
170 FILE *fp = NULL; 168 FILE *fp = NULL;
171 char line[130]; 169 char line[130];
172 QString lineStr, lineStrOld; 170 QString lineStr, lineStrOld;
173 int ret = false; 171 int ret = false;
174 172
175 fp = popen( (const char *) cmd, "r"); 173 fp = popen( (const char *) cmd, "r");
176 if ( fp == NULL ) 174 if ( fp == NULL )
177 { 175 {
178 cout << "Couldn't execute " << cmd << "! err = " << fp << endl; 176 cout << "Couldn't execute " << cmd << "! err = " << fp << endl;
179 QString text; 177 QString text;
180 text.sprintf( "Couldn't execute %s! See stdout for error code", (const char *)cmd ); 178 text.sprintf( "Couldn't execute %s! See stdout for error code", (const char *)cmd );
181 emit outputText( text ); 179 emit outputText( text );
182 } 180 }
183 else 181 else
184 { 182 {
185 while ( fgets( line, sizeof line, fp) != NULL ) 183 while ( fgets( line, sizeof line, fp) != NULL )
186 { 184 {
187 lineStr = line; 185 lineStr = line;
188 lineStr=lineStr.left( lineStr.length()-1 ); 186 lineStr=lineStr.left( lineStr.length()-1 );
189 187
190 if ( lineStr != lineStrOld ) 188 if ( lineStr != lineStrOld )
191 { 189 {
192 //See if we're finished 190 //See if we're finished
193 if ( option == "install" || option == "reinstall" ) 191 if ( option == "install" || option == "reinstall" )
194 { 192 {
195 // Need to keep track of any dependant packages that get installed 193 // Need to keep track of any dependant packages that get installed
196 // so that we can create links to them as necessary 194 // so that we can create links to them as necessary
197 if ( lineStr.startsWith( "Installing " ) ) 195 if ( lineStr.startsWith( "Installing " ) )
198 { 196 {
199 int start = lineStr.find( " " ) + 1; 197 int start = lineStr.find( " " ) + 1;
200 int end = lineStr.find( " ", start ); 198 int end = lineStr.find( " ", start );
201 QString *package = new QString( lineStr.mid( start, end-start ) ); 199 QString *package = new QString( lineStr.mid( start, end-start ) );
202 dependantPackages->append( package ); 200 dependantPackages->append( package );
203 } 201 }
204 } 202 }
205 203
206 if ( option == "update" ) 204 if ( option == "update" )
207 { 205 {
208 if (lineStr.contains("Updated list")) 206 if (lineStr.contains("Updated list"))
209 ret = true; 207 ret = true;
210 } 208 }
211 else if ( option == "download" ) 209 else if ( option == "download" )
212 { 210 {
213 if (lineStr.contains("Downloaded")) 211 if (lineStr.contains("Downloaded"))
214 ret = true; 212 ret = true;
215 } 213 }
216 else 214 else
217 { 215 {
218 if (lineStr.contains("Done")) 216 if (lineStr.contains("Done"))
219 ret = true; 217 ret = true;
220 } 218 }
221 219
222 emit outputText( lineStr ); 220 emit outputText( lineStr );
223 } 221 }
224 lineStrOld = lineStr; 222 lineStrOld = lineStr;
225 qApp->processEvents(); 223 qApp->processEvents();
226 } 224 }
227 pclose(fp); 225 pclose(fp);
228 } 226 }
229 227
230 return ret; 228 return ret;
231} 229}
232 230
233 231
234void Ipkg :: linkPackage( const QString &packFileName, const QString &dest, const QString &destDir ) 232void Ipkg :: linkPackage( const QString &packFileName, const QString &dest, const QString &destDir )
235{ 233{
236 if ( dest == "root" || dest == "/" ) 234 if ( dest == "root" || dest == "/" )
237 return; 235 return;
238 236
239 qApp->processEvents(); 237 qApp->processEvents();
240 QStringList *fileList = getList( packFileName, destDir ); 238 QStringList *fileList = getList( packFileName, destDir );
241 qApp->processEvents(); 239 qApp->processEvents();
242 processFileList( fileList, destDir ); 240 processFileList( fileList, destDir );
243 delete fileList; 241 delete fileList;
244} 242}
245 243
246QStringList* Ipkg :: getList( const QString &packageFilename, const QString &destDir ) 244QStringList* Ipkg :: getList( const QString &packageFilename, const QString &destDir )
247{ 245{
248 QString packageFileDir = destDir+"/usr/lib/ipkg/info/"+packageFilename+".list"; 246 QString packageFileDir = destDir+"/usr/lib/ipkg/info/"+packageFilename+".list";
249 QFile f( packageFileDir ); 247 QFile f( packageFileDir );
250 248
251 cout << "Try to open " << packageFileDir << endl; 249 cout << "Try to open " << packageFileDir << endl;
252 if ( !f.open(IO_ReadOnly) ) 250 if ( !f.open(IO_ReadOnly) )
253 { 251 {
254 // Couldn't open from dest, try from / 252 // Couldn't open from dest, try from /
255 cout << "Could not open:" << packageFileDir << endl; 253 cout << "Could not open:" << packageFileDir << endl;
256 f.close(); 254 f.close();
257 255
258 packageFileDir = "/usr/lib/ipkg/info/"+packageFilename+".list"; 256 packageFileDir = "/usr/lib/ipkg/info/"+packageFilename+".list";
259 f.setName( packageFileDir ); 257 f.setName( packageFileDir );
260// cout << "Try to open " << packageFileDir.latin1() << endl; 258// cout << "Try to open " << packageFileDir.latin1() << endl;
261 if ( ! f.open(IO_ReadOnly) ) 259 if ( ! f.open(IO_ReadOnly) )
262 { 260 {
263 cout << "Could not open:" << packageFileDir << endl; 261 cout << "Could not open:" << packageFileDir << endl;
264 emit outputText( QString( "Could not open :" ) + packageFileDir ); 262 emit outputText( QString( "Could not open :" ) + packageFileDir );
265 return (QStringList*)0; 263 return (QStringList*)0;
266 } 264 }
267 } 265 }
268 QStringList *fileList = new QStringList(); 266 QStringList *fileList = new QStringList();
269 QTextStream t( &f ); 267 QTextStream t( &f );
270 while ( !t.eof() ) 268 while ( !t.eof() )
271 *fileList += t.readLine(); 269 *fileList += t.readLine();
272 270
273 f.close(); 271 f.close();
274 return fileList; 272 return fileList;
275} 273}
276 274
277void Ipkg :: processFileList( const QStringList *fileList, const QString &destDir ) 275void Ipkg :: processFileList( const QStringList *fileList, const QString &destDir )
278{ 276{
279 if ( !fileList || fileList->isEmpty() ) 277 if ( !fileList || fileList->isEmpty() )
280 return; 278 return;
281 279
282 QString baseDir = ROOT; 280 QString baseDir = ROOT;
283 281
284 if ( createLinks == true ) 282 if ( createLinks == true )
285 { 283 {
286 for ( uint i=0; i < fileList->count(); i++ ) 284 for ( uint i=0; i < fileList->count(); i++ )
287 { 285 {
288 processLinkDir( (*fileList)[i], baseDir, destDir ); 286 processLinkDir( (*fileList)[i], baseDir, destDir );
289 qApp->processEvents(); 287 qApp->processEvents();
290 } 288 }
291 } 289 }
292 else 290 else
293 { 291 {
294 for ( int i = fileList->count()-1; i >= 0 ; i-- ) 292 for ( int i = fileList->count()-1; i >= 0 ; i-- )
295 { 293 {
296 processLinkDir( (*fileList)[i], baseDir, destDir ); 294 processLinkDir( (*fileList)[i], baseDir, destDir );
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index a374266..3971aea 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -370,237 +370,241 @@ void NetworkPackageManager :: downloadPackage()
370 if ( ok && !text.isEmpty() ) 370 if ( ok && !text.isEmpty() )
371 dir = text; // user entered something and pressed ok 371 dir = text; // user entered something and pressed ok
372 else 372 else
373 return; // user entered nothing or pressed cancel 373 return; // user entered nothing or pressed cancel
374 374
375#ifdef QWS 375#ifdef QWS
376 // Store download directory in config file 376 // Store download directory in config file
377 cfg.writeEntry( "downloadDir", dir ); 377 cfg.writeEntry( "downloadDir", dir );
378#endif 378#endif
379 379
380 // Get starting directory 380 // Get starting directory
381 char initDir[PATH_MAX]; 381 char initDir[PATH_MAX];
382 getcwd( initDir, PATH_MAX ); 382 getcwd( initDir, PATH_MAX );
383 383
384 // Download each package 384 // Download each package
385 Ipkg ipkg; 385 Ipkg ipkg;
386 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 386 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
387 387
388 ipkg.setOption( "download" ); 388 ipkg.setOption( "download" );
389 ipkg.setRuntimeDirectory( dir ); 389 ipkg.setRuntimeDirectory( dir );
390 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 390 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
391 item != 0 ; 391 item != 0 ;
392 item = (QCheckListItem *)item->nextSibling() ) 392 item = (QCheckListItem *)item->nextSibling() )
393 { 393 {
394 if ( item->isOn() ) 394 if ( item->isOn() )
395 { 395 {
396 QString name = item->text(); 396 QString name = item->text();
397 int pos = name.find( "*" ); 397 int pos = name.find( "*" );
398 name.truncate( pos ); 398 name.truncate( pos );
399 399
400 // if (there is a (installed), remove it 400 // if (there is a (installed), remove it
401 pos = name.find( "(installed)" ); 401 pos = name.find( "(installed)" );
402 if ( pos > 0 ) 402 if ( pos > 0 )
403 name.truncate( pos - 1 ); 403 name.truncate( pos - 1 );
404 404
405 ipkg.setPackage( name ); 405 ipkg.setPackage( name );
406 ipkg.runIpkg( ); 406 ipkg.runIpkg( );
407 } 407 }
408 } 408 }
409 } 409 }
410 else if ( download->text() == "Remove" ) 410 else if ( download->text() == "Remove" )
411 { 411 {
412 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 412 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
413 item != 0 ; 413 item != 0 ;
414 item = (QCheckListItem *)item->nextSibling() ) 414 item = (QCheckListItem *)item->nextSibling() )
415 { 415 {
416 if ( item->isOn() ) 416 if ( item->isOn() )
417 { 417 {
418 QString name = item->text(); 418 QString name = item->text();
419 int pos = name.find( "*" ); 419 int pos = name.find( "*" );
420 name.truncate( pos ); 420 name.truncate( pos );
421 421
422 // if (there is a (installed), remove it 422 // if (there is a (installed), remove it
423 pos = name.find( "(installed)" ); 423 pos = name.find( "(installed)" );
424 if ( pos > 0 ) 424 if ( pos > 0 )
425 name.truncate( pos - 1 ); 425 name.truncate( pos - 1 );
426 426
427 Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name ); 427 Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name );
428 QFile f( p->getFilename() ); 428 QFile f( p->getFilename() );
429 f.remove(); 429 f.remove();
430 } 430 }
431 } 431 }
432 } 432 }
433 433
434 dataMgr->reloadServerData( LOCAL_IPKGS ); 434 dataMgr->reloadServerData( LOCAL_IPKGS );
435 serverSelected( -1 ); 435 serverSelected( -1 );
436} 436}
437 437
438 438
439void NetworkPackageManager :: applyChanges() 439void NetworkPackageManager :: applyChanges()
440{ 440{
441 stickyOption = ""; 441 stickyOption = "";
442 442
443 // First, write out ipkg_conf file so that ipkg can use it 443 // First, write out ipkg_conf file so that ipkg can use it
444 dataMgr->writeOutIpkgConf(); 444 dataMgr->writeOutIpkgConf();
445 445
446 // Now for each selected item 446 // Now for each selected item
447 // deal with it 447 // deal with it
448 448
449 vector<InstallData> workingPackages; 449 vector<InstallData> workingPackages;
450 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 450 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
451 item != 0 ; 451 item != 0 ;
452 item = (QCheckListItem *)item->nextSibling() ) 452 item = (QCheckListItem *)item->nextSibling() )
453 { 453 {
454 if ( item->isOn() ) 454 if ( item->isOn() )
455 { 455 {
456 InstallData data = dealWithItem( item ); 456 InstallData data = dealWithItem( item );
457 workingPackages.push_back( data ); 457 workingPackages.push_back( data );
458 } 458 }
459 } 459 }
460 460
461 if ( workingPackages.size() == 0 ) 461 if ( workingPackages.size() == 0 )
462 { 462 {
463 // Nothing to do 463 // Nothing to do
464 QMessageBox::information( this, "Nothing to do", 464 QMessageBox::information( this, "Nothing to do",
465 "No packages selected", "OK" ); 465 "No packages selected", "OK" );
466 466
467 return; 467 return;
468 } 468 }
469 469
470 // do the stuff 470 // do the stuff
471 InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true ); 471 InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true );
472 dlg.showDlg(); 472 dlg.showDlg();
473 473
474 // Reload data 474 // Reload data
475 dataMgr->reloadServerData( LOCAL_SERVER ); 475 dataMgr->reloadServerData( LOCAL_SERVER );
476 476
477 dataMgr->reloadServerData( serversList->currentText() ); 477 dataMgr->reloadServerData( serversList->currentText() );
478 serverSelected(-1); 478 serverSelected(-1);
479 479
480#ifdef QWS 480#ifdef QWS
481 // Finally let the main system update itself 481 // Finally let the main system update itself
482 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 482 QCopEnvelope e("QPE/System", "linkChanged(QString)");
483 QString lf = QString::null; 483 QString lf = QString::null;
484 e << lf; 484 e << lf;
485#endif 485#endif
486} 486}
487 487
488// decide what to do - either remove, upgrade or install 488// decide what to do - either remove, upgrade or install
489// Current rules: 489// Current rules:
490// If not installed - install 490// If not installed - install
491// If installed and different version available - upgrade 491// If installed and different version available - upgrade
492// If installed and version up to date - remove 492// If installed and version up to date - remove
493InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) 493InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
494{ 494{
495 QString name = item->text(); 495 QString name = item->text();
496 int pos = name.find( "*" ); 496 int pos = name.find( "*" );
497 name.truncate( pos ); 497 name.truncate( pos );
498 498
499 // if (there is a (installed), remove it 499 // if (there is a (installed), remove it
500 pos = name.find( "(installed)" ); 500 pos = name.find( "(installed)" );
501 if ( pos > 0 ) 501 if ( pos > 0 )
502 name.truncate( pos - 1 ); 502 name.truncate( pos - 1 );
503 503
504 // Get package 504 // Get package
505 Server *s = dataMgr->getServer( serversList->currentText() ); 505 Server *s = dataMgr->getServer( serversList->currentText() );
506 Package *p = s->getPackage( name ); 506 Package *p = s->getPackage( name );
507 507
508 // If the package has a filename then it is a local file 508 // If the package has a filename then it is a local file
509 if ( p->isPackageStoredLocally() ) 509 if ( p->isPackageStoredLocally() )
510 name = p->getFilename(); 510 name = p->getFilename();
511 QString option; 511 QString option;
512 QString dest = "root"; 512 QString dest = "root";
513 if ( !p->isInstalled() ) 513 if ( !p->isInstalled() )
514 { 514 {
515 InstallData item; 515 InstallData item;
516 item.option = "I"; 516 item.option = "I";
517 item.packageName = name; 517 item.packageName = name;
518 return item; 518 return item;
519 } 519 }
520 else 520 else
521 { 521 {
522 InstallData item; 522 InstallData item;
523 item.option = "D"; 523 item.option = "D";
524 item.packageName = p->getInstalledPackageName(); 524 item.packageName = p->getInstalledPackageName();
525 if ( p->getInstalledTo() ) 525 if ( p->getInstalledTo() )
526 { 526 {
527 item.destination = p->getInstalledTo(); 527 item.destination = p->getInstalledTo();
528 cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; 528 cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl;
529 cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; 529 cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl;
530 } 530 }
531 else 531 else
532 { 532 {
533 item.destination = p->getLocalPackage()->getInstalledTo(); 533 item.destination = p->getLocalPackage()->getInstalledTo();
534 } 534 }
535 535
536 // Sticky option not implemented yet, but will eventually allow 536 // Sticky option not implemented yet, but will eventually allow
537 // the user to say something like 'remove all' 537 // the user to say something like 'remove all'
538 if ( stickyOption == "" ) 538 if ( stickyOption == "" )
539 { 539 {
540 QString msgtext; 540 QString msgtext;
541 msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name ); 541 msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name );
542 switch( QMessageBox::information( this, "Remove or ReInstall", 542 switch( QMessageBox::information( this, "Remove or ReInstall",
543 msgtext, "Remove", "ReInstall" ) ) 543 msgtext, "Remove", "ReInstall" ) )
544 { 544 {
545 case 0: // Try again or Enter 545 case 0: // Try again or Enter
546 item.option = "D"; 546 item.option = "D";
547 break; 547 break;
548 case 1: // Quit or Escape 548 case 1: // Quit or Escape
549 item.option = "U"; 549 item.option = "U";
550 break; 550 break;
551 } 551 }
552 } 552 }
553 else 553 else
554 { 554 {
555// item.option = stickyOption; 555// item.option = stickyOption;
556 } 556 }
557 557
558 // Check if we are reinstalling the same version 558 // Check if we are reinstalling the same version
559 if ( p->getVersion() != p->getInstalledVersion() ) 559 if ( p->getVersion() != p->getInstalledVersion() )
560 item.recreateLinks = true; 560 item.recreateLinks = true;
561 else 561 else
562 {
563 if ( item.option == "U" )
564 item.option = "R";
562 item.recreateLinks = false; 565 item.recreateLinks = false;
566 }
563 567
564 // User hit cancel (on dlg - assume remove) 568 // User hit cancel (on dlg - assume remove)
565 return item; 569 return item;
566 } 570 }
567} 571}
568 572
569void NetworkPackageManager :: displayText( const QString &t ) 573void NetworkPackageManager :: displayText( const QString &t )
570{ 574{
571 cout << t << endl; 575 cout << t << endl;
572} 576}
573 577
574 578
575void NetworkPackageManager :: letterPushed( QString t ) 579void NetworkPackageManager :: letterPushed( QString t )
576{ 580{
577 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); 581 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild();
578 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 582 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
579 if ( packagesList->firstChild() == 0 ) 583 if ( packagesList->firstChild() == 0 )
580 return; 584 return;
581 585
582 QCheckListItem *item; 586 QCheckListItem *item;
583 if ( start == 0 ) 587 if ( start == 0 )
584 { 588 {
585 item = (QCheckListItem *)packagesList->firstChild(); 589 item = (QCheckListItem *)packagesList->firstChild();
586 start = top; 590 start = top;
587 } 591 }
588 else 592 else
589 item = (QCheckListItem *)start->nextSibling(); 593 item = (QCheckListItem *)start->nextSibling();
590 594
591 if ( item == 0 ) 595 if ( item == 0 )
592 item = (QCheckListItem *)packagesList->firstChild(); 596 item = (QCheckListItem *)packagesList->firstChild();
593 do 597 do
594 { 598 {
595 if ( item->text().lower().startsWith( t.lower() ) ) 599 if ( item->text().lower().startsWith( t.lower() ) )
596 { 600 {
597 packagesList->setSelected( item, true ); 601 packagesList->setSelected( item, true );
598 packagesList->ensureItemVisible( item ); 602 packagesList->ensureItemVisible( item );
599 break; 603 break;
600 } 604 }
601 605
602 item = (QCheckListItem *)item->nextSibling(); 606 item = (QCheckListItem *)item->nextSibling();
603 if ( !item ) 607 if ( !item )
604 item = (QCheckListItem *)packagesList->firstChild(); 608 item = (QCheckListItem *)packagesList->firstChild();
605 } while ( item != start); 609 } while ( item != start);
606} 610}