summaryrefslogtreecommitdiff
authorandyq <andyq>2002-10-22 19:28:22 (UTC)
committer andyq <andyq>2002-10-22 19:28:22 (UTC)
commitedcbb8b9bae3db2fae18ec6cd9efd202af4f913c (patch) (unidiff)
tree7a1671b8b8e469a21841348732c6548705f2e5d7
parent85f0e72ed11d2c065f46ac0db99483c4025fab8e (diff)
downloadopie-edcbb8b9bae3db2fae18ec6cd9efd202af4f913c.zip
opie-edcbb8b9bae3db2fae18ec6cd9efd202af4f913c.tar.gz
opie-edcbb8b9bae3db2fae18ec6cd9efd202af4f913c.tar.bz2
Set pIpkg to 0 in constructor
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index a924daf..f5aef94 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -1,229 +1,230 @@
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 upgradePackages = false; 39 upgradePackages = false;
39 dataMgr = dataManager; 40 dataMgr = dataManager;
40 vector<Destination>::iterator dit; 41 vector<Destination>::iterator dit;
41 42
42 QString defaultDest = "root"; 43 QString defaultDest = "root";
43#ifdef QWS 44#ifdef QWS
44 Config cfg( "aqpkg" ); 45 Config cfg( "aqpkg" );
45 cfg.setGroup( "settings" ); 46 cfg.setGroup( "settings" );
46 defaultDest = cfg.readEntry( "dest", "root" ); 47 defaultDest = cfg.readEntry( "dest", "root" );
47 48
48 // 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)
49// flags = cfg.readNumEntry( "installFlags", MAKE_LINKS ); 50// flags = cfg.readNumEntry( "installFlags", MAKE_LINKS );
50 flags = 0; 51 flags = 0;
51#else 52#else
52 flags = 0; 53 flags = 0;
53#endif 54#endif
54 55
55 // Output text is read only 56 // Output text is read only
56 output->setReadOnly( true ); 57 output->setReadOnly( true );
57 QFont f( "helvetica" ); 58 QFont f( "helvetica" );
58 f.setPointSize( 10 ); 59 f.setPointSize( 10 );
59 output->setFont( f ); 60 output->setFont( f );
60 61
61 62
62 // setup destination data 63 // setup destination data
63 int defIndex = 0; 64 int defIndex = 0;
64 int i; 65 int i;
65 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 )
66 { 67 {
67 destination->insertItem( dit->getDestinationName() ); 68 destination->insertItem( dit->getDestinationName() );
68 if ( dit->getDestinationName() == defaultDest ) 69 if ( dit->getDestinationName() == defaultDest )
69 defIndex = i; 70 defIndex = i;
70 } 71 }
71 72
72 destination->setCurrentItem( defIndex ); 73 destination->setCurrentItem( defIndex );
73 74
74 vector<InstallData>::iterator it; 75 vector<InstallData>::iterator it;
75 // setup package data 76 // setup package data
76 QString remove = "Remove\n"; 77 QString remove = "Remove\n";
77 QString install = "\nInstall\n"; 78 QString install = "\nInstall\n";
78 QString upgrade = "\nUpgrade\n"; 79 QString upgrade = "\nUpgrade\n";
79 for ( it = packageList.begin() ; it != packageList.end() ; ++it ) 80 for ( it = packageList.begin() ; it != packageList.end() ; ++it )
80 { 81 {
81 InstallData item = *it; 82 InstallData item = *it;
82 if ( item.option == "I" ) 83 if ( item.option == "I" )
83 { 84 {
84 installList.push_back( item ); 85 installList.push_back( item );
85 install += " " + item.packageName + "\n"; 86 install += " " + item.packageName + "\n";
86 } 87 }
87 else if ( item.option == "D" ) 88 else if ( item.option == "D" )
88 { 89 {
89 removeList.push_back( item ); 90 removeList.push_back( item );
90 remove += " " + item.packageName + "\n"; 91 remove += " " + item.packageName + "\n";
91 } 92 }
92 else if ( item.option == "U" ) 93 else if ( item.option == "U" )
93 { 94 {
94 updateList.push_back( item ); 95 updateList.push_back( item );
95 upgrade += " " + item.packageName + "\n"; 96 upgrade += " " + item.packageName + "\n";
96 } 97 }
97 } 98 }
98 99
99 output->setText( remove + install + upgrade ); 100 output->setText( remove + install + upgrade );
100} 101}
101 102
102InstallDlgImpl::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 )
103 : InstallDlg( parent, name, modal, fl ) 104 : InstallDlg( parent, name, modal, fl )
104{ 105{
105 pIpkg = ipkg; 106 pIpkg = ipkg;
106 output->setText( initialText ); 107 output->setText( initialText );
107} 108}
108 109
109 110
110InstallDlgImpl::~InstallDlgImpl() 111InstallDlgImpl::~InstallDlgImpl()
111{ 112{
112} 113}
113 114
114bool InstallDlgImpl :: showDlg() 115bool InstallDlgImpl :: showDlg()
115{ 116{
116 showMaximized(); 117 showMaximized();
117 bool ret = exec(); 118 bool ret = exec();
118 119
119 return ret; 120 return ret;
120} 121}
121 122
122void InstallDlgImpl :: optionsSelected() 123void InstallDlgImpl :: optionsSelected()
123{ 124{
124 InstallOptionsDlgImpl opt( flags, this, "Option", true ); 125 InstallOptionsDlgImpl opt( flags, this, "Option", true );
125 opt.exec(); 126 opt.exec();
126 127
127 // set options selected from dialog 128 // set options selected from dialog
128 flags = 0; 129 flags = 0;
129 if ( opt.forceDepends->isChecked() ) 130 if ( opt.forceDepends->isChecked() )
130 flags |= FORCE_DEPENDS; 131 flags |= FORCE_DEPENDS;
131 if ( opt.forceReinstall->isChecked() ) 132 if ( opt.forceReinstall->isChecked() )
132 flags |= FORCE_REINSTALL; 133 flags |= FORCE_REINSTALL;
133 if ( opt.forceRemove->isChecked() ) 134 if ( opt.forceRemove->isChecked() )
134 flags |= FORCE_REMOVE; 135 flags |= FORCE_REMOVE;
135 if ( opt.forceOverwrite->isChecked() ) 136 if ( opt.forceOverwrite->isChecked() )
136 flags |= FORCE_OVERWRITE; 137 flags |= FORCE_OVERWRITE;
137 138
138#ifdef QWS 139#ifdef QWS
139 Config cfg( "aqpkg" ); 140 Config cfg( "aqpkg" );
140 cfg.setGroup( "settings" ); 141 cfg.setGroup( "settings" );
141 cfg.writeEntry( "installFlags", flags ); 142 cfg.writeEntry( "installFlags", flags );
142#endif 143#endif
143} 144}
144 145
145void InstallDlgImpl :: installSelected() 146void InstallDlgImpl :: installSelected()
146{ 147{
147 if ( btnInstall->text() == "Close" ) 148 if ( btnInstall->text() == "Close" )
148 { 149 {
149 done( 1 ); 150 done( 1 );
150 return; 151 return;
151 } 152 }
152 153
153 btnInstall->setEnabled( false ); 154 btnInstall->setEnabled( false );
154 155
155 if ( pIpkg ) 156 if ( pIpkg )
156 { 157 {
157 output->setText( "" ); 158 output->setText( "" );
158 159
159 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 160 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
160 pIpkg->runIpkg(); 161 pIpkg->runIpkg();
161 } 162 }
162 else 163 else
163 { 164 {
164 output->setText( "" ); 165 output->setText( "" );
165 Destination *d = dataMgr->getDestination( destination->currentText() ); 166 Destination *d = dataMgr->getDestination( destination->currentText() );
166 QString dest = d->getDestinationName(); 167 QString dest = d->getDestinationName();
167 QString destDir = d->getDestinationPath(); 168 QString destDir = d->getDestinationPath();
168 int instFlags = flags; 169 int instFlags = flags;
169 if ( d->linkToRoot() ) 170 if ( d->linkToRoot() )
170 instFlags |= MAKE_LINKS; 171 instFlags |= MAKE_LINKS;
171 172
172#ifdef QWS 173#ifdef QWS
173 // Save settings 174 // Save settings
174 Config cfg( "aqpkg" ); 175 Config cfg( "aqpkg" );
175 cfg.setGroup( "settings" ); 176 cfg.setGroup( "settings" );
176 cfg.writeEntry( "dest", dest ); 177 cfg.writeEntry( "dest", dest );
177#endif 178#endif
178 179
179 pIpkg = new Ipkg; 180 pIpkg = new Ipkg;
180 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 181 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
181 182
182 // 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
183 vector<InstallData>::iterator it; 184 vector<InstallData>::iterator it;
184 pIpkg->setOption( "remove" ); 185 pIpkg->setOption( "remove" );
185 for ( it = removeList.begin() ; it != removeList.end() ; ++it ) 186 for ( it = removeList.begin() ; it != removeList.end() ; ++it )
186 { 187 {
187 pIpkg->setDestination( it->destination->getDestinationName() ); 188 pIpkg->setDestination( it->destination->getDestinationName() );
188 pIpkg->setDestinationDir( it->destination->getDestinationPath() ); 189 pIpkg->setDestinationDir( it->destination->getDestinationPath() );
189 pIpkg->setPackage( it->packageName ); 190 pIpkg->setPackage( it->packageName );
190 191
191 int tmpFlags = flags; 192 int tmpFlags = flags;
192 if ( it->destination->linkToRoot() ) 193 if ( it->destination->linkToRoot() )
193 tmpFlags |= MAKE_LINKS; 194 tmpFlags |= MAKE_LINKS;
194 195
195 pIpkg->setFlags( tmpFlags ); 196 pIpkg->setFlags( tmpFlags );
196 pIpkg->runIpkg(); 197 pIpkg->runIpkg();
197 } 198 }
198 199
199 pIpkg->setOption( "install" ); 200 pIpkg->setOption( "install" );
200 pIpkg->setDestination( dest ); 201 pIpkg->setDestination( dest );
201 pIpkg->setDestinationDir( destDir ); 202 pIpkg->setDestinationDir( destDir );
202 pIpkg->setFlags( instFlags ); 203 pIpkg->setFlags( instFlags );
203 for ( it = installList.begin() ; it != installList.end() ; ++it ) 204 for ( it = installList.begin() ; it != installList.end() ; ++it )
204 { 205 {
205 pIpkg->setPackage( it->packageName ); 206 pIpkg->setPackage( it->packageName );
206 pIpkg->runIpkg(); 207 pIpkg->runIpkg();
207 } 208 }
208 209
209 flags |= FORCE_REINSTALL; 210 flags |= FORCE_REINSTALL;
210 pIpkg->setOption( "reinstall" ); 211 pIpkg->setOption( "reinstall" );
211 for ( it = updateList.begin() ; it != updateList.end() ; ++it ) 212 for ( it = updateList.begin() ; it != updateList.end() ; ++it )
212 { 213 {
213 pIpkg->setDestination( it->destination->getDestinationName() ); 214 pIpkg->setDestination( it->destination->getDestinationName() );
214 pIpkg->setDestinationDir( it->destination->getDestinationPath() ); 215 pIpkg->setDestinationDir( it->destination->getDestinationPath() );
215 pIpkg->setPackage( it->packageName ); 216 pIpkg->setPackage( it->packageName );
216 217
217 int tmpFlags = flags; 218 int tmpFlags = flags;
218 if ( it->destination->linkToRoot() && it->recreateLinks ) 219 if ( it->destination->linkToRoot() && it->recreateLinks )
219 tmpFlags |= MAKE_LINKS; 220 tmpFlags |= MAKE_LINKS;
220 pIpkg->setFlags( tmpFlags ); 221 pIpkg->setFlags( tmpFlags );
221 pIpkg->runIpkg(); 222 pIpkg->runIpkg();
222 } 223 }
223 224
224 delete pIpkg; 225 delete pIpkg;
225 } 226 }
226 227
227 btnInstall->setEnabled( true ); 228 btnInstall->setEnabled( true );
228 btnInstall->setText( tr( "Close" ) ); 229 btnInstall->setText( tr( "Close" ) );
229} 230}