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