-rw-r--r-- | noncore/settings/packagemanager/installdlg.cpp | 34 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 24 |
2 files changed, 39 insertions, 19 deletions
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp index 7dea591..36851b0 100644 --- a/noncore/settings/packagemanager/installdlg.cpp +++ b/noncore/settings/packagemanager/installdlg.cpp | |||
@@ -1,311 +1,321 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This file is distributed in the hope that | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ..}^=.= = ; Public License for more details. | 19 | ..}^=.= = ; Public License for more details. |
20 | ++= -. .` .: | 20 | ++= -. .` .: |
21 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
22 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
23 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
24 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "installdlg.h" | 30 | #include "installdlg.h" |
31 | 31 | ||
32 | #include <opie2/ofiledialog.h> | 32 | #include <opie2/ofiledialog.h> |
33 | 33 | ||
34 | #include <qpe/fileselector.h> | 34 | #include <qpe/fileselector.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | #include <qpe/storage.h> | 36 | #include <qpe/storage.h> |
37 | 37 | ||
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
40 | #include <qfileinfo.h> | 40 | #include <qfileinfo.h> |
41 | #include <qgroupbox.h> | 41 | #include <qgroupbox.h> |
42 | #include <qlabel.h> | 42 | #include <qlabel.h> |
43 | #include <qlayout.h> | 43 | #include <qlayout.h> |
44 | #include <qmap.h> | 44 | #include <qmap.h> |
45 | #include <qmultilineedit.h> | 45 | #include <qmultilineedit.h> |
46 | #include <qpushbutton.h> | 46 | #include <qpushbutton.h> |
47 | 47 | ||
48 | #include <sys/vfs.h> | 48 | #include <sys/vfs.h> |
49 | 49 | ||
50 | #include "opackagemanager.h" | 50 | #include "opackagemanager.h" |
51 | 51 | ||
52 | InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, | 52 | InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, |
53 | OPackage::Command command1, const QStringList &packages1, | 53 | OPackage::Command command1, const QStringList &packages1, |
54 | OPackage::Command command2, const QStringList &packages2, | 54 | OPackage::Command command2, const QStringList &packages2, |
55 | OPackage::Command command3, const QStringList &packages3 ) | 55 | OPackage::Command command3, const QStringList &packages3 ) |
56 | : QWidget( 0l ) | 56 | : QWidget( 0l ) |
57 | , m_packman( pm ) | 57 | , m_packman( pm ) |
58 | , m_installFound( false ) | 58 | , m_installFound( false ) |
59 | , m_numCommands( 0 ) | 59 | , m_numCommands( 0 ) |
60 | , m_currCommand( 0 ) | 60 | , m_currCommand( 0 ) |
61 | , m_destItem( 0l ) | 61 | , m_destItem( 0l ) |
62 | { | 62 | { |
63 | // Save command/package list information | 63 | // Save command/package list information |
64 | if ( command1 != OPackage::NotDefined ) | 64 | if ( command1 != OPackage::NotDefined ) |
65 | { | 65 | { |
66 | m_command[ m_numCommands ] = command1; | 66 | m_command[ m_numCommands ] = command1; |
67 | m_packages[ m_numCommands ] = packages1; | 67 | m_packages[ m_numCommands ] = packages1; |
68 | ++m_numCommands; | 68 | ++m_numCommands; |
69 | 69 | ||
70 | if ( command1 == OPackage::Install ) | 70 | if ( command1 == OPackage::Install ) |
71 | m_installFound = true; | 71 | m_installFound = true; |
72 | } | 72 | } |
73 | if ( command2 != OPackage::NotDefined ) | 73 | if ( command2 != OPackage::NotDefined ) |
74 | { | 74 | { |
75 | m_command[ m_numCommands ] = command2; | 75 | m_command[ m_numCommands ] = command2; |
76 | m_packages[ m_numCommands ] = packages2; | 76 | m_packages[ m_numCommands ] = packages2; |
77 | ++m_numCommands; | 77 | ++m_numCommands; |
78 | 78 | ||
79 | if ( command2 == OPackage::Install ) | 79 | if ( command2 == OPackage::Install ) |
80 | m_installFound = true; | 80 | m_installFound = true; |
81 | } | 81 | } |
82 | if ( command3 != OPackage::NotDefined ) | 82 | if ( command3 != OPackage::NotDefined ) |
83 | { | 83 | { |
84 | m_command[ m_numCommands ] = command3; | 84 | m_command[ m_numCommands ] = command3; |
85 | m_packages[ m_numCommands ] = packages3; | 85 | m_packages[ m_numCommands ] = packages3; |
86 | ++m_numCommands; | 86 | ++m_numCommands; |
87 | 87 | ||
88 | if ( command3 == OPackage::Install ) | 88 | if ( command3 == OPackage::Install ) |
89 | m_installFound = true; | 89 | m_installFound = true; |
90 | } | 90 | } |
91 | 91 | ||
92 | // Initialize UI | 92 | // Initialize UI |
93 | if ( parent ) | 93 | if ( parent ) |
94 | parent->setCaption( caption ); | 94 | parent->setCaption( caption ); |
95 | 95 | ||
96 | QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 ); | 96 | QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 ); |
97 | 97 | ||
98 | if ( m_installFound ) | 98 | if ( m_installFound ) |
99 | { | 99 | { |
100 | QLabel *label = new QLabel( tr( "Destination" ), this ); | 100 | QLabel *label = new QLabel( tr( "Destination" ), this ); |
101 | layout->addWidget( label, 0, 0 ); | 101 | layout->addWidget( label, 0, 0 ); |
102 | m_destination = new QComboBox( this ); | 102 | m_destination = new QComboBox( this ); |
103 | m_destination->insertStringList( m_packman->destinations() ); | 103 | m_destination->insertStringList( m_packman->destinations() ); |
104 | layout->addWidget( m_destination, 0, 1 ); | 104 | layout->addWidget( m_destination, 0, 1 ); |
105 | connect( m_destination, SIGNAL(highlighted(const QString&)), | 105 | connect( m_destination, SIGNAL(highlighted(const QString&)), |
106 | this, SLOT(slotDisplayAvailSpace(const QString&)) ); | 106 | this, SLOT(slotDisplayAvailSpace(const QString&)) ); |
107 | 107 | ||
108 | label = new QLabel( tr( "Space Avail" ), this ); | 108 | label = new QLabel( tr( "Space Avail" ), this ); |
109 | layout->addWidget( label, 1, 0 ); | 109 | layout->addWidget( label, 1, 0 ); |
110 | m_availSpace = new QLabel( this ); | 110 | m_availSpace = new QLabel( this ); |
111 | layout->addWidget( m_availSpace, 1, 1 ); | 111 | layout->addWidget( m_availSpace, 1, 1 ); |
112 | 112 | ||
113 | // TODO - select correct destination | 113 | // TODO - select correct destination |
114 | slotDisplayAvailSpace( m_destination->currentText() ); | 114 | slotDisplayAvailSpace( m_destination->currentText() ); |
115 | } | 115 | } |
116 | else | 116 | else |
117 | { | 117 | { |
118 | m_destination = 0l; | 118 | m_destination = 0l; |
119 | m_availSpace = 0l; | 119 | m_availSpace = 0l; |
120 | } | 120 | } |
121 | 121 | ||
122 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); | 122 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); |
123 | groupBox->layout()->setSpacing( 0 ); | 123 | groupBox->layout()->setSpacing( 0 ); |
124 | groupBox->layout()->setMargin( 4 ); | 124 | groupBox->layout()->setMargin( 4 ); |
125 | 125 | ||
126 | QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() ); | 126 | QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() ); |
127 | m_output = new QMultiLineEdit( groupBox ); | 127 | m_output = new QMultiLineEdit( groupBox ); |
128 | m_output->setReadOnly( true ); | 128 | m_output->setReadOnly( true ); |
129 | groupBoxLayout->addWidget( m_output ); | 129 | groupBoxLayout->addWidget( m_output ); |
130 | layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 ); | 130 | layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 ); |
131 | 131 | ||
132 | m_btnStart = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), tr( "Start" ), this ); | 132 | QPixmap pic; |
133 | pic.convertFromImage( Resource::loadImage( "packagemanager/apply" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
134 | m_btnStart = new QPushButton( pic, tr( "Start" ), this ); | ||
133 | layout->addWidget( m_btnStart, 3, 0 ); | 135 | layout->addWidget( m_btnStart, 3, 0 ); |
134 | connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); | 136 | connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); |
135 | 137 | ||
136 | m_btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this ); | 138 | pic.convertFromImage( Resource::loadImage( "SettingsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
139 | m_btnOptions = new QPushButton( pic, tr( "Options" ), this ); | ||
137 | layout->addWidget( m_btnOptions, 3, 1 ); | 140 | layout->addWidget( m_btnOptions, 3, 1 ); |
138 | connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); | 141 | connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); |
139 | 142 | ||
140 | // Display packages being acted upon in output widget | 143 | // Display packages being acted upon in output widget |
141 | for( int i = 0; i < m_numCommands; i++ ) | 144 | for( int i = 0; i < m_numCommands; i++ ) |
142 | { | 145 | { |
143 | if ( !m_packages[ i ].isEmpty() ) | 146 | if ( !m_packages[ i ].isEmpty() ) |
144 | { | 147 | { |
145 | QString lineStr = tr( "Packages to " ); | 148 | QString lineStr = tr( "Packages to " ); |
146 | 149 | ||
147 | switch( m_command[ i ] ) | 150 | switch( m_command[ i ] ) |
148 | { | 151 | { |
149 | case OPackage::Install : lineStr.append( tr( "install" ) ); | 152 | case OPackage::Install : lineStr.append( tr( "install" ) ); |
150 | break; | 153 | break; |
151 | case OPackage::Remove : lineStr.append( tr( "remove" ) ); | 154 | case OPackage::Remove : lineStr.append( tr( "remove" ) ); |
152 | break; | 155 | break; |
153 | case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) ); | 156 | case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) ); |
154 | break; | 157 | break; |
155 | case OPackage::Download : lineStr.append( tr( "download" ) ); | 158 | case OPackage::Download : lineStr.append( tr( "download" ) ); |
156 | break; | 159 | break; |
157 | default : | 160 | default : |
158 | break; | 161 | break; |
159 | }; | 162 | }; |
160 | lineStr.append( ":\n" ); | 163 | lineStr.append( ":\n" ); |
161 | 164 | ||
162 | QStringList tmpPackage = m_packages[ i ]; | 165 | QStringList tmpPackage = m_packages[ i ]; |
163 | for ( QStringList::Iterator it = tmpPackage.begin(); it != tmpPackage.end(); ++it ) | 166 | for ( QStringList::Iterator it = tmpPackage.begin(); it != tmpPackage.end(); ++it ) |
164 | { | 167 | { |
165 | lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) ); | 168 | lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) ); |
166 | } | 169 | } |
167 | 170 | ||
168 | m_output->append( lineStr ); | 171 | m_output->append( lineStr ); |
169 | } | 172 | } |
170 | } | 173 | } |
171 | 174 | ||
172 | m_output->append( tr( "Press the start button to begin.\n" ) ); | 175 | m_output->append( tr( "Press the start button to begin.\n" ) ); |
173 | m_output->setCursorPosition( m_output->numLines(), 0 ); | 176 | m_output->setCursorPosition( m_output->numLines(), 0 ); |
174 | 177 | ||
175 | } | 178 | } |
176 | 179 | ||
177 | void InstallDlg::slotDisplayAvailSpace( const QString &destination ) | 180 | void InstallDlg::slotDisplayAvailSpace( const QString &destination ) |
178 | { | 181 | { |
179 | // If available space is not displayed, exit | 182 | // If available space is not displayed, exit |
180 | if ( !m_availSpace ) | 183 | if ( !m_availSpace ) |
181 | return; | 184 | return; |
182 | 185 | ||
183 | QString space = tr( "Unknown" ); | 186 | QString space = tr( "Unknown" ); |
184 | 187 | ||
185 | // Get destination | 188 | // Get destination |
186 | if ( !destination.isNull() ) | 189 | if ( !destination.isNull() ) |
187 | m_destItem = m_packman->findConfItem( OConfItem::Destination, destination ); | 190 | m_destItem = m_packman->findConfItem( OConfItem::Destination, destination ); |
188 | 191 | ||
189 | if ( m_destItem ) | 192 | if ( m_destItem ) |
190 | { | 193 | { |
191 | // Calculate available space | 194 | // Calculate available space |
192 | struct statfs fs; | 195 | struct statfs fs; |
193 | if ( !statfs( m_destItem->value(), &fs ) ) | 196 | if ( !statfs( m_destItem->value(), &fs ) ) |
194 | { | 197 | { |
195 | long mult = fs.f_bsize / 1024; | 198 | long mult = fs.f_bsize / 1024; |
196 | long div = 1024 / fs.f_bsize; | 199 | long div = 1024 / fs.f_bsize; |
197 | 200 | ||
198 | if ( !mult ) mult = 1; | 201 | if ( !mult ) mult = 1; |
199 | if ( !div ) div = 1; | 202 | if ( !div ) div = 1; |
200 | long avail = fs.f_bavail * mult / div; | 203 | long avail = fs.f_bavail * mult / div; |
201 | 204 | ||
202 | space = tr( "%1 Kb" ).arg( avail ); | 205 | space = tr( "%1 Kb" ).arg( avail ); |
203 | } | 206 | } |
204 | } | 207 | } |
205 | 208 | ||
206 | // Display available space | 209 | // Display available space |
207 | m_availSpace->setText( space ); | 210 | m_availSpace->setText( space ); |
208 | } | 211 | } |
209 | 212 | ||
210 | void InstallDlg::slotBtnStart() | 213 | void InstallDlg::slotBtnStart() |
211 | { | 214 | { |
212 | QString btnText = m_btnStart->text(); | 215 | QString btnText = m_btnStart->text(); |
213 | if ( btnText == tr( "Abort" ) ) | 216 | if ( btnText == tr( "Abort" ) ) |
214 | { | 217 | { |
215 | // Prevent unexecuted commands from executing | 218 | // Prevent unexecuted commands from executing |
216 | m_currCommand = 999; | 219 | m_currCommand = 999; |
217 | 220 | ||
218 | // Allow user to close dialog | 221 | // Allow user to close dialog |
219 | m_btnStart->setText( tr( "Close" ) ); | 222 | m_btnStart->setText( tr( "Close" ) ); |
220 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); | 223 | QPixmap pic; |
224 | pic.convertFromImage( Resource::loadImage( "enter" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
225 | m_btnStart->setIconSet( pic ); | ||
221 | return; | 226 | return; |
222 | } | 227 | } |
223 | else if ( btnText == tr( "Close" ) ) | 228 | else if ( btnText == tr( "Close" ) ) |
224 | { | 229 | { |
225 | // TODO - force reload of package data | 230 | // TODO - force reload of package data |
226 | emit closeInstallDlg(); | 231 | emit closeInstallDlg(); |
227 | return; | 232 | return; |
228 | } | 233 | } |
229 | 234 | ||
230 | // Start was clicked, start executing | 235 | // Start was clicked, start executing |
231 | QString dest; | 236 | QString dest; |
232 | if ( m_installFound ) | 237 | if ( m_installFound ) |
233 | { | 238 | { |
234 | dest = m_destination->currentText(); | 239 | dest = m_destination->currentText(); |
235 | m_destination->setEnabled( false ); | 240 | m_destination->setEnabled( false ); |
236 | } | 241 | } |
237 | 242 | ||
238 | m_btnOptions->setEnabled( false ); | 243 | m_btnOptions->setEnabled( false ); |
239 | if ( m_numCommands > 1 ) | 244 | if ( m_numCommands > 1 ) |
240 | { | 245 | { |
241 | m_btnStart->setText( tr( "Abort" ) ); | 246 | m_btnStart->setText( tr( "Abort" ) ); |
242 | m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); | 247 | QPixmap pic; |
248 | pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
249 | m_btnStart->setIconSet( pic ); | ||
243 | } | 250 | } |
244 | else | 251 | else |
245 | { | 252 | { |
246 | m_btnStart->setEnabled( false ); | 253 | m_btnStart->setEnabled( false ); |
247 | } | 254 | } |
248 | 255 | ||
249 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) | 256 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) |
250 | { | 257 | { |
251 | // Execute next command | 258 | // Execute next command |
252 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, | 259 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, |
253 | this, SLOT(slotOutput(const QString &)), true ); | 260 | this, SLOT(slotOutput(const QString &)), true ); |
254 | } | 261 | } |
255 | 262 | ||
256 | // All commands executed, allow user to close dialog | 263 | // All commands executed, allow user to close dialog |
257 | m_btnStart->setEnabled( true ); | 264 | m_btnStart->setEnabled( true ); |
258 | m_btnStart->setText( tr( "Close" ) ); | 265 | m_btnStart->setText( tr( "Close" ) ); |
259 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); | 266 | QPixmap pic; |
267 | pic.convertFromImage( Resource::loadImage( "enter" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
268 | m_btnStart->setIconSet( pic ); | ||
260 | 269 | ||
261 | m_btnOptions->setEnabled( true ); | 270 | m_btnOptions->setEnabled( true ); |
262 | m_btnOptions->setText( tr( "Save output" ) ); | 271 | m_btnOptions->setText( tr( "Save output" ) ); |
263 | m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); | 272 | pic.convertFromImage( Resource::loadImage( "save" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
273 | m_btnOptions->setIconSet( pic ); | ||
264 | } | 274 | } |
265 | 275 | ||
266 | void InstallDlg::slotBtnOptions() | 276 | void InstallDlg::slotBtnOptions() |
267 | { | 277 | { |
268 | QString btnText = m_btnOptions->text(); | 278 | QString btnText = m_btnOptions->text(); |
269 | if ( btnText == tr( "Options" ) ) | 279 | if ( btnText == tr( "Options" ) ) |
270 | { | 280 | { |
271 | // Display configuration dialog (only options tab is enabled) | 281 | // Display configuration dialog (only options tab is enabled) |
272 | m_packman->configureDlg( true ); | 282 | m_packman->configureDlg( true ); |
273 | return; | 283 | return; |
274 | } | 284 | } |
275 | 285 | ||
276 | // Save output was clicked | 286 | // Save output was clicked |
277 | QMap<QString, QStringList> map; | 287 | QMap<QString, QStringList> map; |
278 | map.insert( tr( "All" ), QStringList() ); | 288 | map.insert( tr( "All" ), QStringList() ); |
279 | QStringList text; | 289 | QStringList text; |
280 | text << "text/*"; | 290 | text << "text/*"; |
281 | map.insert(tr( "Text" ), text ); | 291 | map.insert(tr( "Text" ), text ); |
282 | text << "*"; | 292 | text << "*"; |
283 | map.insert( tr( "All" ), text ); | 293 | map.insert( tr( "All" ), text ); |
284 | 294 | ||
285 | QString filename = Opie::Ui::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); | 295 | QString filename = Opie::Ui::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); |
286 | if( !filename.isEmpty() ) | 296 | if( !filename.isEmpty() ) |
287 | { | 297 | { |
288 | QString currentFileName = QFileInfo( filename ).fileName(); | 298 | QString currentFileName = QFileInfo( filename ).fileName(); |
289 | DocLnk doc; | 299 | DocLnk doc; |
290 | doc.setType( "text/plain" ); | 300 | doc.setType( "text/plain" ); |
291 | doc.setFile( filename ); | 301 | doc.setFile( filename ); |
292 | doc.setName( currentFileName ); | 302 | doc.setName( currentFileName ); |
293 | FileManager fm; | 303 | FileManager fm; |
294 | fm.saveFile( doc, m_output->text() ); | 304 | fm.saveFile( doc, m_output->text() ); |
295 | } | 305 | } |
296 | } | 306 | } |
297 | 307 | ||
298 | void InstallDlg::slotOutput( const QString &msg ) | 308 | void InstallDlg::slotOutput( const QString &msg ) |
299 | { | 309 | { |
300 | // Allow processing of other events | 310 | // Allow processing of other events |
301 | qApp->processEvents(); | 311 | qApp->processEvents(); |
302 | 312 | ||
303 | QString lineStr = msg; | 313 | QString lineStr = msg; |
304 | if ( lineStr[lineStr.length()-1] == '\n' ) | 314 | if ( lineStr[lineStr.length()-1] == '\n' ) |
305 | lineStr.truncate( lineStr.length() - 1 ); | 315 | lineStr.truncate( lineStr.length() - 1 ); |
306 | m_output->append( lineStr ); | 316 | m_output->append( lineStr ); |
307 | m_output->setCursorPosition( m_output->numLines(), 0 ); | 317 | m_output->setCursorPosition( m_output->numLines(), 0 ); |
308 | 318 | ||
309 | // Update available space | 319 | // Update available space |
310 | slotDisplayAvailSpace( QString::null ); | 320 | slotDisplayAvailSpace( QString::null ); |
311 | } | 321 | } |
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index 7ee2d74..5f60990 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp | |||
@@ -1,682 +1,692 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "oipkgconfigdlg.h" | 32 | #include "oipkgconfigdlg.h" |
33 | 33 | ||
34 | #include <opie2/ofiledialog.h> | 34 | #include <opie2/ofiledialog.h> |
35 | 35 | ||
36 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
37 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
38 | 38 | ||
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qgroupbox.h> | 41 | #include <qgroupbox.h> |
42 | #include <qlabel.h> | 42 | #include <qlabel.h> |
43 | #include <qlineedit.h> | 43 | #include <qlineedit.h> |
44 | #include <qlistbox.h> | 44 | #include <qlistbox.h> |
45 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
46 | #include <qscrollview.h> | 46 | #include <qscrollview.h> |
47 | #include <qwhatsthis.h> | 47 | #include <qwhatsthis.h> |
48 | 48 | ||
49 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) | 49 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) |
50 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | 50 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
51 | , m_ipkg( ipkg ) | 51 | , m_ipkg( ipkg ) |
52 | , m_configs( 0l ) | 52 | , m_configs( 0l ) |
53 | , m_installOptions( installOptions ) | 53 | , m_installOptions( installOptions ) |
54 | , m_serverCurrent( -1 ) | 54 | , m_serverCurrent( -1 ) |
55 | , m_destCurrent( -1 ) | 55 | , m_destCurrent( -1 ) |
56 | , m_layout( this, 2, 4 ) | 56 | , m_layout( this, 2, 4 ) |
57 | , m_tabWidget( this ) | 57 | , m_tabWidget( this ) |
58 | { | 58 | { |
59 | setCaption( tr( "Configuration" ) ); | 59 | setCaption( tr( "Configuration" ) ); |
60 | 60 | ||
61 | // Initialize configuration widgets | 61 | // Initialize configuration widgets |
62 | if ( !installOptions ) | 62 | if ( !installOptions ) |
63 | { | 63 | { |
64 | initServerWidget(); | 64 | initServerWidget(); |
65 | initDestinationWidget(); | 65 | initDestinationWidget(); |
66 | initProxyWidget(); | 66 | initProxyWidget(); |
67 | } | 67 | } |
68 | initOptionsWidget(); | 68 | initOptionsWidget(); |
69 | 69 | ||
70 | // Load configuration information | 70 | // Load configuration information |
71 | initData(); | 71 | initData(); |
72 | 72 | ||
73 | // Setup tabs for all info | 73 | // Setup tabs for all info |
74 | m_layout.addWidget( &m_tabWidget ); | 74 | m_layout.addWidget( &m_tabWidget ); |
75 | if ( !m_installOptions ) | 75 | if ( !m_installOptions ) |
76 | { | 76 | { |
77 | m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); | 77 | m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); |
78 | m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); | 78 | m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); |
79 | m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); | 79 | m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); |
80 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); | 80 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); |
81 | m_tabWidget.setCurrentTab( tr( "Servers" ) ); | 81 | m_tabWidget.setCurrentTab( tr( "Servers" ) ); |
82 | } | 82 | } |
83 | else | 83 | else |
84 | { | 84 | { |
85 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); | 85 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | void OIpkgConfigDlg::accept() | 89 | void OIpkgConfigDlg::accept() |
90 | { | 90 | { |
91 | // Save server, destination and proxy configuration | 91 | // Save server, destination and proxy configuration |
92 | if ( !m_installOptions ) | 92 | if ( !m_installOptions ) |
93 | { | 93 | { |
94 | // Update proxy information before saving settings | 94 | // Update proxy information before saving settings |
95 | OConfItem *confItem = m_ipkg->findConfItem( OConfItem::Option, "http_proxy" ); | 95 | OConfItem *confItem = m_ipkg->findConfItem( OConfItem::Option, "http_proxy" ); |
96 | if ( confItem ) | 96 | if ( confItem ) |
97 | { | 97 | { |
98 | confItem->setValue( m_proxyHttpServer->text() ); | 98 | confItem->setValue( m_proxyHttpServer->text() ); |
99 | confItem->setActive( m_proxyHttpActive->isChecked() ); | 99 | confItem->setActive( m_proxyHttpActive->isChecked() ); |
100 | } | 100 | } |
101 | else | 101 | else |
102 | m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", | 102 | m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", |
103 | m_proxyHttpServer->text(), QString::null, | 103 | m_proxyHttpServer->text(), QString::null, |
104 | m_proxyHttpActive->isChecked() ) ); | 104 | m_proxyHttpActive->isChecked() ) ); |
105 | 105 | ||
106 | confItem = m_ipkg->findConfItem( OConfItem::Option, "ftp_proxy" ); | 106 | confItem = m_ipkg->findConfItem( OConfItem::Option, "ftp_proxy" ); |
107 | if ( confItem ) | 107 | if ( confItem ) |
108 | { | 108 | { |
109 | confItem->setValue( m_proxyFtpServer->text() ); | 109 | confItem->setValue( m_proxyFtpServer->text() ); |
110 | confItem->setActive( m_proxyFtpActive->isChecked() ); | 110 | confItem->setActive( m_proxyFtpActive->isChecked() ); |
111 | } | 111 | } |
112 | else | 112 | else |
113 | m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", | 113 | m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", |
114 | m_proxyFtpServer->text(), QString::null, | 114 | m_proxyFtpServer->text(), QString::null, |
115 | m_proxyFtpActive->isChecked() ) ); | 115 | m_proxyFtpActive->isChecked() ) ); |
116 | 116 | ||
117 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_username" ); | 117 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_username" ); |
118 | if ( confItem ) | 118 | if ( confItem ) |
119 | confItem->setValue( m_proxyUsername->text() ); | 119 | confItem->setValue( m_proxyUsername->text() ); |
120 | else | 120 | else |
121 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", | 121 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", |
122 | m_proxyUsername->text() ) ); | 122 | m_proxyUsername->text() ) ); |
123 | 123 | ||
124 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_password" ); | 124 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_password" ); |
125 | if ( confItem ) | 125 | if ( confItem ) |
126 | confItem->setValue( m_proxyPassword->text() ); | 126 | confItem->setValue( m_proxyPassword->text() ); |
127 | else | 127 | else |
128 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_password", | 128 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_password", |
129 | m_proxyPassword->text() ) ); | 129 | m_proxyPassword->text() ) ); |
130 | 130 | ||
131 | confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" ); | 131 | confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" ); |
132 | if ( confItem ) | 132 | if ( confItem ) |
133 | confItem->setValue( m_optSourceLists->text() ); | 133 | confItem->setValue( m_optSourceLists->text() ); |
134 | else | 134 | else |
135 | m_configs->append( new OConfItem( OConfItem::Other, "lists_dir", | 135 | m_configs->append( new OConfItem( OConfItem::Other, "lists_dir", |
136 | m_optSourceLists->text(), "name" ) ); | 136 | m_optSourceLists->text(), "name" ) ); |
137 | 137 | ||
138 | m_ipkg->setConfigItems( m_configs ); | 138 | m_ipkg->setConfigItems( m_configs ); |
139 | } | 139 | } |
140 | 140 | ||
141 | // Save options configuration | 141 | // Save options configuration |
142 | int options = 0; | 142 | int options = 0; |
143 | if ( m_optForceDepends->isChecked() ) | 143 | if ( m_optForceDepends->isChecked() ) |
144 | options |= FORCE_DEPENDS; | 144 | options |= FORCE_DEPENDS; |
145 | if ( m_optForceReinstall->isChecked() ) | 145 | if ( m_optForceReinstall->isChecked() ) |
146 | options |= FORCE_REINSTALL; | 146 | options |= FORCE_REINSTALL; |
147 | if ( m_optForceRemove->isChecked() ) | 147 | if ( m_optForceRemove->isChecked() ) |
148 | options |= FORCE_REMOVE; | 148 | options |= FORCE_REMOVE; |
149 | if ( m_optForceOverwrite->isChecked() ) | 149 | if ( m_optForceOverwrite->isChecked() ) |
150 | options |= FORCE_OVERWRITE; | 150 | options |= FORCE_OVERWRITE; |
151 | m_ipkg->setIpkgExecOptions( options ); | 151 | m_ipkg->setIpkgExecOptions( options ); |
152 | m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); | 152 | m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); |
153 | 153 | ||
154 | QDialog::accept(); | 154 | QDialog::accept(); |
155 | } | 155 | } |
156 | 156 | ||
157 | void OIpkgConfigDlg::reject() | 157 | void OIpkgConfigDlg::reject() |
158 | { | 158 | { |
159 | if ( m_configs ) | 159 | if ( m_configs ) |
160 | delete m_configs; | 160 | delete m_configs; |
161 | } | 161 | } |
162 | 162 | ||
163 | void OIpkgConfigDlg::initServerWidget() | 163 | void OIpkgConfigDlg::initServerWidget() |
164 | { | 164 | { |
165 | m_serverWidget = new QWidget( this ); | 165 | m_serverWidget = new QWidget( this ); |
166 | 166 | ||
167 | // Initialize UI | 167 | // Initialize UI |
168 | QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); | 168 | QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); |
169 | QScrollView *sv = new QScrollView( m_serverWidget ); | 169 | QScrollView *sv = new QScrollView( m_serverWidget ); |
170 | vb->addWidget( sv, 0, 0 ); | 170 | vb->addWidget( sv, 0, 0 ); |
171 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 171 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
172 | sv->setFrameStyle( QFrame::NoFrame ); | 172 | sv->setFrameStyle( QFrame::NoFrame ); |
173 | QWidget *container = new QWidget( sv->viewport() ); | 173 | QWidget *container = new QWidget( sv->viewport() ); |
174 | sv->addChild( container ); | 174 | sv->addChild( container ); |
175 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); | 175 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); |
176 | 176 | ||
177 | m_serverList = new QListBox( container ); | 177 | m_serverList = new QListBox( container ); |
178 | QWhatsThis::add( m_serverList, tr( "This is a list of all servers configured. Select one here to edit or delete, or add a new one below." ) ); | 178 | QWhatsThis::add( m_serverList, tr( "This is a list of all servers configured. Select one here to edit or delete, or add a new one below." ) ); |
179 | m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 179 | m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
180 | connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) ); | 180 | connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) ); |
181 | layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 ); | 181 | layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 ); |
182 | 182 | ||
183 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); | 183 | QPixmap pic; |
184 | pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
185 | QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); | ||
184 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); | 186 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); |
185 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); | 187 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); |
186 | layout->addWidget( btn, 1, 0 ); | 188 | layout->addWidget( btn, 1, 0 ); |
187 | 189 | ||
188 | m_serverEditBtn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), container ); | 190 | pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
191 | m_serverEditBtn = new QPushButton( pic, tr( "Edit" ), container ); | ||
189 | m_serverEditBtn->setEnabled( false ); | 192 | m_serverEditBtn->setEnabled( false ); |
190 | QWhatsThis::add( m_serverEditBtn, tr( "Tap here to edit the entry selected above." ) ); | 193 | QWhatsThis::add( m_serverEditBtn, tr( "Tap here to edit the entry selected above." ) ); |
191 | connect( m_serverEditBtn, SIGNAL(clicked()), this, SLOT(slotServerEdit()) ); | 194 | connect( m_serverEditBtn, SIGNAL(clicked()), this, SLOT(slotServerEdit()) ); |
192 | layout->addWidget( m_serverEditBtn, 1, 1 ); | 195 | layout->addWidget( m_serverEditBtn, 1, 1 ); |
193 | 196 | ||
194 | m_serverDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 197 | pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
198 | m_serverDeleteBtn = new QPushButton( pic, tr( "Delete" ), container ); | ||
195 | m_serverDeleteBtn->setEnabled( false ); | 199 | m_serverDeleteBtn->setEnabled( false ); |
196 | QWhatsThis::add( m_serverDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); | 200 | QWhatsThis::add( m_serverDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); |
197 | connect( m_serverDeleteBtn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); | 201 | connect( m_serverDeleteBtn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); |
198 | layout->addWidget( m_serverDeleteBtn, 1, 2 ); | 202 | layout->addWidget( m_serverDeleteBtn, 1, 2 ); |
199 | } | 203 | } |
200 | 204 | ||
201 | void OIpkgConfigDlg::initDestinationWidget() | 205 | void OIpkgConfigDlg::initDestinationWidget() |
202 | { | 206 | { |
203 | m_destWidget = new QWidget( this ); | 207 | m_destWidget = new QWidget( this ); |
204 | 208 | ||
205 | // Initialize UI | 209 | // Initialize UI |
206 | QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); | 210 | QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); |
207 | QScrollView *sv = new QScrollView( m_destWidget ); | 211 | QScrollView *sv = new QScrollView( m_destWidget ); |
208 | vb->addWidget( sv, 0, 0 ); | 212 | vb->addWidget( sv, 0, 0 ); |
209 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 213 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
210 | sv->setFrameStyle( QFrame::NoFrame ); | 214 | sv->setFrameStyle( QFrame::NoFrame ); |
211 | QWidget *container = new QWidget( sv->viewport() ); | 215 | QWidget *container = new QWidget( sv->viewport() ); |
212 | sv->addChild( container ); | 216 | sv->addChild( container ); |
213 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); | 217 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); |
214 | 218 | ||
215 | m_destList = new QListBox( container ); | 219 | m_destList = new QListBox( container ); |
216 | QWhatsThis::add( m_destList, tr( "This is a list of all destinations configured for this device. Select one here to edit or delete, or add a new one below." ) ); | 220 | QWhatsThis::add( m_destList, tr( "This is a list of all destinations configured for this device. Select one here to edit or delete, or add a new one below." ) ); |
217 | m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 221 | m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
218 | connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestSelected(int)) ); | 222 | connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestSelected(int)) ); |
219 | layout->addMultiCellWidget( m_destList, 0, 0, 0, 2 ); | 223 | layout->addMultiCellWidget( m_destList, 0, 0, 0, 2 ); |
220 | 224 | ||
221 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); | 225 | QPixmap pic; |
226 | pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
227 | QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); | ||
222 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); | 228 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); |
223 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); | 229 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); |
224 | layout->addWidget( btn, 1, 0 ); | 230 | layout->addWidget( btn, 1, 0 ); |
225 | 231 | ||
226 | m_destEditBtn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), container ); | 232 | pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
233 | m_destEditBtn = new QPushButton( pic, tr( "Edit" ), container ); | ||
227 | m_destEditBtn->setEnabled( false ); | 234 | m_destEditBtn->setEnabled( false ); |
228 | QWhatsThis::add( m_destEditBtn, tr( "Tap here to edit the entry selected above." ) ); | 235 | QWhatsThis::add( m_destEditBtn, tr( "Tap here to edit the entry selected above." ) ); |
229 | connect( m_destEditBtn, SIGNAL(clicked()), this, SLOT(slotDestEdit()) ); | 236 | connect( m_destEditBtn, SIGNAL(clicked()), this, SLOT(slotDestEdit()) ); |
230 | layout->addWidget( m_destEditBtn, 1, 1 ); | 237 | layout->addWidget( m_destEditBtn, 1, 1 ); |
231 | 238 | ||
232 | m_destDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 239 | pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
240 | m_destDeleteBtn = new QPushButton( pic, tr( "Delete" ), container ); | ||
233 | m_destDeleteBtn->setEnabled( false ); | 241 | m_destDeleteBtn->setEnabled( false ); |
234 | QWhatsThis::add( m_destDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); | 242 | QWhatsThis::add( m_destDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); |
235 | connect( m_destDeleteBtn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); | 243 | connect( m_destDeleteBtn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); |
236 | layout->addWidget( m_destDeleteBtn, 1, 2 ); | 244 | layout->addWidget( m_destDeleteBtn, 1, 2 ); |
237 | } | 245 | } |
238 | 246 | ||
239 | void OIpkgConfigDlg::initProxyWidget() | 247 | void OIpkgConfigDlg::initProxyWidget() |
240 | { | 248 | { |
241 | m_proxyWidget = new QWidget( this ); | 249 | m_proxyWidget = new QWidget( this ); |
242 | 250 | ||
243 | // Initialize UI | 251 | // Initialize UI |
244 | QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget ); | 252 | QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget ); |
245 | QScrollView *sv = new QScrollView( m_proxyWidget ); | 253 | QScrollView *sv = new QScrollView( m_proxyWidget ); |
246 | vb->addWidget( sv, 0, 0 ); | 254 | vb->addWidget( sv, 0, 0 ); |
247 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 255 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
248 | sv->setFrameStyle( QFrame::NoFrame ); | 256 | sv->setFrameStyle( QFrame::NoFrame ); |
249 | QWidget *container = new QWidget( sv->viewport() ); | 257 | QWidget *container = new QWidget( sv->viewport() ); |
250 | sv->addChild( container ); | 258 | sv->addChild( container ); |
251 | QGridLayout *layout = new QGridLayout( container, 4, 2, 2, 4 ); | 259 | QGridLayout *layout = new QGridLayout( container, 4, 2, 2, 4 ); |
252 | 260 | ||
253 | // HTTP proxy server configuration | 261 | // HTTP proxy server configuration |
254 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); | 262 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); |
255 | grpbox->layout()->setSpacing( 2 ); | 263 | grpbox->layout()->setSpacing( 2 ); |
256 | grpbox->layout()->setMargin( 4 ); | 264 | grpbox->layout()->setMargin( 4 ); |
257 | layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); | 265 | layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); |
258 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); | 266 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); |
259 | m_proxyHttpServer = new QLineEdit( grpbox ); | 267 | m_proxyHttpServer = new QLineEdit( grpbox ); |
260 | QWhatsThis::add( m_proxyHttpServer, tr( "Enter the URL address of the HTTP proxy server here." ) ); | 268 | QWhatsThis::add( m_proxyHttpServer, tr( "Enter the URL address of the HTTP proxy server here." ) ); |
261 | grplayout->addWidget( m_proxyHttpServer ); | 269 | grplayout->addWidget( m_proxyHttpServer ); |
262 | m_proxyHttpActive = new QCheckBox( tr( "Enabled" ), grpbox ); | 270 | m_proxyHttpActive = new QCheckBox( tr( "Enabled" ), grpbox ); |
263 | QWhatsThis::add( m_proxyHttpActive, tr( "Tap here to enable or disable the HTTP proxy server." ) ); | 271 | QWhatsThis::add( m_proxyHttpActive, tr( "Tap here to enable or disable the HTTP proxy server." ) ); |
264 | grplayout->addWidget( m_proxyHttpActive ); | 272 | grplayout->addWidget( m_proxyHttpActive ); |
265 | 273 | ||
266 | // FTP proxy server configuration | 274 | // FTP proxy server configuration |
267 | grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); | 275 | grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); |
268 | grpbox->layout()->setSpacing( 2 ); | 276 | grpbox->layout()->setSpacing( 2 ); |
269 | grpbox->layout()->setMargin( 4 ); | 277 | grpbox->layout()->setMargin( 4 ); |
270 | layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); | 278 | layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); |
271 | grplayout = new QVBoxLayout( grpbox->layout() ); | 279 | grplayout = new QVBoxLayout( grpbox->layout() ); |
272 | m_proxyFtpServer = new QLineEdit( grpbox ); | 280 | m_proxyFtpServer = new QLineEdit( grpbox ); |
273 | QWhatsThis::add( m_proxyFtpServer, tr( "Enter the URL address of the FTP proxy server here." ) ); | 281 | QWhatsThis::add( m_proxyFtpServer, tr( "Enter the URL address of the FTP proxy server here." ) ); |
274 | grplayout->addWidget( m_proxyFtpServer ); | 282 | grplayout->addWidget( m_proxyFtpServer ); |
275 | m_proxyFtpActive = new QCheckBox( tr( "Enabled" ), grpbox ); | 283 | m_proxyFtpActive = new QCheckBox( tr( "Enabled" ), grpbox ); |
276 | QWhatsThis::add( m_proxyFtpActive, tr( "Tap here to enable or disable the FTP proxy server." ) ); | 284 | QWhatsThis::add( m_proxyFtpActive, tr( "Tap here to enable or disable the FTP proxy server." ) ); |
277 | grplayout->addWidget( m_proxyFtpActive ); | 285 | grplayout->addWidget( m_proxyFtpActive ); |
278 | 286 | ||
279 | // Proxy server username and password configuration | 287 | // Proxy server username and password configuration |
280 | QLabel *label = new QLabel( tr( "Username:" ), container ); | 288 | QLabel *label = new QLabel( tr( "Username:" ), container ); |
281 | QWhatsThis::add( label, tr( "Enter the username for the proxy servers here." ) ); | 289 | QWhatsThis::add( label, tr( "Enter the username for the proxy servers here." ) ); |
282 | layout->addWidget( label, 2, 0 ); | 290 | layout->addWidget( label, 2, 0 ); |
283 | m_proxyUsername = new QLineEdit( container ); | 291 | m_proxyUsername = new QLineEdit( container ); |
284 | QWhatsThis::add( m_proxyUsername, tr( "Enter the username for the proxy servers here." ) ); | 292 | QWhatsThis::add( m_proxyUsername, tr( "Enter the username for the proxy servers here." ) ); |
285 | layout->addWidget( m_proxyUsername, 2, 1 ); | 293 | layout->addWidget( m_proxyUsername, 2, 1 ); |
286 | 294 | ||
287 | label = new QLabel( tr( "Password:" ), container ); | 295 | label = new QLabel( tr( "Password:" ), container ); |
288 | QWhatsThis::add( label, tr( "Enter the password for the proxy servers here." ) ); | 296 | QWhatsThis::add( label, tr( "Enter the password for the proxy servers here." ) ); |
289 | layout->addWidget( label, 3, 0 ); | 297 | layout->addWidget( label, 3, 0 ); |
290 | m_proxyPassword = new QLineEdit( container ); | 298 | m_proxyPassword = new QLineEdit( container ); |
291 | QWhatsThis::add( m_proxyPassword, tr( "Enter the password for the proxy servers here." ) ); | 299 | QWhatsThis::add( m_proxyPassword, tr( "Enter the password for the proxy servers here." ) ); |
292 | layout->addWidget( m_proxyPassword, 3, 1 ); | 300 | layout->addWidget( m_proxyPassword, 3, 1 ); |
293 | } | 301 | } |
294 | 302 | ||
295 | void OIpkgConfigDlg::initOptionsWidget() | 303 | void OIpkgConfigDlg::initOptionsWidget() |
296 | { | 304 | { |
297 | m_optionsWidget = new QWidget( this ); | 305 | m_optionsWidget = new QWidget( this ); |
298 | 306 | ||
299 | // Initialize UI | 307 | // Initialize UI |
300 | QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget ); | 308 | QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget ); |
301 | QScrollView *sv = new QScrollView( m_optionsWidget ); | 309 | QScrollView *sv = new QScrollView( m_optionsWidget ); |
302 | vb->addWidget( sv, 0, 0 ); | 310 | vb->addWidget( sv, 0, 0 ); |
303 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 311 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
304 | sv->setFrameStyle( QFrame::NoFrame ); | 312 | sv->setFrameStyle( QFrame::NoFrame ); |
305 | QWidget *container = new QWidget( sv->viewport() ); | 313 | QWidget *container = new QWidget( sv->viewport() ); |
306 | sv->addChild( container ); | 314 | sv->addChild( container ); |
307 | QGridLayout *layout = new QGridLayout( container, 8, 2, 2, 4 ); | 315 | QGridLayout *layout = new QGridLayout( container, 8, 2, 2, 4 ); |
308 | 316 | ||
309 | m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container ); | 317 | m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container ); |
310 | QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) ); | 318 | QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) ); |
311 | layout->addMultiCellWidget( m_optForceDepends, 0, 0, 0, 1 ); | 319 | layout->addMultiCellWidget( m_optForceDepends, 0, 0, 0, 1 ); |
312 | 320 | ||
313 | m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); | 321 | m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); |
314 | QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) ); | 322 | QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) ); |
315 | layout->addMultiCellWidget( m_optForceReinstall, 1, 1, 0, 1 ); | 323 | layout->addMultiCellWidget( m_optForceReinstall, 1, 1, 0, 1 ); |
316 | 324 | ||
317 | m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); | 325 | m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); |
318 | QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) ); | 326 | QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) ); |
319 | layout->addMultiCellWidget( m_optForceRemove, 2, 2, 0, 1 ); | 327 | layout->addMultiCellWidget( m_optForceRemove, 2, 2, 0, 1 ); |
320 | 328 | ||
321 | m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); | 329 | m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); |
322 | QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) ); | 330 | QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) ); |
323 | layout->addMultiCellWidget( m_optForceOverwrite, 3, 3, 0, 1 ); | 331 | layout->addMultiCellWidget( m_optForceOverwrite, 3, 3, 0, 1 ); |
324 | 332 | ||
325 | QLabel *l = new QLabel( tr( "Information level:" ), container ); | 333 | QLabel *l = new QLabel( tr( "Information level:" ), container ); |
326 | QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); | 334 | QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); |
327 | layout->addMultiCellWidget( l, 4, 4, 0, 1 ); | 335 | layout->addMultiCellWidget( l, 4, 4, 0, 1 ); |
328 | 336 | ||
329 | m_optVerboseIpkg = new QComboBox( container ); | 337 | m_optVerboseIpkg = new QComboBox( container ); |
330 | QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); | 338 | QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); |
331 | m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); | 339 | m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); |
332 | m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); | 340 | m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); |
333 | m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); | 341 | m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); |
334 | m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); | 342 | m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); |
335 | layout->addMultiCellWidget( m_optVerboseIpkg, 5, 5, 0, 1 ); | 343 | layout->addMultiCellWidget( m_optVerboseIpkg, 5, 5, 0, 1 ); |
336 | 344 | ||
337 | l = new QLabel( tr( "Package source lists directory:" ), container ); | 345 | l = new QLabel( tr( "Package source lists directory:" ), container ); |
338 | QWhatsThis::add( l, tr( "Enter the directory where package source feed information is stored." ) ); | 346 | QWhatsThis::add( l, tr( "Enter the directory where package source feed information is stored." ) ); |
339 | layout->addMultiCellWidget( l, 6, 6, 0, 1 ); | 347 | layout->addMultiCellWidget( l, 6, 6, 0, 1 ); |
340 | 348 | ||
341 | m_optSourceLists = new QLineEdit( container ); | 349 | m_optSourceLists = new QLineEdit( container ); |
342 | QWhatsThis::add( m_optSourceLists, tr( "Enter the directory where package source feed information is stored." ) ); | 350 | QWhatsThis::add( m_optSourceLists, tr( "Enter the directory where package source feed information is stored." ) ); |
343 | layout->addWidget( m_optSourceLists, 7, 0 ); | 351 | layout->addWidget( m_optSourceLists, 7, 0 ); |
344 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, container ); | 352 | QPixmap pic; |
353 | pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
354 | QPushButton *btn = new QPushButton( pic, QString::null, container ); | ||
345 | btn->setMaximumWidth( btn->height() ); | 355 | btn->setMaximumWidth( btn->height() ); |
346 | QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) ); | 356 | QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) ); |
347 | connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) ); | 357 | connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) ); |
348 | layout->addWidget( btn, 7, 1 ); | 358 | layout->addWidget( btn, 7, 1 ); |
349 | 359 | ||
350 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 360 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
351 | } | 361 | } |
352 | 362 | ||
353 | void OIpkgConfigDlg::initData() | 363 | void OIpkgConfigDlg::initData() |
354 | { | 364 | { |
355 | // Read ipkg configuration (server/destination/proxy) information | 365 | // Read ipkg configuration (server/destination/proxy) information |
356 | if ( m_ipkg && !m_installOptions ) | 366 | if ( m_ipkg && !m_installOptions ) |
357 | { | 367 | { |
358 | m_configs = m_ipkg->configItems(); | 368 | m_configs = m_ipkg->configItems(); |
359 | if ( m_configs ) | 369 | if ( m_configs ) |
360 | { | 370 | { |
361 | for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) | 371 | for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) |
362 | { | 372 | { |
363 | OConfItem *config = configIt.current(); | 373 | OConfItem *config = configIt.current(); |
364 | 374 | ||
365 | // Add configuration item to the appropriate dialog controls | 375 | // Add configuration item to the appropriate dialog controls |
366 | if ( config ) | 376 | if ( config ) |
367 | { | 377 | { |
368 | switch ( config->type() ) | 378 | switch ( config->type() ) |
369 | { | 379 | { |
370 | case OConfItem::Source : m_serverList->insertItem( config->name() ); break; | 380 | case OConfItem::Source : m_serverList->insertItem( config->name() ); break; |
371 | case OConfItem::Destination : m_destList->insertItem( config->name() ); break; | 381 | case OConfItem::Destination : m_destList->insertItem( config->name() ); break; |
372 | case OConfItem::Option : | 382 | case OConfItem::Option : |
373 | { | 383 | { |
374 | if ( config->name() == "http_proxy" ) | 384 | if ( config->name() == "http_proxy" ) |
375 | { | 385 | { |
376 | m_proxyHttpServer->setText( config->value() ); | 386 | m_proxyHttpServer->setText( config->value() ); |
377 | m_proxyHttpActive->setChecked( config->active() ); | 387 | m_proxyHttpActive->setChecked( config->active() ); |
378 | } | 388 | } |
379 | else if ( config->name() == "ftp_proxy" ) | 389 | else if ( config->name() == "ftp_proxy" ) |
380 | { | 390 | { |
381 | m_proxyFtpServer->setText( config->value() ); | 391 | m_proxyFtpServer->setText( config->value() ); |
382 | m_proxyFtpActive->setChecked( config->active() ); | 392 | m_proxyFtpActive->setChecked( config->active() ); |
383 | } | 393 | } |
384 | else if ( config->name() == "proxy_username" ) | 394 | else if ( config->name() == "proxy_username" ) |
385 | { | 395 | { |
386 | m_proxyUsername->setText( config->value() ); | 396 | m_proxyUsername->setText( config->value() ); |
387 | } | 397 | } |
388 | else if ( config->name() == "proxy_password" ) | 398 | else if ( config->name() == "proxy_password" ) |
389 | { | 399 | { |
390 | m_proxyPassword->setText( config->value() ); | 400 | m_proxyPassword->setText( config->value() ); |
391 | } | 401 | } |
392 | } | 402 | } |
393 | break; | 403 | break; |
394 | case OConfItem::Other : | 404 | case OConfItem::Other : |
395 | { | 405 | { |
396 | if ( config->name() == "lists_dir" ) | 406 | if ( config->name() == "lists_dir" ) |
397 | m_optSourceLists->setText( config->value() ); | 407 | m_optSourceLists->setText( config->value() ); |
398 | else // TODO - use proper libipkg define | 408 | else // TODO - use proper libipkg define |
399 | m_optSourceLists->setText( "/usr/lib/ipkg/lists" ); | 409 | m_optSourceLists->setText( "/usr/lib/ipkg/lists" ); |
400 | } | 410 | } |
401 | break; | 411 | break; |
402 | default : break; | 412 | default : break; |
403 | }; | 413 | }; |
404 | } | 414 | } |
405 | } | 415 | } |
406 | } | 416 | } |
407 | } | 417 | } |
408 | 418 | ||
409 | // Get Ipkg execution options | 419 | // Get Ipkg execution options |
410 | int options = m_ipkg->ipkgExecOptions(); | 420 | int options = m_ipkg->ipkgExecOptions(); |
411 | if ( options & FORCE_DEPENDS ) | 421 | if ( options & FORCE_DEPENDS ) |
412 | m_optForceDepends->setChecked( true ); | 422 | m_optForceDepends->setChecked( true ); |
413 | if ( options & FORCE_REINSTALL ) | 423 | if ( options & FORCE_REINSTALL ) |
414 | m_optForceReinstall->setChecked( true ); | 424 | m_optForceReinstall->setChecked( true ); |
415 | if ( options & FORCE_REMOVE ) | 425 | if ( options & FORCE_REMOVE ) |
416 | m_optForceRemove->setChecked( true ); | 426 | m_optForceRemove->setChecked( true ); |
417 | if ( options & FORCE_OVERWRITE ) | 427 | if ( options & FORCE_OVERWRITE ) |
418 | m_optForceOverwrite->setChecked( true ); | 428 | m_optForceOverwrite->setChecked( true ); |
419 | 429 | ||
420 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); | 430 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); |
421 | } | 431 | } |
422 | 432 | ||
423 | void OIpkgConfigDlg::slotServerSelected( int index ) | 433 | void OIpkgConfigDlg::slotServerSelected( int index ) |
424 | { | 434 | { |
425 | m_serverCurrent = index; | 435 | m_serverCurrent = index; |
426 | 436 | ||
427 | // Enable Edit and Delete buttons | 437 | // Enable Edit and Delete buttons |
428 | m_serverEditBtn->setEnabled( true ); | 438 | m_serverEditBtn->setEnabled( true ); |
429 | m_serverDeleteBtn->setEnabled( true ); | 439 | m_serverDeleteBtn->setEnabled( true ); |
430 | } | 440 | } |
431 | 441 | ||
432 | void OIpkgConfigDlg::slotServerNew() | 442 | void OIpkgConfigDlg::slotServerNew() |
433 | { | 443 | { |
434 | OConfItem *server = new OConfItem( OConfItem::Source ); | 444 | OConfItem *server = new OConfItem( OConfItem::Source ); |
435 | 445 | ||
436 | OIpkgServerDlg dlg( server, this ); | 446 | OIpkgServerDlg dlg( server, this ); |
437 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 447 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
438 | { | 448 | { |
439 | // Add to configuration option list | 449 | // Add to configuration option list |
440 | m_configs->append( server ); | 450 | m_configs->append( server ); |
441 | m_configs->sort(); | 451 | m_configs->sort(); |
442 | 452 | ||
443 | // Add to server list | 453 | // Add to server list |
444 | m_serverList->insertItem( server->name() ); | 454 | m_serverList->insertItem( server->name() ); |
445 | m_serverList->setCurrentItem( m_serverList->count() ); | 455 | m_serverList->setCurrentItem( m_serverList->count() ); |
446 | } | 456 | } |
447 | else | 457 | else |
448 | delete server; | 458 | delete server; |
449 | } | 459 | } |
450 | 460 | ||
451 | void OIpkgConfigDlg::slotServerEdit() | 461 | void OIpkgConfigDlg::slotServerEdit() |
452 | { | 462 | { |
453 | // Find selected server in list | 463 | // Find selected server in list |
454 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); | 464 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); |
455 | 465 | ||
456 | // Edit server | 466 | // Edit server |
457 | if ( server ) | 467 | if ( server ) |
458 | { | 468 | { |
459 | QString origName = server->name(); | 469 | QString origName = server->name(); |
460 | OIpkgServerDlg dlg( server, this ); | 470 | OIpkgServerDlg dlg( server, this ); |
461 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 471 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
462 | { | 472 | { |
463 | // Check to see if name has changed, if so update the server list | 473 | // Check to see if name has changed, if so update the server list |
464 | if ( server->name() != origName ) | 474 | if ( server->name() != origName ) |
465 | m_serverList->changeItem( server->name(), m_serverCurrent ); | 475 | m_serverList->changeItem( server->name(), m_serverCurrent ); |
466 | } | 476 | } |
467 | } | 477 | } |
468 | } | 478 | } |
469 | 479 | ||
470 | void OIpkgConfigDlg::slotServerDelete() | 480 | void OIpkgConfigDlg::slotServerDelete() |
471 | { | 481 | { |
472 | // Find selected server in list | 482 | // Find selected server in list |
473 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); | 483 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); |
474 | 484 | ||
475 | // Delete server | 485 | // Delete server |
476 | if ( server ) | 486 | if ( server ) |
477 | { | 487 | { |
478 | m_configs->removeRef( server ); | 488 | m_configs->removeRef( server ); |
479 | m_serverList->removeItem( m_serverCurrent ); | 489 | m_serverList->removeItem( m_serverCurrent ); |
480 | } | 490 | } |
481 | } | 491 | } |
482 | 492 | ||
483 | void OIpkgConfigDlg::slotDestSelected( int index ) | 493 | void OIpkgConfigDlg::slotDestSelected( int index ) |
484 | { | 494 | { |
485 | m_destCurrent = index; | 495 | m_destCurrent = index; |
486 | 496 | ||
487 | // Enable Edit and Delete buttons | 497 | // Enable Edit and Delete buttons |
488 | m_destEditBtn->setEnabled( true ); | 498 | m_destEditBtn->setEnabled( true ); |
489 | m_destDeleteBtn->setEnabled( true ); | 499 | m_destDeleteBtn->setEnabled( true ); |
490 | } | 500 | } |
491 | 501 | ||
492 | void OIpkgConfigDlg::slotDestNew() | 502 | void OIpkgConfigDlg::slotDestNew() |
493 | { | 503 | { |
494 | OConfItem *dest = new OConfItem( OConfItem::Destination ); | 504 | OConfItem *dest = new OConfItem( OConfItem::Destination ); |
495 | 505 | ||
496 | OIpkgDestDlg dlg( dest, this ); | 506 | OIpkgDestDlg dlg( dest, this ); |
497 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 507 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
498 | { | 508 | { |
499 | // Add to configuration option list | 509 | // Add to configuration option list |
500 | m_configs->append( dest ); | 510 | m_configs->append( dest ); |
501 | m_configs->sort(); | 511 | m_configs->sort(); |
502 | 512 | ||
503 | // Add to destination list | 513 | // Add to destination list |
504 | m_destList->insertItem( dest->name() ); | 514 | m_destList->insertItem( dest->name() ); |
505 | m_destList->setCurrentItem( m_destList->count() ); | 515 | m_destList->setCurrentItem( m_destList->count() ); |
506 | } | 516 | } |
507 | else | 517 | else |
508 | delete dest; | 518 | delete dest; |
509 | } | 519 | } |
510 | 520 | ||
511 | void OIpkgConfigDlg::slotDestEdit() | 521 | void OIpkgConfigDlg::slotDestEdit() |
512 | { | 522 | { |
513 | // Find selected destination in list | 523 | // Find selected destination in list |
514 | OConfItem *dest = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); | 524 | OConfItem *dest = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); |
515 | 525 | ||
516 | // Edit destination | 526 | // Edit destination |
517 | if ( dest ) | 527 | if ( dest ) |
518 | { | 528 | { |
519 | QString origName = dest->name(); | 529 | QString origName = dest->name(); |
520 | OIpkgDestDlg dlg( dest, this ); | 530 | OIpkgDestDlg dlg( dest, this ); |
521 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 531 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
522 | { | 532 | { |
523 | // Check to see if name has changed, if so update the dest list | 533 | // Check to see if name has changed, if so update the dest list |
524 | if ( dest->name() != origName ) | 534 | if ( dest->name() != origName ) |
525 | m_destList->changeItem( dest->name(), m_destCurrent ); | 535 | m_destList->changeItem( dest->name(), m_destCurrent ); |
526 | } | 536 | } |
527 | } | 537 | } |
528 | } | 538 | } |
529 | 539 | ||
530 | void OIpkgConfigDlg::slotDestDelete() | 540 | void OIpkgConfigDlg::slotDestDelete() |
531 | { | 541 | { |
532 | // Find selected destination in list | 542 | // Find selected destination in list |
533 | OConfItem *destination = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); | 543 | OConfItem *destination = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); |
534 | 544 | ||
535 | // Delete destination | 545 | // Delete destination |
536 | if ( destination ) | 546 | if ( destination ) |
537 | { | 547 | { |
538 | m_configs->removeRef( destination ); | 548 | m_configs->removeRef( destination ); |
539 | m_destList->removeItem( m_destCurrent ); | 549 | m_destList->removeItem( m_destCurrent ); |
540 | } | 550 | } |
541 | } | 551 | } |
542 | 552 | ||
543 | void OIpkgConfigDlg::slotOptSelectSourceListsPath() | 553 | void OIpkgConfigDlg::slotOptSelectSourceListsPath() |
544 | { | 554 | { |
545 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_optSourceLists->text() ); | 555 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_optSourceLists->text() ); |
546 | if ( path.at( path.length() - 1 ) == '/' ) | 556 | if ( path.at( path.length() - 1 ) == '/' ) |
547 | path.truncate( path.length() - 1 ); | 557 | path.truncate( path.length() - 1 ); |
548 | if ( !path.isNull() ) | 558 | if ( !path.isNull() ) |
549 | m_optSourceLists->setText( path ); | 559 | m_optSourceLists->setText( path ); |
550 | } | 560 | } |
551 | 561 | ||
552 | OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) | 562 | OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) |
553 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | 563 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
554 | , m_server( server ) | 564 | , m_server( server ) |
555 | { | 565 | { |
556 | setCaption( tr( "Edit Server" ) ); | 566 | setCaption( tr( "Edit Server" ) ); |
557 | 567 | ||
558 | // Initialize UI | 568 | // Initialize UI |
559 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); | 569 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); |
560 | 570 | ||
561 | m_active = new QCheckBox( tr( "Active" ), this ); | 571 | m_active = new QCheckBox( tr( "Active" ), this ); |
562 | QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); | 572 | QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); |
563 | layout->addWidget( m_active ); | 573 | layout->addWidget( m_active ); |
564 | 574 | ||
565 | layout->addStretch(); | 575 | layout->addStretch(); |
566 | 576 | ||
567 | QLabel *label = new QLabel( tr( "Name:" ), this ); | 577 | QLabel *label = new QLabel( tr( "Name:" ), this ); |
568 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); | 578 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); |
569 | layout->addWidget( label ); | 579 | layout->addWidget( label ); |
570 | m_name = new QLineEdit( this ); | 580 | m_name = new QLineEdit( this ); |
571 | QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) ); | 581 | QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) ); |
572 | layout->addWidget( m_name ); | 582 | layout->addWidget( m_name ); |
573 | 583 | ||
574 | layout->addStretch(); | 584 | layout->addStretch(); |
575 | 585 | ||
576 | label = new QLabel( tr( "Address:" ), this ); | 586 | label = new QLabel( tr( "Address:" ), this ); |
577 | QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) ); | 587 | QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) ); |
578 | layout->addWidget( label ); | 588 | layout->addWidget( label ); |
579 | m_location = new QLineEdit( this ); | 589 | m_location = new QLineEdit( this ); |
580 | QWhatsThis::add( m_location, tr( "Enter the URL address of this entry here." ) ); | 590 | QWhatsThis::add( m_location, tr( "Enter the URL address of this entry here." ) ); |
581 | layout->addWidget( m_location ); | 591 | layout->addWidget( m_location ); |
582 | 592 | ||
583 | layout->addStretch(); | 593 | layout->addStretch(); |
584 | 594 | ||
585 | m_compressed = new QCheckBox( tr( "Compressed server feed" ), this ); | 595 | m_compressed = new QCheckBox( tr( "Compressed server feed" ), this ); |
586 | QWhatsThis::add( m_compressed, tr( "Tap here to indicate whether the server support compressed archives or not." ) ); | 596 | QWhatsThis::add( m_compressed, tr( "Tap here to indicate whether the server support compressed archives or not." ) ); |
587 | layout->addWidget( m_compressed ); | 597 | layout->addWidget( m_compressed ); |
588 | 598 | ||
589 | // Populate initial information | 599 | // Populate initial information |
590 | if ( m_server ) | 600 | if ( m_server ) |
591 | { | 601 | { |
592 | m_name->setText( m_server->name() ); | 602 | m_name->setText( m_server->name() ); |
593 | m_location->setText( m_server->value() ); | 603 | m_location->setText( m_server->value() ); |
594 | m_compressed->setChecked( m_server->features().contains( "Compressed" ) ); | 604 | m_compressed->setChecked( m_server->features().contains( "Compressed" ) ); |
595 | m_active->setChecked( m_server->active() ); | 605 | m_active->setChecked( m_server->active() ); |
596 | } | 606 | } |
597 | } | 607 | } |
598 | 608 | ||
599 | void OIpkgServerDlg::accept() | 609 | void OIpkgServerDlg::accept() |
600 | { | 610 | { |
601 | // Save information entered | 611 | // Save information entered |
602 | QString name = m_name->text(); | 612 | QString name = m_name->text(); |
603 | name.replace( QRegExp( " " ), "_" ); | 613 | name.replace( QRegExp( " " ), "_" ); |
604 | m_server->setName( name ); | 614 | m_server->setName( name ); |
605 | m_server->setValue( m_location->text() ); | 615 | m_server->setValue( m_location->text() ); |
606 | m_compressed->isChecked() ? m_server->setFeatures( "Compressed" ) | 616 | m_compressed->isChecked() ? m_server->setFeatures( "Compressed" ) |
607 | : m_server->setFeatures( QString::null ); | 617 | : m_server->setFeatures( QString::null ); |
608 | m_server->setActive( m_active->isChecked() ); | 618 | m_server->setActive( m_active->isChecked() ); |
609 | 619 | ||
610 | QDialog::accept(); | 620 | QDialog::accept(); |
611 | } | 621 | } |
612 | 622 | ||
613 | OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent ) | 623 | OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent ) |
614 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | 624 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
615 | , m_dest( dest ) | 625 | , m_dest( dest ) |
616 | { | 626 | { |
617 | setCaption( tr( "Edit Destination" ) ); | 627 | setCaption( tr( "Edit Destination" ) ); |
618 | 628 | ||
619 | // Initialize UI | 629 | // Initialize UI |
620 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); | 630 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); |
621 | 631 | ||
622 | m_active = new QCheckBox( tr( "Active" ), this ); | 632 | m_active = new QCheckBox( tr( "Active" ), this ); |
623 | QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); | 633 | QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); |
624 | layout->addWidget( m_active ); | 634 | layout->addWidget( m_active ); |
625 | 635 | ||
626 | layout->addStretch(); | 636 | layout->addStretch(); |
627 | 637 | ||
628 | QLabel *label = new QLabel( tr( "Name:" ), this ); | 638 | QLabel *label = new QLabel( tr( "Name:" ), this ); |
629 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); | 639 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); |
630 | layout->addWidget( label ); | 640 | layout->addWidget( label ); |
631 | m_name = new QLineEdit( this ); | 641 | m_name = new QLineEdit( this ); |
632 | QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) ); | 642 | QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) ); |
633 | layout->addWidget( m_name ); | 643 | layout->addWidget( m_name ); |
634 | 644 | ||
635 | layout->addStretch(); | 645 | layout->addStretch(); |
636 | 646 | ||
637 | label = new QLabel( tr( "Location:" ), this ); | 647 | label = new QLabel( tr( "Location:" ), this ); |
638 | QWhatsThis::add( label, tr( "Enter the absolute directory path of this entry here." ) ); | 648 | QWhatsThis::add( label, tr( "Enter the absolute directory path of this entry here." ) ); |
639 | layout->addWidget( label ); | 649 | layout->addWidget( label ); |
640 | 650 | ||
641 | QHBoxLayout *layout2 = new QHBoxLayout( this, 2, 4 ); | 651 | QHBoxLayout *layout2 = new QHBoxLayout( this, 2, 4 ); |
642 | layout->addLayout( layout2 ); | 652 | layout->addLayout( layout2 ); |
643 | 653 | ||
644 | m_location = new QLineEdit( this ); | 654 | m_location = new QLineEdit( this ); |
645 | QWhatsThis::add( m_location, tr( "Enter the absolute directory path of this entry here." ) ); | 655 | QWhatsThis::add( m_location, tr( "Enter the absolute directory path of this entry here." ) ); |
646 | layout2->addWidget( m_location ); | 656 | layout2->addWidget( m_location ); |
647 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, this ); | 657 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, this ); |
648 | btn->setMaximumWidth( btn->height() ); | 658 | btn->setMaximumWidth( btn->height() ); |
649 | QWhatsThis::add( btn, tr( "Tap here to select the desired location." ) ); | 659 | QWhatsThis::add( btn, tr( "Tap here to select the desired location." ) ); |
650 | connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) ); | 660 | connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) ); |
651 | layout2->addWidget( btn ); | 661 | layout2->addWidget( btn ); |
652 | 662 | ||
653 | // Populate initial information | 663 | // Populate initial information |
654 | if ( m_dest ) | 664 | if ( m_dest ) |
655 | { | 665 | { |
656 | m_name->setText( m_dest->name() ); | 666 | m_name->setText( m_dest->name() ); |
657 | m_location->setText( m_dest->value() ); | 667 | m_location->setText( m_dest->value() ); |
658 | m_active->setChecked( m_dest->active() ); | 668 | m_active->setChecked( m_dest->active() ); |
659 | } | 669 | } |
660 | } | 670 | } |
661 | 671 | ||
662 | void OIpkgDestDlg::accept() | 672 | void OIpkgDestDlg::accept() |
663 | { | 673 | { |
664 | // Save information entered | 674 | // Save information entered |
665 | QString name = m_name->text(); | 675 | QString name = m_name->text(); |
666 | name.replace( QRegExp( " " ), "_" ); | 676 | name.replace( QRegExp( " " ), "_" ); |
667 | m_dest->setName( name ); | 677 | m_dest->setName( name ); |
668 | m_dest->setValue( m_location->text() ); | 678 | m_dest->setValue( m_location->text() ); |
669 | m_dest->setActive( m_active->isChecked() ); | 679 | m_dest->setActive( m_active->isChecked() ); |
670 | 680 | ||
671 | QDialog::accept(); | 681 | QDialog::accept(); |
672 | } | 682 | } |
673 | 683 | ||
674 | void OIpkgDestDlg::slotSelectPath() | 684 | void OIpkgDestDlg::slotSelectPath() |
675 | { | 685 | { |
676 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_location->text() ); | 686 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_location->text() ); |
677 | if ( path.at( path.length() - 1 ) == '/' ) | 687 | if ( path.at( path.length() - 1 ) == '/' ) |
678 | path.truncate( path.length() - 1 ); | 688 | path.truncate( path.length() - 1 ); |
679 | if ( !path.isNull() ) | 689 | if ( !path.isNull() ) |
680 | m_location->setText( path ); | 690 | m_location->setText( path ); |
681 | } | 691 | } |
682 | 692 | ||