author | drw <drw> | 2005-06-09 21:00:47 (UTC) |
---|---|---|
committer | drw <drw> | 2005-06-09 21:00:47 (UTC) |
commit | 346a2cd09c2c28bd4d2086b0c152dd348913eaa9 (patch) (unidiff) | |
tree | b79a0e94a2dd35bf9039a2e92ecc033d3572cbb1 | |
parent | 39a9211b7a43742e214aa815094a576dbae07755 (diff) | |
download | opie-346a2cd09c2c28bd4d2086b0c152dd348913eaa9.zip opie-346a2cd09c2c28bd4d2086b0c152dd348913eaa9.tar.gz opie-346a2cd09c2c28bd4d2086b0c152dd348913eaa9.tar.bz2 |
Resource -> OResource
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 58 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 83 | ||||
-rw-r--r-- | noncore/settings/aqpkg/packagewin.cpp | 46 | ||||
-rw-r--r-- | noncore/settings/aqpkg/settingsimpl.cpp | 61 | ||||
-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 12 |
5 files changed, 135 insertions, 125 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index da21cef..e828595 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp | |||
@@ -1,477 +1,475 @@ | |||
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) 2002 Andy Qua <andy.qua@blueyonder.co.uk> | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | .=l. Dan Williams <drw@handhelds.org> | 5 | .=l. Dan Williams <drw@handhelds.org> |
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 <stdio.h> | 30 | #include <stdio.h> |
31 | 31 | ||
32 | #include <opie2/ofiledialog.h> | 32 | #include <opie2/ofiledialog.h> |
33 | #include <opie2/oresource.h> | ||
33 | 34 | ||
34 | #ifdef QWS | ||
35 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
36 | #include <qpe/fileselector.h> | 36 | #include <qpe/fileselector.h> |
37 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
38 | #include <qpe/resource.h> | ||
39 | #include <qpe/storage.h> | 38 | #include <qpe/storage.h> |
40 | #endif | ||
41 | 39 | ||
42 | #include <qcheckbox.h> | 40 | #include <qcheckbox.h> |
43 | #include <qcombobox.h> | 41 | #include <qcombobox.h> |
44 | #include <qdialog.h> | 42 | #include <qdialog.h> |
45 | #include <qfileinfo.h> | 43 | #include <qfileinfo.h> |
46 | #include <qgroupbox.h> | 44 | #include <qgroupbox.h> |
47 | #include <qmultilineedit.h> | 45 | #include <qmultilineedit.h> |
48 | #include <qlabel.h> | 46 | #include <qlabel.h> |
49 | #include <qlayout.h> | 47 | #include <qlayout.h> |
50 | #include <qpushbutton.h> | 48 | #include <qpushbutton.h> |
51 | 49 | ||
52 | #include "datamgr.h" | 50 | #include "datamgr.h" |
53 | #include "destination.h" | 51 | #include "destination.h" |
54 | #include "instoptionsimpl.h" | 52 | #include "instoptionsimpl.h" |
55 | #include "installdlgimpl.h" | 53 | #include "installdlgimpl.h" |
56 | #include "ipkg.h" | 54 | #include "ipkg.h" |
57 | #include "utils.h" | 55 | #include "utils.h" |
58 | #include "global.h" | 56 | #include "global.h" |
59 | 57 | ||
60 | using namespace Opie::Ui; | 58 | using namespace Opie::Ui; |
61 | enum { | 59 | enum { |
62 | MAXLINES = 100, | 60 | MAXLINES = 100, |
63 | }; | 61 | }; |
64 | 62 | ||
65 | InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title ) | 63 | InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title ) |
66 | : QWidget( 0, 0, 0 ) | 64 | : QWidget( 0, 0, 0 ) |
67 | { | 65 | { |
68 | setCaption( title ); | 66 | setCaption( title ); |
69 | init( TRUE ); | 67 | init( TRUE ); |
70 | 68 | ||
71 | pIpkg = 0; | 69 | pIpkg = 0; |
72 | upgradePackages = false; | 70 | upgradePackages = false; |
73 | dataMgr = dataManager; | 71 | dataMgr = dataManager; |
74 | 72 | ||
75 | QString defaultDest = "root"; | 73 | QString defaultDest = "root"; |
76 | #ifdef QWS | 74 | #ifdef QWS |
77 | Config cfg( "aqpkg" ); | 75 | Config cfg( "aqpkg" ); |
78 | cfg.setGroup( "settings" ); | 76 | cfg.setGroup( "settings" ); |
79 | defaultDest = cfg.readEntry( "dest", "root" ); | 77 | defaultDest = cfg.readEntry( "dest", "root" ); |
80 | 78 | ||
81 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) | 79 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) |
82 | flags = cfg.readNumEntry( "installFlags", 0 ); | 80 | flags = cfg.readNumEntry( "installFlags", 0 ); |
83 | infoLevel = cfg.readNumEntry( "infoLevel", 1 ); | 81 | infoLevel = cfg.readNumEntry( "infoLevel", 1 ); |
84 | #else | 82 | #else |
85 | flags = 0; | 83 | flags = 0; |
86 | #endif | 84 | #endif |
87 | 85 | ||
88 | // Output text is read only | 86 | // Output text is read only |
89 | output->setReadOnly( true ); | 87 | output->setReadOnly( true ); |
90 | // QFont f( "helvetica" ); | 88 | // QFont f( "helvetica" ); |
91 | // f.setPointSize( 10 ); | 89 | // f.setPointSize( 10 ); |
92 | // output->setFont( f ); | 90 | // output->setFont( f ); |
93 | 91 | ||
94 | 92 | ||
95 | // setup destination data | 93 | // setup destination data |
96 | int defIndex = 0; | 94 | int defIndex = 0; |
97 | int i; | 95 | int i; |
98 | QListIterator<Destination> dit( dataMgr->getDestinationList() ); | 96 | QListIterator<Destination> dit( dataMgr->getDestinationList() ); |
99 | for ( i = 0; dit.current(); ++dit, ++i ) | 97 | for ( i = 0; dit.current(); ++dit, ++i ) |
100 | { | 98 | { |
101 | destination->insertItem( dit.current()->getDestinationName() ); | 99 | destination->insertItem( dit.current()->getDestinationName() ); |
102 | if ( dit.current()->getDestinationName() == defaultDest ) | 100 | if ( dit.current()->getDestinationName() == defaultDest ) |
103 | defIndex = i; | 101 | defIndex = i; |
104 | } | 102 | } |
105 | 103 | ||
106 | destination->setCurrentItem( defIndex ); | 104 | destination->setCurrentItem( defIndex ); |
107 | 105 | ||
108 | QListIterator<InstallData> it( packageList ); | 106 | QListIterator<InstallData> it( packageList ); |
109 | // setup package data | 107 | // setup package data |
110 | QString remove = tr( "Remove\n" ); | 108 | QString remove = tr( "Remove\n" ); |
111 | QString install = tr( "Install\n" ); | 109 | QString install = tr( "Install\n" ); |
112 | QString upgrade = tr( "Upgrade\n" ); | 110 | QString upgrade = tr( "Upgrade\n" ); |
113 | for ( ; it.current(); ++it ) | 111 | for ( ; it.current(); ++it ) |
114 | { | 112 | { |
115 | InstallData *item = it.current(); | 113 | InstallData *item = it.current(); |
116 | InstallData *newitem = new InstallData(); | 114 | InstallData *newitem = new InstallData(); |
117 | 115 | ||
118 | newitem->option = item->option; | 116 | newitem->option = item->option; |
119 | newitem->packageName = item->packageName; | 117 | newitem->packageName = item->packageName; |
120 | newitem->destination = item->destination; | 118 | newitem->destination = item->destination; |
121 | newitem->recreateLinks = item->recreateLinks; | 119 | newitem->recreateLinks = item->recreateLinks; |
122 | packages.append( newitem ); | 120 | packages.append( newitem ); |
123 | 121 | ||
124 | if ( item->option == "I" ) | 122 | if ( item->option == "I" ) |
125 | { | 123 | { |
126 | install.append( QString( " %1\n" ).arg( item->packageName ) ); | 124 | install.append( QString( " %1\n" ).arg( item->packageName ) ); |
127 | } | 125 | } |
128 | else if ( item->option == "D" ) | 126 | else if ( item->option == "D" ) |
129 | { | 127 | { |
130 | remove.append( QString( " %1\n" ).arg( item->packageName ) ); | 128 | remove.append( QString( " %1\n" ).arg( item->packageName ) ); |
131 | } | 129 | } |
132 | else if ( item->option == "U" || item->option == "R" ) | 130 | else if ( item->option == "U" || item->option == "R" ) |
133 | { | 131 | { |
134 | QString type; | 132 | QString type; |
135 | if ( item->option == "R" ) | 133 | if ( item->option == "R" ) |
136 | type = tr( "(ReInstall)" ); | 134 | type = tr( "(ReInstall)" ); |
137 | else | 135 | else |
138 | type = tr( "(Upgrade)" ); | 136 | type = tr( "(Upgrade)" ); |
139 | upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) ); | 137 | upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) ); |
140 | } | 138 | } |
141 | } | 139 | } |
142 | 140 | ||
143 | output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); | 141 | output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); |
144 | 142 | ||
145 | displayAvailableSpace( destination->currentText() ); | 143 | displayAvailableSpace( destination->currentText() ); |
146 | } | 144 | } |
147 | 145 | ||
148 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title ) | 146 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title ) |
149 | : QWidget( 0, 0, 0 ) | 147 | : QWidget( 0, 0, 0 ) |
150 | { | 148 | { |
151 | setCaption( title ); | 149 | setCaption( title ); |
152 | init( FALSE ); | 150 | init( FALSE ); |
153 | pIpkg = ipkg; | 151 | pIpkg = ipkg; |
154 | output->setText( initialText ); | 152 | output->setText( initialText ); |
155 | } | 153 | } |
156 | 154 | ||
157 | 155 | ||
158 | InstallDlgImpl::~InstallDlgImpl() | 156 | InstallDlgImpl::~InstallDlgImpl() |
159 | { | 157 | { |
160 | if ( pIpkg ) | 158 | if ( pIpkg ) |
161 | delete pIpkg; | 159 | delete pIpkg; |
162 | } | 160 | } |
163 | 161 | ||
164 | void InstallDlgImpl :: init( bool displayextrainfo ) | 162 | void InstallDlgImpl :: init( bool displayextrainfo ) |
165 | { | 163 | { |
166 | QGridLayout *layout = new QGridLayout( this ); | 164 | QGridLayout *layout = new QGridLayout( this ); |
167 | layout->setSpacing( 4 ); | 165 | layout->setSpacing( 4 ); |
168 | layout->setMargin( 4 ); | 166 | layout->setMargin( 4 ); |
169 | 167 | ||
170 | if ( displayextrainfo ) | 168 | if ( displayextrainfo ) |
171 | { | 169 | { |
172 | QLabel *label = new QLabel( tr( "Destination" ), this ); | 170 | QLabel *label = new QLabel( tr( "Destination" ), this ); |
173 | layout->addWidget( label, 0, 0 ); | 171 | layout->addWidget( label, 0, 0 ); |
174 | destination = new QComboBox( FALSE, this ); | 172 | destination = new QComboBox( FALSE, this ); |
175 | layout->addWidget( destination, 0, 1 ); | 173 | layout->addWidget( destination, 0, 1 ); |
176 | connect( destination, SIGNAL( highlighted(const QString&) ), | 174 | connect( destination, SIGNAL( highlighted(const QString&) ), |
177 | this, SLOT( displayAvailableSpace(const QString&) ) ); | 175 | this, SLOT( displayAvailableSpace(const QString&) ) ); |
178 | 176 | ||
179 | QLabel *label2 = new QLabel( tr( "Space Avail" ), this ); | 177 | QLabel *label2 = new QLabel( tr( "Space Avail" ), this ); |
180 | layout->addWidget( label2, 1, 0 ); | 178 | layout->addWidget( label2, 1, 0 ); |
181 | txtAvailableSpace = new QLabel( "", this ); | 179 | txtAvailableSpace = new QLabel( "", this ); |
182 | layout->addWidget( txtAvailableSpace, 1, 1 ); | 180 | layout->addWidget( txtAvailableSpace, 1, 1 ); |
183 | } | 181 | } |
184 | else | 182 | else |
185 | { | 183 | { |
186 | destination = 0x0; | 184 | destination = 0x0; |
187 | txtAvailableSpace = 0x0; | 185 | txtAvailableSpace = 0x0; |
188 | } | 186 | } |
189 | 187 | ||
190 | QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); | 188 | QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); |
191 | GroupBox2->layout()->setSpacing( 0 ); | 189 | GroupBox2->layout()->setSpacing( 0 ); |
192 | GroupBox2->layout()->setMargin( 4 ); | 190 | GroupBox2->layout()->setMargin( 4 ); |
193 | 191 | ||
194 | QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() ); | 192 | QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() ); |
195 | output = new QMultiLineEdit( GroupBox2 ); | 193 | output = new QMultiLineEdit( GroupBox2 ); |
196 | GroupBox2Layout->addWidget( output ); | 194 | GroupBox2Layout->addWidget( output ); |
197 | layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 ); | 195 | layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 ); |
198 | 196 | ||
199 | btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this ); | 197 | btnInstall = new QPushButton( Opie::Core::OResource::loadPixmap( "aqpkg/apply", Opie::Core::OResource::SmallIcon ), tr( "Start" ), this ); |
200 | layout->addWidget( btnInstall, 3, 0 ); | 198 | layout->addWidget( btnInstall, 3, 0 ); |
201 | connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) ); | 199 | connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) ); |
202 | 200 | ||
203 | btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this ); | 201 | btnOptions = new QPushButton( Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), tr( "Options" ), this ); |
204 | layout->addWidget( btnOptions, 3, 1 ); | 202 | layout->addWidget( btnOptions, 3, 1 ); |
205 | connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) ); | 203 | connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) ); |
206 | } | 204 | } |
207 | 205 | ||
208 | void InstallDlgImpl :: optionsSelected() | 206 | void InstallDlgImpl :: optionsSelected() |
209 | { | 207 | { |
210 | if ( btnOptions->text() == tr( "Options" ) ) | 208 | if ( btnOptions->text() == tr( "Options" ) ) |
211 | { | 209 | { |
212 | InstallOptionsDlgImpl opt( flags, infoLevel, this, "Option", true ); | 210 | InstallOptionsDlgImpl opt( flags, infoLevel, this, "Option", true ); |
213 | if ( opt.exec() == QDialog::Accepted ) | 211 | if ( opt.exec() == QDialog::Accepted ) |
214 | { | 212 | { |
215 | // set options selected from dialog | 213 | // set options selected from dialog |
216 | flags = opt.getFlags(); | 214 | flags = opt.getFlags(); |
217 | infoLevel = opt.getInfoLevel(); | 215 | infoLevel = opt.getInfoLevel(); |
218 | 216 | ||
219 | #ifdef QWS | 217 | #ifdef QWS |
220 | Config cfg( "aqpkg" ); | 218 | Config cfg( "aqpkg" ); |
221 | cfg.setGroup( "settings" ); | 219 | cfg.setGroup( "settings" ); |
222 | cfg.writeEntry( "installFlags", flags ); | 220 | cfg.writeEntry( "installFlags", flags ); |
223 | cfg.writeEntry( "infoLevel", infoLevel ); | 221 | cfg.writeEntry( "infoLevel", infoLevel ); |
224 | #endif | 222 | #endif |
225 | } | 223 | } |
226 | } | 224 | } |
227 | else // Save output | 225 | else // Save output |
228 | { | 226 | { |
229 | QMap<QString, QStringList> map; | 227 | QMap<QString, QStringList> map; |
230 | map.insert( tr( "All" ), QStringList() ); | 228 | map.insert( tr( "All" ), QStringList() ); |
231 | QStringList text; | 229 | QStringList text; |
232 | text << "text/*"; | 230 | text << "text/*"; |
233 | map.insert(tr( "Text" ), text ); | 231 | map.insert(tr( "Text" ), text ); |
234 | text << "*"; | 232 | text << "*"; |
235 | map.insert( tr( "All" ), text ); | 233 | map.insert( tr( "All" ), text ); |
236 | 234 | ||
237 | QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); | 235 | QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); |
238 | if( !filename.isEmpty() ) | 236 | if( !filename.isEmpty() ) |
239 | { | 237 | { |
240 | QString currentFileName = QFileInfo( filename ).fileName(); | 238 | QString currentFileName = QFileInfo( filename ).fileName(); |
241 | DocLnk doc; | 239 | DocLnk doc; |
242 | doc.setType( "text/plain" ); | 240 | doc.setType( "text/plain" ); |
243 | doc.setFile( filename ); | 241 | doc.setFile( filename ); |
244 | doc.setName( currentFileName ); | 242 | doc.setName( currentFileName ); |
245 | FileManager fm; | 243 | FileManager fm; |
246 | fm.saveFile( doc, output->text() ); | 244 | fm.saveFile( doc, output->text() ); |
247 | } | 245 | } |
248 | } | 246 | } |
249 | } | 247 | } |
250 | 248 | ||
251 | void InstallDlgImpl :: installSelected() | 249 | void InstallDlgImpl :: installSelected() |
252 | { | 250 | { |
253 | if ( btnInstall->text() == tr( "Abort" ) ) | 251 | if ( btnInstall->text() == tr( "Abort" ) ) |
254 | { | 252 | { |
255 | if ( pIpkg ) | 253 | if ( pIpkg ) |
256 | { | 254 | { |
257 | displayText( tr( "\n**** User Clicked ABORT ***" ) ); | 255 | displayText( tr( "\n**** User Clicked ABORT ***" ) ); |
258 | pIpkg->abort(); | 256 | pIpkg->abort(); |
259 | displayText( tr( "**** Process Aborted ****" ) ); | 257 | displayText( tr( "**** Process Aborted ****" ) ); |
260 | } | 258 | } |
261 | 259 | ||
262 | btnInstall->setText( tr( "Close" ) ); | 260 | btnInstall->setText( tr( "Close" ) ); |
263 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); | 261 | btnInstall->setIconSet( Opie::Core::OResource::loadPixmap( "enter", Opie::Core::OResource::SmallIcon ) ); |
264 | return; | 262 | return; |
265 | } | 263 | } |
266 | else if ( btnInstall->text() == tr( "Close" ) ) | 264 | else if ( btnInstall->text() == tr( "Close" ) ) |
267 | { | 265 | { |
268 | emit reloadData( this ); | 266 | emit reloadData( this ); |
269 | return; | 267 | return; |
270 | } | 268 | } |
271 | 269 | ||
272 | // Disable buttons | 270 | // Disable buttons |
273 | btnOptions->setEnabled( false ); | 271 | btnOptions->setEnabled( false ); |
274 | // btnInstall->setEnabled( false ); | 272 | // btnInstall->setEnabled( false ); |
275 | 273 | ||
276 | btnInstall->setText( tr( "Abort" ) ); | 274 | btnInstall->setText( tr( "Abort" ) ); |
277 | btnInstall->setIconSet( Resource::loadPixmap( "close" ) ); | 275 | btnInstall->setIconSet( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) ); |
278 | 276 | ||
279 | if ( pIpkg ) | 277 | if ( pIpkg ) |
280 | { | 278 | { |
281 | output->setText( "" ); | 279 | output->setText( "" ); |
282 | connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&))); | 280 | connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&))); |
283 | connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); | 281 | connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); |
284 | pIpkg->runIpkg(); | 282 | pIpkg->runIpkg(); |
285 | } | 283 | } |
286 | else | 284 | else |
287 | { | 285 | { |
288 | output->setText( "" ); | 286 | output->setText( "" ); |
289 | Destination *d = dataMgr->getDestination( destination->currentText() ); | 287 | Destination *d = dataMgr->getDestination( destination->currentText() ); |
290 | QString dest = d->getDestinationName(); | 288 | QString dest = d->getDestinationName(); |
291 | QString destDir = d->getDestinationPath(); | 289 | QString destDir = d->getDestinationPath(); |
292 | int instFlags = flags; | 290 | int instFlags = flags; |
293 | if ( d->linkToRoot() ) | 291 | if ( d->linkToRoot() ) |
294 | instFlags |= MAKE_LINKS; | 292 | instFlags |= MAKE_LINKS; |
295 | 293 | ||
296 | #ifdef QWS | 294 | #ifdef QWS |
297 | // Save settings | 295 | // Save settings |
298 | Config cfg( "aqpkg" ); | 296 | Config cfg( "aqpkg" ); |
299 | cfg.setGroup( "settings" ); | 297 | cfg.setGroup( "settings" ); |
300 | cfg.writeEntry( "dest", dest ); | 298 | cfg.writeEntry( "dest", dest ); |
301 | #endif | 299 | #endif |
302 | 300 | ||
303 | pIpkg = new Ipkg; | 301 | pIpkg = new Ipkg; |
304 | connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&))); | 302 | connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&))); |
305 | connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); | 303 | connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); |
306 | 304 | ||
307 | firstPackage = TRUE; | 305 | firstPackage = TRUE; |
308 | ipkgFinished(); | 306 | ipkgFinished(); |
309 | 307 | ||
310 | // First run through the remove list, then the install list then the upgrade list | 308 | // First run through the remove list, then the install list then the upgrade list |
311 | /* | 309 | /* |
312 | pIpkg->setOption( "remove" ); | 310 | pIpkg->setOption( "remove" ); |
313 | QListIterator<InstallData> it( removeList ); | 311 | QListIterator<InstallData> it( removeList ); |
314 | InstallData *idata; | 312 | InstallData *idata; |
315 | for ( ; it.current(); ++it ) | 313 | for ( ; it.current(); ++it ) |
316 | { | 314 | { |
317 | idata = it.current(); | 315 | idata = it.current(); |
318 | pIpkg->setDestination( idata->destination->getDestinationName() ); | 316 | pIpkg->setDestination( idata->destination->getDestinationName() ); |
319 | pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); | 317 | pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); |
320 | pIpkg->setPackage( idata->packageName ); | 318 | pIpkg->setPackage( idata->packageName ); |
321 | 319 | ||
322 | int tmpFlags = flags; | 320 | int tmpFlags = flags; |
323 | if ( idata->destination->linkToRoot() ) | 321 | if ( idata->destination->linkToRoot() ) |
324 | tmpFlags |= MAKE_LINKS; | 322 | tmpFlags |= MAKE_LINKS; |
325 | 323 | ||
326 | pIpkg->setFlags( tmpFlags, infoLevel ); | 324 | pIpkg->setFlags( tmpFlags, infoLevel ); |
327 | pIpkg->runIpkg(); | 325 | pIpkg->runIpkg(); |
328 | } | 326 | } |
329 | 327 | ||
330 | pIpkg->setOption( "install" ); | 328 | pIpkg->setOption( "install" ); |
331 | pIpkg->setDestination( dest ); | 329 | pIpkg->setDestination( dest ); |
332 | pIpkg->setDestinationDir( destDir ); | 330 | pIpkg->setDestinationDir( destDir ); |
333 | pIpkg->setFlags( instFlags, infoLevel ); | 331 | pIpkg->setFlags( instFlags, infoLevel ); |
334 | QListIterator<InstallData> it2( installList ); | 332 | QListIterator<InstallData> it2( installList ); |
335 | for ( ; it2.current(); ++it2 ) | 333 | for ( ; it2.current(); ++it2 ) |
336 | { | 334 | { |
337 | pIpkg->setPackage( it2.current()->packageName ); | 335 | pIpkg->setPackage( it2.current()->packageName ); |
338 | pIpkg->runIpkg(); | 336 | pIpkg->runIpkg(); |
339 | } | 337 | } |
340 | 338 | ||
341 | flags |= FORCE_REINSTALL; | 339 | flags |= FORCE_REINSTALL; |
342 | QListIterator<InstallData> it3( updateList ); | 340 | QListIterator<InstallData> it3( updateList ); |
343 | for ( ; it3.current() ; ++it3 ) | 341 | for ( ; it3.current() ; ++it3 ) |
344 | { | 342 | { |
345 | idata = it3.current(); | 343 | idata = it3.current(); |
346 | if ( idata->option == "R" ) | 344 | if ( idata->option == "R" ) |
347 | pIpkg->setOption( "reinstall" ); | 345 | pIpkg->setOption( "reinstall" ); |
348 | else | 346 | else |
349 | pIpkg->setOption( "upgrade" ); | 347 | pIpkg->setOption( "upgrade" ); |
350 | pIpkg->setDestination( idata->destination->getDestinationName() ); | 348 | pIpkg->setDestination( idata->destination->getDestinationName() ); |
351 | pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); | 349 | pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); |
352 | pIpkg->setPackage( idata->packageName ); | 350 | pIpkg->setPackage( idata->packageName ); |
353 | 351 | ||
354 | int tmpFlags = flags; | 352 | int tmpFlags = flags; |
355 | if ( idata->destination->linkToRoot() && idata->recreateLinks ) | 353 | if ( idata->destination->linkToRoot() && idata->recreateLinks ) |
356 | tmpFlags |= MAKE_LINKS; | 354 | tmpFlags |= MAKE_LINKS; |
357 | pIpkg->setFlags( tmpFlags, infoLevel ); | 355 | pIpkg->setFlags( tmpFlags, infoLevel ); |
358 | pIpkg->runIpkg(); | 356 | pIpkg->runIpkg(); |
359 | } | 357 | } |
360 | 358 | ||
361 | delete pIpkg; | 359 | delete pIpkg; |
362 | pIpkg = 0; | 360 | pIpkg = 0; |
363 | */ | 361 | */ |
364 | } | 362 | } |
365 | } | 363 | } |
366 | 364 | ||
367 | 365 | ||
368 | void InstallDlgImpl :: displayText(const QString &text ) | 366 | void InstallDlgImpl :: displayText(const QString &text ) |
369 | { | 367 | { |
370 | QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); | 368 | QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); |
371 | 369 | ||
372 | /* Set a max line count for the QMultiLineEdit, as users have reported | 370 | /* Set a max line count for the QMultiLineEdit, as users have reported |
373 | * performance issues when line count gets extreme. | 371 | * performance issues when line count gets extreme. |
374 | */ | 372 | */ |
375 | if(output->numLines() >= MAXLINES) | 373 | if(output->numLines() >= MAXLINES) |
376 | output->removeLine(0); | 374 | output->removeLine(0); |
377 | output->setText( newtext ); | 375 | output->setText( newtext ); |
378 | output->setCursorPosition( output->numLines(), 0 ); | 376 | output->setCursorPosition( output->numLines(), 0 ); |
379 | } | 377 | } |
380 | 378 | ||
381 | 379 | ||
382 | void InstallDlgImpl :: displayAvailableSpace( const QString &text ) | 380 | void InstallDlgImpl :: displayAvailableSpace( const QString &text ) |
383 | { | 381 | { |
384 | Destination *d = dataMgr->getDestination( text ); | 382 | Destination *d = dataMgr->getDestination( text ); |
385 | QString destDir = d->getDestinationPath(); | 383 | QString destDir = d->getDestinationPath(); |
386 | 384 | ||
387 | long blockSize = 0; | 385 | long blockSize = 0; |
388 | long totalBlocks = 0; | 386 | long totalBlocks = 0; |
389 | long availBlocks = 0; | 387 | long availBlocks = 0; |
390 | QString space; | 388 | QString space; |
391 | if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) | 389 | if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) |
392 | { | 390 | { |
393 | long mult = blockSize / 1024; | 391 | long mult = blockSize / 1024; |
394 | long div = 1024 / blockSize; | 392 | long div = 1024 / blockSize; |
395 | 393 | ||
396 | if ( !mult ) mult = 1; | 394 | if ( !mult ) mult = 1; |
397 | if ( !div ) div = 1; | 395 | if ( !div ) div = 1; |
398 | long avail = availBlocks * mult / div; | 396 | long avail = availBlocks * mult / div; |
399 | 397 | ||
400 | space = tr( "%1 Kb" ).arg( avail ); | 398 | space = tr( "%1 Kb" ).arg( avail ); |
401 | } | 399 | } |
402 | else | 400 | else |
403 | space = tr( "Unknown" ); | 401 | space = tr( "Unknown" ); |
404 | 402 | ||
405 | if ( txtAvailableSpace ) | 403 | if ( txtAvailableSpace ) |
406 | txtAvailableSpace->setText( space ); | 404 | txtAvailableSpace->setText( space ); |
407 | } | 405 | } |
408 | 406 | ||
409 | void InstallDlgImpl :: ipkgFinished() | 407 | void InstallDlgImpl :: ipkgFinished() |
410 | { | 408 | { |
411 | InstallData *item; | 409 | InstallData *item; |
412 | if ( firstPackage ) | 410 | if ( firstPackage ) |
413 | item = packages.first(); | 411 | item = packages.first(); |
414 | else | 412 | else |
415 | { | 413 | { |
416 | // Create symlinks if necessary before moving on to next package | 414 | // Create symlinks if necessary before moving on to next package |
417 | pIpkg->createSymLinks(); | 415 | pIpkg->createSymLinks(); |
418 | 416 | ||
419 | item = packages.next(); | 417 | item = packages.next(); |
420 | } | 418 | } |
421 | 419 | ||
422 | firstPackage = FALSE; | 420 | firstPackage = FALSE; |
423 | if ( item ) | 421 | if ( item ) |
424 | { | 422 | { |
425 | pIpkg->setPackage( item->packageName ); | 423 | pIpkg->setPackage( item->packageName ); |
426 | int tmpFlags = flags; | 424 | int tmpFlags = flags; |
427 | 425 | ||
428 | if ( item->option == "I" ) | 426 | if ( item->option == "I" ) |
429 | { | 427 | { |
430 | pIpkg->setOption( "install" ); | 428 | pIpkg->setOption( "install" ); |
431 | Destination *d = dataMgr->getDestination( destination->currentText() ); | 429 | Destination *d = dataMgr->getDestination( destination->currentText() ); |
432 | pIpkg->setDestination( d->getDestinationName() ); | 430 | pIpkg->setDestination( d->getDestinationName() ); |
433 | pIpkg->setDestinationDir( d->getDestinationPath() ); | 431 | pIpkg->setDestinationDir( d->getDestinationPath() ); |
434 | 432 | ||
435 | if ( d->linkToRoot() ) | 433 | if ( d->linkToRoot() ) |
436 | tmpFlags |= MAKE_LINKS; | 434 | tmpFlags |= MAKE_LINKS; |
437 | } | 435 | } |
438 | else if ( item->option == "D" ) | 436 | else if ( item->option == "D" ) |
439 | { | 437 | { |
440 | pIpkg->setOption( "remove" ); | 438 | pIpkg->setOption( "remove" ); |
441 | pIpkg->setDestination( item->destination->getDestinationName() ); | 439 | pIpkg->setDestination( item->destination->getDestinationName() ); |
442 | pIpkg->setDestinationDir( item->destination->getDestinationPath() ); | 440 | pIpkg->setDestinationDir( item->destination->getDestinationPath() ); |
443 | 441 | ||
444 | if ( item->destination->linkToRoot() ) | 442 | if ( item->destination->linkToRoot() ) |
445 | tmpFlags |= MAKE_LINKS; | 443 | tmpFlags |= MAKE_LINKS; |
446 | } | 444 | } |
447 | else | 445 | else |
448 | { | 446 | { |
449 | if ( item->option == "R" ) | 447 | if ( item->option == "R" ) |
450 | pIpkg->setOption( "reinstall" ); | 448 | pIpkg->setOption( "reinstall" ); |
451 | else | 449 | else |
452 | pIpkg->setOption( "upgrade" ); | 450 | pIpkg->setOption( "upgrade" ); |
453 | 451 | ||
454 | pIpkg->setDestination( item->destination->getDestinationName() ); | 452 | pIpkg->setDestination( item->destination->getDestinationName() ); |
455 | pIpkg->setDestinationDir( item->destination->getDestinationPath() ); | 453 | pIpkg->setDestinationDir( item->destination->getDestinationPath() ); |
456 | pIpkg->setPackage( item->packageName ); | 454 | pIpkg->setPackage( item->packageName ); |
457 | 455 | ||
458 | tmpFlags |= FORCE_REINSTALL; | 456 | tmpFlags |= FORCE_REINSTALL; |
459 | if ( item->destination->linkToRoot() && item->recreateLinks ) | 457 | if ( item->destination->linkToRoot() && item->recreateLinks ) |
460 | tmpFlags |= MAKE_LINKS; | 458 | tmpFlags |= MAKE_LINKS; |
461 | } | 459 | } |
462 | pIpkg->setFlags( tmpFlags, infoLevel ); | 460 | pIpkg->setFlags( tmpFlags, infoLevel ); |
463 | pIpkg->runIpkg(); | 461 | pIpkg->runIpkg(); |
464 | } | 462 | } |
465 | else | 463 | else |
466 | { | 464 | { |
467 | btnOptions->setEnabled( true ); | 465 | btnOptions->setEnabled( true ); |
468 | btnInstall->setText( tr( "Close" ) ); | 466 | btnInstall->setText( tr( "Close" ) ); |
469 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); | 467 | btnInstall->setIconSet( Opie::Core::OResource::loadPixmap( "enter", Opie::Core::OResource::SmallIcon ) ); |
470 | 468 | ||
471 | btnOptions->setText( tr( "Save output" ) ); | 469 | btnOptions->setText( tr( "Save output" ) ); |
472 | btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); | 470 | btnOptions->setIconSet( Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ) ); |
473 | 471 | ||
474 | if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) | 472 | if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) |
475 | displayAvailableSpace( destination->currentText() ); | 473 | displayAvailableSpace( destination->currentText() ); |
476 | } | 474 | } |
477 | } | 475 | } |
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 6b31cd1..e07d8a0 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -1,454 +1,465 @@ | |||
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) 2002 Andy Qua <andy.qua@blueyonder.co.uk> | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | .=l. Dan Williams <drw@handhelds.org> | 5 | .=l. Dan Williams <drw@handhelds.org> |
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 "categoryfilterimpl.h" | 30 | #include "categoryfilterimpl.h" |
31 | #include "datamgr.h" | 31 | #include "datamgr.h" |
32 | #include "global.h" | 32 | #include "global.h" |
33 | #include "inputdlg.h" | 33 | #include "inputdlg.h" |
34 | #include "ipkg.h" | 34 | #include "ipkg.h" |
35 | #include "installdlgimpl.h" | 35 | #include "installdlgimpl.h" |
36 | #include "letterpushbutton.h" | 36 | #include "letterpushbutton.h" |
37 | #include "mainwin.h" | 37 | #include "mainwin.h" |
38 | #include "packagewin.h" | 38 | #include "packagewin.h" |
39 | #include "settingsimpl.h" | 39 | #include "settingsimpl.h" |
40 | #include "utils.h" | 40 | #include "utils.h" |
41 | 41 | ||
42 | /* OPIE */ | 42 | /* OPIE */ |
43 | #include <opie2/oresource.h> | ||
44 | |||
43 | #include <qpe/qcopenvelope_qws.h> | 45 | #include <qpe/qcopenvelope_qws.h> |
44 | #include <qpe/qpeapplication.h> | 46 | #include <qpe/qpeapplication.h> |
45 | #include <qpe/config.h> | 47 | #include <qpe/config.h> |
46 | #include <qpe/resource.h> | ||
47 | 48 | ||
48 | /* QT */ | 49 | /* QT */ |
49 | #include <qmenubar.h> | 50 | #include <qmenubar.h> |
50 | #include <qtoolbar.h> | 51 | #include <qtoolbar.h> |
51 | #include <qaction.h> | 52 | #include <qaction.h> |
52 | #include <qcombobox.h> | 53 | #include <qcombobox.h> |
53 | #include <qfile.h> | 54 | #include <qfile.h> |
54 | #include <qlabel.h> | 55 | #include <qlabel.h> |
55 | #include <qlayout.h> | 56 | #include <qlayout.h> |
56 | #include <qlineedit.h> | 57 | #include <qlineedit.h> |
57 | #include <qlistview.h> | 58 | #include <qlistview.h> |
58 | #include <qmenubar.h> | 59 | #include <qmenubar.h> |
59 | #include <qmessagebox.h> | 60 | #include <qmessagebox.h> |
60 | #include <qpopupmenu.h> | 61 | #include <qpopupmenu.h> |
61 | #include <qprogressbar.h> | 62 | #include <qprogressbar.h> |
62 | #include <qtimer.h> | 63 | #include <qtimer.h> |
63 | #include <qwhatsthis.h> | 64 | #include <qwhatsthis.h> |
64 | #include <qwidgetstack.h> | 65 | #include <qwidgetstack.h> |
65 | 66 | ||
66 | /* STD */ | 67 | /* STD */ |
67 | #include <linux/limits.h> | 68 | #include <linux/limits.h> |
68 | #include <unistd.h> | 69 | #include <unistd.h> |
69 | 70 | ||
70 | extern int compareVersions( const char *v1, const char *v2 ); | 71 | extern int compareVersions( const char *v1, const char *v2 ); |
71 | 72 | ||
72 | MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl ) | 73 | MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl ) |
73 | :QMainWindow( parent, name, fl || WStyle_ContextHelp ) | 74 | :QMainWindow( parent, name, fl || WStyle_ContextHelp ) |
74 | { | 75 | { |
75 | // Disable suspend mode | 76 | // Disable suspend mode |
76 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; | 77 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; |
77 | 78 | ||
78 | LOCAL_SERVER = QObject::tr( "Installed packages" ); | 79 | LOCAL_SERVER = QObject::tr( "Installed packages" ); |
79 | LOCAL_IPKGS = QObject::tr( "Local packages" ); | 80 | LOCAL_IPKGS = QObject::tr( "Local packages" ); |
80 | 81 | ||
81 | setCaption( tr( "AQPkg - Package Manager" ) ); | 82 | setCaption( tr( "AQPkg - Package Manager" ) ); |
82 | 83 | ||
83 | // Create UI widgets | 84 | // Create UI widgets |
84 | initMainWidget(); | 85 | initMainWidget(); |
85 | initProgressWidget(); | 86 | initProgressWidget(); |
86 | 87 | ||
87 | // Build menu and tool bars | 88 | // Build menu and tool bars |
88 | setToolBarsMovable( FALSE ); | 89 | setToolBarsMovable( FALSE ); |
89 | 90 | ||
90 | QToolBar *bar = new QToolBar( this ); | 91 | QToolBar *bar = new QToolBar( this ); |
91 | bar->setHorizontalStretchable( TRUE ); | 92 | bar->setHorizontalStretchable( TRUE ); |
92 | QMenuBar *mb = new QMenuBar( bar ); | 93 | QMenuBar *mb = new QMenuBar( bar ); |
93 | mb->setMargin( 0 ); | 94 | mb->setMargin( 0 ); |
94 | bar = new QToolBar( this ); | 95 | bar = new QToolBar( this ); |
95 | 96 | ||
96 | // Find toolbar | 97 | // Find toolbar |
97 | findBar = new QToolBar( this ); | 98 | findBar = new QToolBar( this ); |
98 | addToolBar( findBar, QMainWindow::Top, true ); | 99 | addToolBar( findBar, QMainWindow::Top, true ); |
99 | findBar->setHorizontalStretchable( true ); | 100 | findBar->setHorizontalStretchable( true ); |
100 | findEdit = new QLineEdit( findBar ); | 101 | findEdit = new QLineEdit( findBar ); |
101 | QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); | 102 | QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); |
102 | findBar->setStretchableWidget( findEdit ); | 103 | findBar->setStretchableWidget( findEdit ); |
103 | connect( findEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( findPackage(const QString&) ) ); | 104 | connect( findEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( findPackage(const QString&) ) ); |
104 | 105 | ||
105 | // Quick jump toolbar | 106 | // Quick jump toolbar |
106 | jumpBar = new QToolBar( this ); | 107 | jumpBar = new QToolBar( this ); |
107 | addToolBar( jumpBar, QMainWindow::Top, true ); | 108 | addToolBar( jumpBar, QMainWindow::Top, true ); |
108 | jumpBar->setHorizontalStretchable( true ); | 109 | jumpBar->setHorizontalStretchable( true ); |
109 | QWidget *w = new QWidget( jumpBar ); | 110 | QWidget *w = new QWidget( jumpBar ); |
110 | jumpBar->setStretchableWidget( w ); | 111 | jumpBar->setStretchableWidget( w ); |
111 | 112 | ||
112 | QGridLayout *layout = new QGridLayout( w ); | 113 | QGridLayout *layout = new QGridLayout( w ); |
113 | 114 | ||
114 | char text[2]; | 115 | char text[2]; |
115 | text[1] = '\0'; | 116 | text[1] = '\0'; |
116 | for ( int i = 0 ; i < 26 ; ++i ) | 117 | for ( int i = 0 ; i < 26 ; ++i ) |
117 | { | 118 | { |
118 | text[0] = 'A' + i; | 119 | text[0] = 'A' + i; |
119 | LetterPushButton *b = new LetterPushButton( text, w ); | 120 | LetterPushButton *b = new LetterPushButton( text, w ); |
120 | connect( b, SIGNAL( released(QString) ), this, SLOT( letterPushed(QString) ) ); | 121 | connect( b, SIGNAL( released(QString) ), this, SLOT( letterPushed(QString) ) ); |
121 | layout->addWidget( b, i / 13, i % 13); | 122 | layout->addWidget( b, i / 13, i % 13); |
122 | } | 123 | } |
123 | 124 | ||
124 | QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); | 125 | QAction *a = new QAction( QString::null, Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ), |
126 | QString::null, 0, w, 0 ); | ||
125 | a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); | 127 | a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); |
126 | connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); | 128 | connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); |
127 | a->addTo( jumpBar ); | 129 | a->addTo( jumpBar ); |
128 | jumpBar->hide(); | 130 | jumpBar->hide(); |
129 | 131 | ||
130 | // Packages menu | 132 | // Packages menu |
131 | QPopupMenu *popup = new QPopupMenu( this ); | 133 | QPopupMenu *popup = new QPopupMenu( this ); |
132 | 134 | ||
133 | a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); | 135 | a = new QAction( tr( "Update lists" ), Opie::Core::OResource::loadPixmap( "aqpkg/update", Opie::Core::OResource::SmallIcon ), |
136 | QString::null, 0, this, 0 ); | ||
134 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); | 137 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); |
135 | connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); | 138 | connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); |
136 | a->addTo( popup ); | 139 | a->addTo( popup ); |
137 | a->addTo( bar ); | 140 | a->addTo( bar ); |
138 | 141 | ||
139 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); | 142 | actionUpgrade = new QAction( tr( "Upgrade" ), Opie::Core::OResource::loadPixmap( "aqpkg/upgrade", Opie::Core::OResource::SmallIcon ), |
143 | QString::null, 0, this, 0 ); | ||
140 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); | 144 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); |
141 | connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); | 145 | connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); |
142 | actionUpgrade->addTo( popup ); | 146 | actionUpgrade->addTo( popup ); |
143 | actionUpgrade->addTo( bar ); | 147 | actionUpgrade->addTo( bar ); |
144 | 148 | ||
145 | iconDownload = Resource::loadPixmap( "aqpkg/download" ); | 149 | iconDownload = Opie::Core::OResource::loadPixmap( "aqpkg/download", Opie::Core::OResource::SmallIcon ); |
146 | iconRemove = Resource::loadPixmap( "aqpkg/remove" ); | 150 | iconRemove = Opie::Core::OResource::loadPixmap( "aqpkg/remove", Opie::Core::OResource::SmallIcon ); |
147 | actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); | 151 | actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); |
148 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); | 152 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); |
149 | connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); | 153 | connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); |
150 | actionDownload->addTo( popup ); | 154 | actionDownload->addTo( popup ); |
151 | actionDownload->addTo( bar ); | 155 | actionDownload->addTo( bar ); |
152 | 156 | ||
153 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); | 157 | a = new QAction( tr( "Apply changes" ), Opie::Core::OResource::loadPixmap( "aqpkg/apply", Opie::Core::OResource::SmallIcon ), |
158 | QString::null, 0, this, 0 ); | ||
154 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); | 159 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); |
155 | connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); | 160 | connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); |
156 | a->addTo( popup ); | 161 | a->addTo( popup ); |
157 | a->addTo( bar ); | 162 | a->addTo( bar ); |
158 | 163 | ||
159 | popup->insertSeparator(); | 164 | popup->insertSeparator(); |
160 | 165 | ||
161 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); | 166 | a = new QAction( tr( "Configure" ), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), |
167 | QString::null, 0, this, 0 ); | ||
162 | a->setWhatsThis( tr( "Click here to configure this application." ) ); | 168 | a->setWhatsThis( tr( "Click here to configure this application." ) ); |
163 | connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); | 169 | connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); |
164 | a->addTo( popup ); | 170 | a->addTo( popup ); |
165 | mb->insertItem( tr( "Actions" ), popup ); | 171 | mb->insertItem( tr( "Actions" ), popup ); |
166 | 172 | ||
167 | // View menu | 173 | // View menu |
168 | popup = new QPopupMenu( this ); | 174 | popup = new QPopupMenu( this ); |
169 | 175 | ||
170 | actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); | 176 | actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); |
171 | actionUninstalled->setToggleAction( TRUE ); | 177 | actionUninstalled->setToggleAction( TRUE ); |
172 | actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); | 178 | actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); |
173 | connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); | 179 | connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); |
174 | actionUninstalled->addTo( popup ); | 180 | actionUninstalled->addTo( popup ); |
175 | 181 | ||
176 | actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); | 182 | actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); |
177 | actionInstalled->setToggleAction( TRUE ); | 183 | actionInstalled->setToggleAction( TRUE ); |
178 | actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); | 184 | actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); |
179 | connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); | 185 | connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); |
180 | actionInstalled->addTo( popup ); | 186 | actionInstalled->addTo( popup ); |
181 | 187 | ||
182 | actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); | 188 | actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); |
183 | actionUpdated->setToggleAction( TRUE ); | 189 | actionUpdated->setToggleAction( TRUE ); |
184 | actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); | 190 | actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); |
185 | connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); | 191 | connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); |
186 | actionUpdated->addTo( popup ); | 192 | actionUpdated->addTo( popup ); |
187 | 193 | ||
188 | popup->insertSeparator(); | 194 | popup->insertSeparator(); |
189 | 195 | ||
190 | actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); | 196 | actionFilter = new QAction( tr( "Filter by category" ), Opie::Core::OResource::loadPixmap( "aqpkg/filter", |
197 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); | ||
191 | actionFilter->setToggleAction( TRUE ); | 198 | actionFilter->setToggleAction( TRUE ); |
192 | actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); | 199 | actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); |
193 | connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); | 200 | connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); |
194 | actionFilter->addTo( popup ); | 201 | actionFilter->addTo( popup ); |
195 | 202 | ||
196 | a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); | 203 | a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); |
197 | a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); | 204 | a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); |
198 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); | 205 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); |
199 | a->addTo( popup ); | 206 | a->addTo( popup ); |
200 | 207 | ||
201 | popup->insertSeparator(); | 208 | popup->insertSeparator(); |
202 | 209 | ||
203 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 210 | a = new QAction( tr( "Find" ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), |
211 | QString::null, 0, this, 0 ); | ||
204 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); | 212 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); |
205 | connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); | 213 | connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); |
206 | a->addTo( popup ); | 214 | a->addTo( popup ); |
207 | 215 | ||
208 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); | 216 | actionFindNext = new QAction( tr( "Find next" ), Opie::Core::OResource::loadPixmap( "next", Opie::Core::OResource::SmallIcon ), |
217 | QString::null, 0, this, 0 ); | ||
209 | actionFindNext->setEnabled( FALSE ); | 218 | actionFindNext->setEnabled( FALSE ); |
210 | actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); | 219 | actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); |
211 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); | 220 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); |
212 | actionFindNext->addTo( popup ); | 221 | actionFindNext->addTo( popup ); |
213 | actionFindNext->addTo( findBar ); | 222 | actionFindNext->addTo( findBar ); |
214 | 223 | ||
215 | 224 | ||
216 | popup->insertSeparator(); | 225 | popup->insertSeparator(); |
217 | 226 | ||
218 | a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); | 227 | a = new QAction( tr( "Quick Jump keypad" ), Opie::Core::OResource::loadPixmap( "aqpkg/keyboard", Opie::Core::OResource::SmallIcon ), |
228 | QString::null, 0, this, 0 ); | ||
219 | a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); | 229 | a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); |
220 | connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); | 230 | connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); |
221 | a->addTo( popup ); | 231 | a->addTo( popup ); |
222 | 232 | ||
223 | mb->insertItem( tr( "View" ), popup ); | 233 | mb->insertItem( tr( "View" ), popup ); |
224 | 234 | ||
225 | // Finish find toolbar creation | 235 | // Finish find toolbar creation |
226 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 236 | a = new QAction( QString::null, Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ), |
237 | QString::null, 0, this, 0 ); | ||
227 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); | 238 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); |
228 | connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); | 239 | connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); |
229 | a->addTo( findBar ); | 240 | a->addTo( findBar ); |
230 | findBar->hide(); | 241 | findBar->hide(); |
231 | 242 | ||
232 | // Create widget stack and add UI widgets | 243 | // Create widget stack and add UI widgets |
233 | stack = new QWidgetStack( this ); | 244 | stack = new QWidgetStack( this ); |
234 | stack->addWidget( progressWindow, 2 ); | 245 | stack->addWidget( progressWindow, 2 ); |
235 | stack->addWidget( networkPkgWindow, 1 ); | 246 | stack->addWidget( networkPkgWindow, 1 ); |
236 | setCentralWidget( stack ); | 247 | setCentralWidget( stack ); |
237 | stack->raiseWidget( progressWindow ); | 248 | stack->raiseWidget( progressWindow ); |
238 | 249 | ||
239 | // Delayed call to finish initialization | 250 | // Delayed call to finish initialization |
240 | QTimer::singleShot( 100, this, SLOT( init() ) ); | 251 | QTimer::singleShot( 100, this, SLOT( init() ) ); |
241 | } | 252 | } |
242 | 253 | ||
243 | MainWindow :: ~MainWindow() | 254 | MainWindow :: ~MainWindow() |
244 | { | 255 | { |
245 | delete mgr; | 256 | delete mgr; |
246 | 257 | ||
247 | // Reenable suspend mode | 258 | // Reenable suspend mode |
248 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 259 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
249 | } | 260 | } |
250 | 261 | ||
251 | void MainWindow :: initMainWidget() | 262 | void MainWindow :: initMainWidget() |
252 | { | 263 | { |
253 | networkPkgWindow = new QWidget( this ); | 264 | networkPkgWindow = new QWidget( this ); |
254 | 265 | ||
255 | QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); | 266 | QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); |
256 | 267 | ||
257 | serversList = new QComboBox( networkPkgWindow ); | 268 | serversList = new QComboBox( networkPkgWindow ); |
258 | connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) ); | 269 | connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) ); |
259 | QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); | 270 | QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); |
260 | 271 | ||
261 | installedIcon = Resource::loadPixmap( "installed" ); | 272 | installedIcon = Opie::Core::OResource::loadPixmap( "installed" ); |
262 | updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); | 273 | updatedIcon = Opie::Core::OResource::loadPixmap( "aqpkg/updated" ); |
263 | 274 | ||
264 | packagesList = new QListView( networkPkgWindow ); | 275 | packagesList = new QListView( networkPkgWindow ); |
265 | packagesList->addColumn( tr( "Packages" ), 225 ); | 276 | packagesList->addColumn( tr( "Packages" ), 225 ); |
266 | QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); | 277 | QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); |
267 | QPEApplication::setStylusOperation( packagesList->viewport(), QPEApplication::RightOnHold ); | 278 | QPEApplication::setStylusOperation( packagesList->viewport(), QPEApplication::RightOnHold ); |
268 | connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), | 279 | connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), |
269 | this, SLOT(slotDisplayPackage(QListViewItem*)) ); | 280 | this, SLOT(slotDisplayPackage(QListViewItem*)) ); |
270 | 281 | ||
271 | QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); | 282 | QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); |
272 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); | 283 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); |
273 | hbox1->addWidget( l ); | 284 | hbox1->addWidget( l ); |
274 | hbox1->addWidget( serversList ); | 285 | hbox1->addWidget( serversList ); |
275 | 286 | ||
276 | vbox->addWidget( packagesList ); | 287 | vbox->addWidget( packagesList ); |
277 | 288 | ||
278 | downloadEnabled = TRUE; | 289 | downloadEnabled = TRUE; |
279 | } | 290 | } |
280 | 291 | ||
281 | void MainWindow :: initProgressWidget() | 292 | void MainWindow :: initProgressWidget() |
282 | { | 293 | { |
283 | progressWindow = new QWidget( this ); | 294 | progressWindow = new QWidget( this ); |
284 | 295 | ||
285 | QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); | 296 | QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); |
286 | 297 | ||
287 | m_status = new QLabel( progressWindow ); | 298 | m_status = new QLabel( progressWindow ); |
288 | m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); | 299 | m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); |
289 | layout->addWidget( m_status ); | 300 | layout->addWidget( m_status ); |
290 | 301 | ||
291 | m_progress = new QProgressBar( progressWindow ); | 302 | m_progress = new QProgressBar( progressWindow ); |
292 | layout->addWidget( m_progress ); | 303 | layout->addWidget( m_progress ); |
293 | } | 304 | } |
294 | 305 | ||
295 | void MainWindow :: init() | 306 | void MainWindow :: init() |
296 | { | 307 | { |
297 | #ifdef QWS | 308 | #ifdef QWS |
298 | // read download directory from config file | 309 | // read download directory from config file |
299 | Config cfg( "aqpkg" ); | 310 | Config cfg( "aqpkg" ); |
300 | cfg.setGroup( "settings" ); | 311 | cfg.setGroup( "settings" ); |
301 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); | 312 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); |
302 | // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); | 313 | // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); |
303 | 314 | ||
304 | #endif | 315 | #endif |
305 | 316 | ||
306 | stack->raiseWidget( progressWindow ); | 317 | stack->raiseWidget( progressWindow ); |
307 | 318 | ||
308 | mgr = new DataManager(); | 319 | mgr = new DataManager(); |
309 | connect( mgr, SIGNAL( progressSetSteps(int) ), this, SLOT( setProgressSteps(int) ) ); | 320 | connect( mgr, SIGNAL( progressSetSteps(int) ), this, SLOT( setProgressSteps(int) ) ); |
310 | connect( mgr, SIGNAL( progressSetMessage(const QString&) ), | 321 | connect( mgr, SIGNAL( progressSetMessage(const QString&) ), |
311 | this, SLOT( setProgressMessage(const QString&) ) ); | 322 | this, SLOT( setProgressMessage(const QString&) ) ); |
312 | connect( mgr, SIGNAL( progressUpdate(int) ), this, SLOT( updateProgress(int) ) ); | 323 | connect( mgr, SIGNAL( progressUpdate(int) ), this, SLOT( updateProgress(int) ) ); |
313 | mgr->loadServers(); | 324 | mgr->loadServers(); |
314 | 325 | ||
315 | showUninstalledPkgs = false; | 326 | showUninstalledPkgs = false; |
316 | showInstalledPkgs = false; | 327 | showInstalledPkgs = false; |
317 | showUpgradedPkgs = false; | 328 | showUpgradedPkgs = false; |
318 | categoryFilterEnabled = false; | 329 | categoryFilterEnabled = false; |
319 | 330 | ||
320 | updateData(); | 331 | updateData(); |
321 | 332 | ||
322 | stack->raiseWidget( networkPkgWindow ); | 333 | stack->raiseWidget( networkPkgWindow ); |
323 | } | 334 | } |
324 | 335 | ||
325 | void MainWindow :: setDocument( const QString &doc ) | 336 | void MainWindow :: setDocument( const QString &doc ) |
326 | { | 337 | { |
327 | // Remove path from package | 338 | // Remove path from package |
328 | QString package = Utils::getPackageNameFromIpkFilename( doc ); | 339 | QString package = Utils::getPackageNameFromIpkFilename( doc ); |
329 | 340 | ||
330 | // First select local server | 341 | // First select local server |
331 | for ( int i = 0 ; i < serversList->count() ; ++i ) | 342 | for ( int i = 0 ; i < serversList->count() ; ++i ) |
332 | { | 343 | { |
333 | if ( serversList->text( i ) == LOCAL_IPKGS ) | 344 | if ( serversList->text( i ) == LOCAL_IPKGS ) |
334 | { | 345 | { |
335 | serversList->setCurrentItem( i ); | 346 | serversList->setCurrentItem( i ); |
336 | break; | 347 | break; |
337 | } | 348 | } |
338 | } | 349 | } |
339 | serverSelected( 0 ); | 350 | serverSelected( 0 ); |
340 | 351 | ||
341 | // Now set the check box of the selected package | 352 | // Now set the check box of the selected package |
342 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 353 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
343 | item != 0 ; | 354 | item != 0 ; |
344 | item = (QCheckListItem *)item->nextSibling() ) | 355 | item = (QCheckListItem *)item->nextSibling() ) |
345 | { | 356 | { |
346 | if ( item->text().startsWith( package ) ) | 357 | if ( item->text().startsWith( package ) ) |
347 | { | 358 | { |
348 | item->setOn( true ); | 359 | item->setOn( true ); |
349 | break; | 360 | break; |
350 | } | 361 | } |
351 | } | 362 | } |
352 | } | 363 | } |
353 | 364 | ||
354 | void MainWindow :: displaySettings() | 365 | void MainWindow :: displaySettings() |
355 | { | 366 | { |
356 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); | 367 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); |
357 | if ( dlg->showDlg() ) | 368 | if ( dlg->showDlg() ) |
358 | { | 369 | { |
359 | stack->raiseWidget( progressWindow ); | 370 | stack->raiseWidget( progressWindow ); |
360 | updateData(); | 371 | updateData(); |
361 | stack->raiseWidget( networkPkgWindow ); | 372 | stack->raiseWidget( networkPkgWindow ); |
362 | } | 373 | } |
363 | delete dlg; | 374 | delete dlg; |
364 | } | 375 | } |
365 | 376 | ||
366 | void MainWindow :: closeEvent( QCloseEvent *e ) | 377 | void MainWindow :: closeEvent( QCloseEvent *e ) |
367 | { | 378 | { |
368 | // If install dialog is visible, return to main view, otherwise close app | 379 | // If install dialog is visible, return to main view, otherwise close app |
369 | QWidget *widget = stack->visibleWidget(); | 380 | QWidget *widget = stack->visibleWidget(); |
370 | 381 | ||
371 | if ( widget != networkPkgWindow && widget != progressWindow ) | 382 | if ( widget != networkPkgWindow && widget != progressWindow ) |
372 | { | 383 | { |
373 | if ( widget ) delete widget; | 384 | if ( widget ) delete widget; |
374 | stack->raiseWidget( networkPkgWindow ); | 385 | stack->raiseWidget( networkPkgWindow ); |
375 | e->ignore(); | 386 | e->ignore(); |
376 | } | 387 | } |
377 | else | 388 | else |
378 | { | 389 | { |
379 | e->accept(); | 390 | e->accept(); |
380 | } | 391 | } |
381 | } | 392 | } |
382 | 393 | ||
383 | void MainWindow :: displayFindBar() | 394 | void MainWindow :: displayFindBar() |
384 | { | 395 | { |
385 | findBar->show(); | 396 | findBar->show(); |
386 | findEdit->setFocus(); | 397 | findEdit->setFocus(); |
387 | } | 398 | } |
388 | 399 | ||
389 | void MainWindow :: displayJumpBar() | 400 | void MainWindow :: displayJumpBar() |
390 | { | 401 | { |
391 | jumpBar->show(); | 402 | jumpBar->show(); |
392 | } | 403 | } |
393 | 404 | ||
394 | void MainWindow :: repeatFind() | 405 | void MainWindow :: repeatFind() |
395 | { | 406 | { |
396 | searchForPackage( findEdit->text() ); | 407 | searchForPackage( findEdit->text() ); |
397 | } | 408 | } |
398 | 409 | ||
399 | void MainWindow :: findPackage( const QString &text ) | 410 | void MainWindow :: findPackage( const QString &text ) |
400 | { | 411 | { |
401 | actionFindNext->setEnabled( !text.isEmpty() ); | 412 | actionFindNext->setEnabled( !text.isEmpty() ); |
402 | searchForPackage( text ); | 413 | searchForPackage( text ); |
403 | } | 414 | } |
404 | 415 | ||
405 | void MainWindow :: hideFindBar() | 416 | void MainWindow :: hideFindBar() |
406 | { | 417 | { |
407 | findBar->hide(); | 418 | findBar->hide(); |
408 | } | 419 | } |
409 | 420 | ||
410 | void MainWindow :: hideJumpBar() | 421 | void MainWindow :: hideJumpBar() |
411 | { | 422 | { |
412 | jumpBar->hide(); | 423 | jumpBar->hide(); |
413 | } | 424 | } |
414 | 425 | ||
415 | void MainWindow :: filterUninstalledPackages() | 426 | void MainWindow :: filterUninstalledPackages() |
416 | { | 427 | { |
417 | showUninstalledPkgs = actionUninstalled->isOn(); | 428 | showUninstalledPkgs = actionUninstalled->isOn(); |
418 | if ( showUninstalledPkgs ) | 429 | if ( showUninstalledPkgs ) |
419 | { | 430 | { |
420 | showInstalledPkgs = FALSE; | 431 | showInstalledPkgs = FALSE; |
421 | showUpgradedPkgs = FALSE; | 432 | showUpgradedPkgs = FALSE; |
422 | } | 433 | } |
423 | serverSelected( -1 ); | 434 | serverSelected( -1 ); |
424 | 435 | ||
425 | actionInstalled->setOn( FALSE ); | 436 | actionInstalled->setOn( FALSE ); |
426 | actionUpdated->setOn( FALSE ); | 437 | actionUpdated->setOn( FALSE ); |
427 | } | 438 | } |
428 | 439 | ||
429 | void MainWindow :: filterInstalledPackages() | 440 | void MainWindow :: filterInstalledPackages() |
430 | { | 441 | { |
431 | showInstalledPkgs = actionInstalled->isOn(); | 442 | showInstalledPkgs = actionInstalled->isOn(); |
432 | if ( showInstalledPkgs ) | 443 | if ( showInstalledPkgs ) |
433 | { | 444 | { |
434 | showUninstalledPkgs = FALSE; | 445 | showUninstalledPkgs = FALSE; |
435 | showUpgradedPkgs = FALSE; | 446 | showUpgradedPkgs = FALSE; |
436 | } | 447 | } |
437 | serverSelected( -1 ); | 448 | serverSelected( -1 ); |
438 | 449 | ||
439 | actionUninstalled->setOn( FALSE ); | 450 | actionUninstalled->setOn( FALSE ); |
440 | actionUpdated->setOn( FALSE ); | 451 | actionUpdated->setOn( FALSE ); |
441 | } | 452 | } |
442 | 453 | ||
443 | void MainWindow :: filterUpgradedPackages() | 454 | void MainWindow :: filterUpgradedPackages() |
444 | { | 455 | { |
445 | showUpgradedPkgs = actionUpdated->isOn(); | 456 | showUpgradedPkgs = actionUpdated->isOn(); |
446 | if ( showUpgradedPkgs ) | 457 | if ( showUpgradedPkgs ) |
447 | { | 458 | { |
448 | showUninstalledPkgs = FALSE; | 459 | showUninstalledPkgs = FALSE; |
449 | showInstalledPkgs = FALSE; | 460 | showInstalledPkgs = FALSE; |
450 | } | 461 | } |
451 | serverSelected( -1 ); | 462 | serverSelected( -1 ); |
452 | 463 | ||
453 | actionUninstalled->setOn( FALSE ); | 464 | actionUninstalled->setOn( FALSE ); |
454 | actionInstalled->setOn( FALSE ); | 465 | actionInstalled->setOn( FALSE ); |
diff --git a/noncore/settings/aqpkg/packagewin.cpp b/noncore/settings/aqpkg/packagewin.cpp index 499d647..5f0ae20 100644 --- a/noncore/settings/aqpkg/packagewin.cpp +++ b/noncore/settings/aqpkg/packagewin.cpp | |||
@@ -1,119 +1,119 @@ | |||
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) 2002 Andy Qua <andy.qua@blueyonder.co.uk> | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | .=l. Dan Williams <drw@handhelds.org> | 5 | .=l. Dan Williams <drw@handhelds.org> |
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 "packagewin.h" | 30 | #include "packagewin.h" |
31 | #include "package.h" | 31 | #include "package.h" |
32 | #include "datamgr.h" | 32 | #include "datamgr.h" |
33 | 33 | ||
34 | #include <qpe/resource.h> | 34 | #include <opie2/oresource.h> |
35 | 35 | ||
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
38 | #include <qstring.h> | 38 | #include <qstring.h> |
39 | #include <qtextview.h> | 39 | #include <qtextview.h> |
40 | 40 | ||
41 | PackageWindow::PackageWindow( Package *package, const QString &server ) | 41 | PackageWindow::PackageWindow( Package *package, const QString &server ) |
42 | : QWidget( 0, 0, 0 ) | 42 | : QWidget( 0, 0, 0 ) |
43 | { | 43 | { |
44 | QString str; | 44 | QString str; |
45 | if ( package ) | 45 | if ( package ) |
46 | { | 46 | { |
47 | Package *local = package->getLocalPackage(); | 47 | Package *local = package->getLocalPackage(); |
48 | setCaption( package->getPackageName() ); | 48 | setCaption( package->getPackageName() ); |
49 | QString destName; | 49 | QString destName; |
50 | if ( local ) | 50 | if ( local ) |
51 | { | 51 | { |
52 | if ( local->getInstalledTo() ) | 52 | if ( local->getInstalledTo() ) |
53 | destName = package->getLocalPackage()->getInstalledTo()->getDestinationName(); | 53 | destName = package->getLocalPackage()->getInstalledTo()->getDestinationName(); |
54 | } | 54 | } |
55 | else | 55 | else |
56 | { | 56 | { |
57 | if ( package->getInstalledTo() ) | 57 | if ( package->getInstalledTo() ) |
58 | destName = package->getInstalledTo()->getDestinationName(); | 58 | destName = package->getInstalledTo()->getDestinationName(); |
59 | } | 59 | } |
60 | 60 | ||
61 | if ( !package->isPackageStoredLocally() ) | 61 | if ( !package->isPackageStoredLocally() ) |
62 | { | 62 | { |
63 | str.append( tr( "<b>Description</b> - " ) ); | 63 | str.append( tr( "<b>Description</b> - " ) ); |
64 | str.append( package->getDescription() ); | 64 | str.append( package->getDescription() ); |
65 | if ( !destName.isNull() ) | 65 | if ( !destName.isNull() ) |
66 | { | 66 | { |
67 | str.append( tr( "<p><b>Installed To</b> - " ) ); | 67 | str.append( tr( "<p><b>Installed To</b> - " ) ); |
68 | str.append( destName ); | 68 | str.append( destName ); |
69 | } | 69 | } |
70 | str.append( tr( "<p><b>Size</b> - " ) ); | 70 | str.append( tr( "<p><b>Size</b> - " ) ); |
71 | str.append( package->getPackageSize() ); | 71 | str.append( package->getPackageSize() ); |
72 | str.append( tr( "<p><b>Section</b> - " ) ); | 72 | str.append( tr( "<p><b>Section</b> - " ) ); |
73 | str.append( package->getSection() ); | 73 | str.append( package->getSection() ); |
74 | } | 74 | } |
75 | else | 75 | else |
76 | { | 76 | { |
77 | str.append( tr( "<p><b>Filename</b> - " ) ); | 77 | str.append( tr( "<p><b>Filename</b> - " ) ); |
78 | str.append( package->getFilename() ); | 78 | str.append( package->getFilename() ); |
79 | } | 79 | } |
80 | 80 | ||
81 | if ( server == LOCAL_SERVER ) | 81 | if ( server == LOCAL_SERVER ) |
82 | { | 82 | { |
83 | str.append( tr( "<p><b>Version Installed</b> - " ) ); | 83 | str.append( tr( "<p><b>Version Installed</b> - " ) ); |
84 | str.append( package->getVersion() ); | 84 | str.append( package->getVersion() ); |
85 | } | 85 | } |
86 | else | 86 | else |
87 | { | 87 | { |
88 | str.append( tr( "<p><b>Version Available</b> - " ) ); | 88 | str.append( tr( "<p><b>Version Available</b> - " ) ); |
89 | str.append( package->getVersion() ); | 89 | str.append( package->getVersion() ); |
90 | if ( local ) | 90 | if ( local ) |
91 | { | 91 | { |
92 | if ( package->isInstalled() ) | 92 | if ( package->isInstalled() ) |
93 | { | 93 | { |
94 | str.append( tr( "<p><b>Version Installed</b> - " ) ); | 94 | str.append( tr( "<p><b>Version Installed</b> - " ) ); |
95 | str.append( package->getInstalledVersion() ); | 95 | str.append( package->getInstalledVersion() ); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | } | 98 | } |
99 | } | 99 | } |
100 | else | 100 | else |
101 | { | 101 | { |
102 | setCaption( tr( "Package Information" ) ); | 102 | setCaption( tr( "Package Information" ) ); |
103 | str = tr( "Package information is unavailable" ); | 103 | str = tr( "Package information is unavailable" ); |
104 | } | 104 | } |
105 | 105 | ||
106 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 4 ); | 106 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 4 ); |
107 | 107 | ||
108 | QTextView *l = new QTextView( str, QString::null, this ); | 108 | QTextView *l = new QTextView( str, QString::null, this ); |
109 | layout->addWidget( l ); | 109 | layout->addWidget( l ); |
110 | 110 | ||
111 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "enter" ), tr( "Close" ), this ); | 111 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "enter", Opie::Core::OResource::SmallIcon ), tr( "Close" ), this ); |
112 | layout->addWidget( btn ); | 112 | layout->addWidget( btn ); |
113 | connect( btn, SIGNAL( clicked() ), this, SLOT( close() ) ); | 113 | connect( btn, SIGNAL( clicked() ), this, SLOT( close() ) ); |
114 | 114 | ||
115 | } | 115 | } |
116 | 116 | ||
117 | PackageWindow::~PackageWindow() | 117 | PackageWindow::~PackageWindow() |
118 | { | 118 | { |
119 | } | 119 | } |
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp index 9c8ec7a..7ffa1d6 100644 --- a/noncore/settings/aqpkg/settingsimpl.cpp +++ b/noncore/settings/aqpkg/settingsimpl.cpp | |||
@@ -1,447 +1,446 @@ | |||
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) 2002 Andy Qua <andy.qua@blueyonder.co.uk> | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | .=l. Dan Williams <drw@handhelds.org> | 5 | .=l. Dan Williams <drw@handhelds.org> |
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 "settingsimpl.h" | 30 | #include "settingsimpl.h" |
31 | #include "global.h" | 31 | #include "global.h" |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/otabwidget.h> | 34 | #include <opie2/otabwidget.h> |
35 | #ifdef QWS | 35 | #include <opie2/oresource.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/resource.h> | ||
38 | #endif | ||
39 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
40 | 38 | ||
41 | /* QT */ | 39 | /* QT */ |
42 | #include <qcheckbox.h> | 40 | #include <qcheckbox.h> |
43 | #include <qgroupbox.h> | 41 | #include <qgroupbox.h> |
44 | #include <qlabel.h> | 42 | #include <qlabel.h> |
45 | #include <qlayout.h> | 43 | #include <qlayout.h> |
46 | #include <qlineedit.h> | 44 | #include <qlineedit.h> |
47 | #include <qlistbox.h> | 45 | #include <qlistbox.h> |
48 | #include <qpushbutton.h> | 46 | #include <qpushbutton.h> |
49 | 47 | ||
50 | using namespace Opie::Ui; | 48 | using namespace Opie::Ui; |
51 | using namespace Opie::Ui; | 49 | using namespace Opie::Ui; |
52 | SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) | 50 | SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) |
53 | : QDialog( parent, name, modal, fl ) | 51 | : QDialog( parent, name, modal, fl ) |
54 | { | 52 | { |
55 | setCaption( tr( "Configuration" ) ); | 53 | setCaption( tr( "Configuration" ) ); |
56 | 54 | ||
57 | // Setup layout to make everything pretty | 55 | // Setup layout to make everything pretty |
58 | QVBoxLayout *layout = new QVBoxLayout( this ); | 56 | QVBoxLayout *layout = new QVBoxLayout( this ); |
59 | layout->setMargin( 2 ); | 57 | layout->setMargin( 2 ); |
60 | layout->setSpacing( 4 ); | 58 | layout->setSpacing( 4 ); |
61 | 59 | ||
62 | // Setup tabs for all info | 60 | // Setup tabs for all info |
63 | OTabWidget *tabwidget = new OTabWidget( this ); | 61 | OTabWidget *tabwidget = new OTabWidget( this ); |
64 | layout->addWidget( tabwidget ); | 62 | layout->addWidget( tabwidget ); |
65 | 63 | ||
66 | tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) ); | 64 | tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) ); |
67 | tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); | 65 | tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); |
68 | tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); | 66 | tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); |
69 | tabwidget->setCurrentTab( tr( "Servers" ) ); | 67 | tabwidget->setCurrentTab( tr( "Servers" ) ); |
70 | 68 | ||
71 | dataMgr = dataManager; | 69 | dataMgr = dataManager; |
72 | setupData(); | 70 | setupData(); |
73 | changed = false; | 71 | changed = false; |
74 | newserver = false; | 72 | newserver = false; |
75 | newdestination = false; | 73 | newdestination = false; |
76 | } | 74 | } |
77 | 75 | ||
78 | SettingsImpl :: ~SettingsImpl() | 76 | SettingsImpl :: ~SettingsImpl() |
79 | { | 77 | { |
80 | } | 78 | } |
81 | 79 | ||
82 | bool SettingsImpl :: showDlg() | 80 | bool SettingsImpl :: showDlg() |
83 | { | 81 | { |
84 | QPEApplication::execDialog( this ); | 82 | QPEApplication::execDialog( this ); |
85 | if ( changed ) | 83 | if ( changed ) |
86 | dataMgr->writeOutIpkgConf(); | 84 | dataMgr->writeOutIpkgConf(); |
87 | 85 | ||
88 | return changed; | 86 | return changed; |
89 | } | 87 | } |
90 | 88 | ||
91 | QWidget *SettingsImpl :: initServerTab() | 89 | QWidget *SettingsImpl :: initServerTab() |
92 | { | 90 | { |
93 | QWidget *control = new QWidget( this ); | 91 | QWidget *control = new QWidget( this ); |
94 | 92 | ||
95 | QVBoxLayout *vb = new QVBoxLayout( control ); | 93 | QVBoxLayout *vb = new QVBoxLayout( control ); |
96 | 94 | ||
97 | QScrollView *sv = new QScrollView( control ); | 95 | QScrollView *sv = new QScrollView( control ); |
98 | vb->addWidget( sv, 0, 0 ); | 96 | vb->addWidget( sv, 0, 0 ); |
99 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 97 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
100 | sv->setFrameStyle( QFrame::NoFrame ); | 98 | sv->setFrameStyle( QFrame::NoFrame ); |
101 | 99 | ||
102 | QWidget *container = new QWidget( sv->viewport() ); | 100 | QWidget *container = new QWidget( sv->viewport() ); |
103 | sv->addChild( container ); | 101 | sv->addChild( container ); |
104 | 102 | ||
105 | QGridLayout *layout = new QGridLayout( container ); | 103 | QGridLayout *layout = new QGridLayout( container ); |
106 | layout->setSpacing( 2 ); | 104 | layout->setSpacing( 2 ); |
107 | layout->setMargin( 4 ); | 105 | layout->setMargin( 4 ); |
108 | 106 | ||
109 | servers = new QListBox( container ); | 107 | servers = new QListBox( container ); |
110 | servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 108 | servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
111 | connect( servers, SIGNAL( highlighted(int) ), this, SLOT( editServer(int) ) ); | 109 | connect( servers, SIGNAL( highlighted(int) ), this, SLOT( editServer(int) ) ); |
112 | layout->addMultiCellWidget( servers, 0, 0, 0, 1 ); | 110 | layout->addMultiCellWidget( servers, 0, 0, 0, 1 ); |
113 | 111 | ||
114 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); | 112 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), |
113 | tr( "New" ), container ); | ||
115 | connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) ); | 114 | connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) ); |
116 | layout->addWidget( btn, 1, 0 ); | 115 | layout->addWidget( btn, 1, 0 ); |
117 | 116 | ||
118 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 117 | btn = new QPushButton( Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ), tr( "Delete" ), container ); |
119 | connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) ); | 118 | connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) ); |
120 | layout->addWidget( btn, 1, 1 ); | 119 | layout->addWidget( btn, 1, 1 ); |
121 | 120 | ||
122 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); | 121 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); |
123 | grpbox->layout()->setSpacing( 2 ); | 122 | grpbox->layout()->setSpacing( 2 ); |
124 | grpbox->layout()->setMargin( 4 ); | 123 | grpbox->layout()->setMargin( 4 ); |
125 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); | 124 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); |
126 | 125 | ||
127 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); | 126 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); |
128 | 127 | ||
129 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); | 128 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); |
130 | grplayout->addWidget( label, 0, 0 ); | 129 | grplayout->addWidget( label, 0, 0 ); |
131 | servername = new QLineEdit( grpbox ); | 130 | servername = new QLineEdit( grpbox ); |
132 | grplayout->addWidget( servername, 0, 1 ); | 131 | grplayout->addWidget( servername, 0, 1 ); |
133 | 132 | ||
134 | label = new QLabel( tr( "Address:" ), grpbox ); | 133 | label = new QLabel( tr( "Address:" ), grpbox ); |
135 | grplayout->addWidget( label, 1, 0 ); | 134 | grplayout->addWidget( label, 1, 0 ); |
136 | serverurl = new QLineEdit( grpbox ); | 135 | serverurl = new QLineEdit( grpbox ); |
137 | grplayout->addWidget( serverurl, 1, 1 ); | 136 | grplayout->addWidget( serverurl, 1, 1 ); |
138 | 137 | ||
139 | active = new QCheckBox( tr( "Active Server" ), grpbox ); | 138 | active = new QCheckBox( tr( "Active Server" ), grpbox ); |
140 | grplayout->addMultiCellWidget( active, 2, 2, 0, 1 ); | 139 | grplayout->addMultiCellWidget( active, 2, 2, 0, 1 ); |
141 | 140 | ||
142 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); | 141 | btn = new QPushButton( Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ), tr( "Update" ), grpbox ); |
143 | connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) ); | 142 | connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) ); |
144 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); | 143 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); |
145 | 144 | ||
146 | return control; | 145 | return control; |
147 | } | 146 | } |
148 | 147 | ||
149 | QWidget *SettingsImpl :: initDestinationTab() | 148 | QWidget *SettingsImpl :: initDestinationTab() |
150 | { | 149 | { |
151 | QWidget *control = new QWidget( this ); | 150 | QWidget *control = new QWidget( this ); |
152 | 151 | ||
153 | QVBoxLayout *vb = new QVBoxLayout( control ); | 152 | QVBoxLayout *vb = new QVBoxLayout( control ); |
154 | 153 | ||
155 | QScrollView *sv = new QScrollView( control ); | 154 | QScrollView *sv = new QScrollView( control ); |
156 | vb->addWidget( sv, 0, 0 ); | 155 | vb->addWidget( sv, 0, 0 ); |
157 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 156 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
158 | sv->setFrameStyle( QFrame::NoFrame ); | 157 | sv->setFrameStyle( QFrame::NoFrame ); |
159 | 158 | ||
160 | QWidget *container = new QWidget( sv->viewport() ); | 159 | QWidget *container = new QWidget( sv->viewport() ); |
161 | sv->addChild( container ); | 160 | sv->addChild( container ); |
162 | 161 | ||
163 | QGridLayout *layout = new QGridLayout( container ); | 162 | QGridLayout *layout = new QGridLayout( container ); |
164 | layout->setSpacing( 2 ); | 163 | layout->setSpacing( 2 ); |
165 | layout->setMargin( 4 ); | 164 | layout->setMargin( 4 ); |
166 | 165 | ||
167 | destinations = new QListBox( container ); | 166 | destinations = new QListBox( container ); |
168 | destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 167 | destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
169 | connect( destinations, SIGNAL( highlighted(int) ), this, SLOT( editDestination(int) ) ); | 168 | connect( destinations, SIGNAL( highlighted(int) ), this, SLOT( editDestination(int) ) ); |
170 | layout->addMultiCellWidget( destinations, 0, 0, 0, 1 ); | 169 | layout->addMultiCellWidget( destinations, 0, 0, 0, 1 ); |
171 | 170 | ||
172 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); | 171 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), tr( "New" ), container ); |
173 | connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) ); | 172 | connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) ); |
174 | layout->addWidget( btn, 1, 0 ); | 173 | layout->addWidget( btn, 1, 0 ); |
175 | 174 | ||
176 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 175 | btn = new QPushButton( Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ), tr( "Delete" ), container ); |
177 | connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) ); | 176 | connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) ); |
178 | layout->addWidget( btn, 1, 1 ); | 177 | layout->addWidget( btn, 1, 1 ); |
179 | 178 | ||
180 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); | 179 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); |
181 | grpbox->layout()->setSpacing( 2 ); | 180 | grpbox->layout()->setSpacing( 2 ); |
182 | grpbox->layout()->setMargin( 4 ); | 181 | grpbox->layout()->setMargin( 4 ); |
183 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); | 182 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); |
184 | 183 | ||
185 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); | 184 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); |
186 | 185 | ||
187 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); | 186 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); |
188 | grplayout->addWidget( label, 0, 0 ); | 187 | grplayout->addWidget( label, 0, 0 ); |
189 | destinationname = new QLineEdit( grpbox ); | 188 | destinationname = new QLineEdit( grpbox ); |
190 | grplayout->addWidget( destinationname, 0, 1 ); | 189 | grplayout->addWidget( destinationname, 0, 1 ); |
191 | 190 | ||
192 | label = new QLabel( tr( "Location:" ), grpbox ); | 191 | label = new QLabel( tr( "Location:" ), grpbox ); |
193 | grplayout->addWidget( label, 1, 0 ); | 192 | grplayout->addWidget( label, 1, 0 ); |
194 | destinationurl = new QLineEdit( grpbox ); | 193 | destinationurl = new QLineEdit( grpbox ); |
195 | grplayout->addWidget( destinationurl, 1, 1 ); | 194 | grplayout->addWidget( destinationurl, 1, 1 ); |
196 | 195 | ||
197 | linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox ); | 196 | linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox ); |
198 | grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 ); | 197 | grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 ); |
199 | 198 | ||
200 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); | 199 | btn = new QPushButton( Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ), tr( "Update" ), grpbox ); |
201 | connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) ); | 200 | connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) ); |
202 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); | 201 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); |
203 | 202 | ||
204 | return control; | 203 | return control; |
205 | } | 204 | } |
206 | 205 | ||
207 | QWidget *SettingsImpl :: initProxyTab() | 206 | QWidget *SettingsImpl :: initProxyTab() |
208 | { | 207 | { |
209 | QWidget *control = new QWidget( this ); | 208 | QWidget *control = new QWidget( this ); |
210 | 209 | ||
211 | QVBoxLayout *vb = new QVBoxLayout( control ); | 210 | QVBoxLayout *vb = new QVBoxLayout( control ); |
212 | 211 | ||
213 | QScrollView *sv = new QScrollView( control ); | 212 | QScrollView *sv = new QScrollView( control ); |
214 | vb->addWidget( sv, 0, 0 ); | 213 | vb->addWidget( sv, 0, 0 ); |
215 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 214 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
216 | sv->setFrameStyle( QFrame::NoFrame ); | 215 | sv->setFrameStyle( QFrame::NoFrame ); |
217 | 216 | ||
218 | QWidget *container = new QWidget( sv->viewport() ); | 217 | QWidget *container = new QWidget( sv->viewport() ); |
219 | sv->addChild( container ); | 218 | sv->addChild( container ); |
220 | 219 | ||
221 | QGridLayout *layout = new QGridLayout( container ); | 220 | QGridLayout *layout = new QGridLayout( container ); |
222 | layout->setSpacing( 2 ); | 221 | layout->setSpacing( 2 ); |
223 | layout->setMargin( 4 ); | 222 | layout->setMargin( 4 ); |
224 | 223 | ||
225 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); | 224 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); |
226 | grpbox->layout()->setSpacing( 2 ); | 225 | grpbox->layout()->setSpacing( 2 ); |
227 | grpbox->layout()->setMargin( 4 ); | 226 | grpbox->layout()->setMargin( 4 ); |
228 | layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); | 227 | layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); |
229 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); | 228 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); |
230 | txtHttpProxy = new QLineEdit( grpbox ); | 229 | txtHttpProxy = new QLineEdit( grpbox ); |
231 | grplayout->addWidget( txtHttpProxy ); | 230 | grplayout->addWidget( txtHttpProxy ); |
232 | chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); | 231 | chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); |
233 | grplayout->addWidget( chkHttpProxyEnabled ); | 232 | grplayout->addWidget( chkHttpProxyEnabled ); |
234 | 233 | ||
235 | grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); | 234 | grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); |
236 | grpbox->layout()->setSpacing( 2 ); | 235 | grpbox->layout()->setSpacing( 2 ); |
237 | grpbox->layout()->setMargin( 4 ); | 236 | grpbox->layout()->setMargin( 4 ); |
238 | layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); | 237 | layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); |
239 | grplayout = new QVBoxLayout( grpbox->layout() ); | 238 | grplayout = new QVBoxLayout( grpbox->layout() ); |
240 | txtFtpProxy = new QLineEdit( grpbox ); | 239 | txtFtpProxy = new QLineEdit( grpbox ); |
241 | grplayout->addWidget( txtFtpProxy ); | 240 | grplayout->addWidget( txtFtpProxy ); |
242 | chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); | 241 | chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); |
243 | grplayout->addWidget( chkFtpProxyEnabled ); | 242 | grplayout->addWidget( chkFtpProxyEnabled ); |
244 | 243 | ||
245 | QLabel *label = new QLabel( tr( "Username:" ), container ); | 244 | QLabel *label = new QLabel( tr( "Username:" ), container ); |
246 | layout->addWidget( label, 2, 0 ); | 245 | layout->addWidget( label, 2, 0 ); |
247 | txtUsername = new QLineEdit( container ); | 246 | txtUsername = new QLineEdit( container ); |
248 | layout->addWidget( txtUsername, 2, 1 ); | 247 | layout->addWidget( txtUsername, 2, 1 ); |
249 | 248 | ||
250 | label = new QLabel( tr( "Password:" ), container ); | 249 | label = new QLabel( tr( "Password:" ), container ); |
251 | layout->addWidget( label, 3, 0 ); | 250 | layout->addWidget( label, 3, 0 ); |
252 | txtPassword = new QLineEdit( container ); | 251 | txtPassword = new QLineEdit( container ); |
253 | layout->addWidget( txtPassword, 3, 1 ); | 252 | layout->addWidget( txtPassword, 3, 1 ); |
254 | 253 | ||
255 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container ); | 254 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ), tr( "Update" ), container ); |
256 | connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) ); | 255 | connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) ); |
257 | layout->addMultiCellWidget( btn, 4, 4, 0, 1 ); | 256 | layout->addMultiCellWidget( btn, 4, 4, 0, 1 ); |
258 | 257 | ||
259 | return control; | 258 | return control; |
260 | } | 259 | } |
261 | 260 | ||
262 | void SettingsImpl :: setupData() | 261 | void SettingsImpl :: setupData() |
263 | { | 262 | { |
264 | // add servers | 263 | // add servers |
265 | QString serverName; | 264 | QString serverName; |
266 | QListIterator<Server> it( dataMgr->getServerList() ); | 265 | QListIterator<Server> it( dataMgr->getServerList() ); |
267 | for ( ; it.current(); ++it ) | 266 | for ( ; it.current(); ++it ) |
268 | { | 267 | { |
269 | serverName = it.current()->getServerName(); | 268 | serverName = it.current()->getServerName(); |
270 | if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS ) | 269 | if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS ) |
271 | continue; | 270 | continue; |
272 | 271 | ||
273 | servers->insertItem( serverName ); | 272 | servers->insertItem( serverName ); |
274 | } | 273 | } |
275 | 274 | ||
276 | 275 | ||
277 | // add destinations | 276 | // add destinations |
278 | QListIterator<Destination> it2( dataMgr->getDestinationList() ); | 277 | QListIterator<Destination> it2( dataMgr->getDestinationList() ); |
279 | for ( ; it2.current(); ++it2 ) | 278 | for ( ; it2.current(); ++it2 ) |
280 | destinations->insertItem( it2.current()->getDestinationName() ); | 279 | destinations->insertItem( it2.current()->getDestinationName() ); |
281 | 280 | ||
282 | // setup proxy tab | 281 | // setup proxy tab |
283 | txtHttpProxy->setText( dataMgr->getHttpProxy() ); | 282 | txtHttpProxy->setText( dataMgr->getHttpProxy() ); |
284 | txtFtpProxy->setText( dataMgr->getFtpProxy() ); | 283 | txtFtpProxy->setText( dataMgr->getFtpProxy() ); |
285 | txtUsername->setText( dataMgr->getProxyUsername() ); | 284 | txtUsername->setText( dataMgr->getProxyUsername() ); |
286 | txtPassword->setText( dataMgr->getProxyPassword() ); | 285 | txtPassword->setText( dataMgr->getProxyPassword() ); |
287 | chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() ); | 286 | chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() ); |
288 | chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() ); | 287 | chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() ); |
289 | } | 288 | } |
290 | 289 | ||
291 | //------------------ Servers tab ---------------------- | 290 | //------------------ Servers tab ---------------------- |
292 | 291 | ||
293 | void SettingsImpl :: editServer( int sel ) | 292 | void SettingsImpl :: editServer( int sel ) |
294 | { | 293 | { |
295 | currentSelectedServer = sel; | 294 | currentSelectedServer = sel; |
296 | Server *s = dataMgr->getServer( servers->currentText() ); | 295 | Server *s = dataMgr->getServer( servers->currentText() ); |
297 | if ( s ) | 296 | if ( s ) |
298 | { | 297 | { |
299 | serverName = s->getServerName(); | 298 | serverName = s->getServerName(); |
300 | servername->setText( s->getServerName() ); | 299 | servername->setText( s->getServerName() ); |
301 | serverurl->setText( s->getServerUrl() ); | 300 | serverurl->setText( s->getServerUrl() ); |
302 | active->setChecked( s->isServerActive() ); | 301 | active->setChecked( s->isServerActive() ); |
303 | } | 302 | } |
304 | else | 303 | else |
305 | { | 304 | { |
306 | serverName = ""; | 305 | serverName = ""; |
307 | servername->setText( "" ); | 306 | servername->setText( "" ); |
308 | serverurl->setText( "" ); | 307 | serverurl->setText( "" ); |
309 | active->setChecked( false ); | 308 | active->setChecked( false ); |
310 | } | 309 | } |
311 | } | 310 | } |
312 | 311 | ||
313 | void SettingsImpl :: newServer() | 312 | void SettingsImpl :: newServer() |
314 | { | 313 | { |
315 | newserver = true; | 314 | newserver = true; |
316 | servername->setText( "" ); | 315 | servername->setText( "" ); |
317 | serverurl->setText( "" ); | 316 | serverurl->setText( "" ); |
318 | servername->setFocus(); | 317 | servername->setFocus(); |
319 | active->setChecked( true ); | 318 | active->setChecked( true ); |
320 | } | 319 | } |
321 | 320 | ||
322 | void SettingsImpl :: removeServer() | 321 | void SettingsImpl :: removeServer() |
323 | { | 322 | { |
324 | changed = true; | 323 | changed = true; |
325 | Server *s = dataMgr->getServer( servers->currentText() ); | 324 | Server *s = dataMgr->getServer( servers->currentText() ); |
326 | if ( s ) | 325 | if ( s ) |
327 | { | 326 | { |
328 | dataMgr->getServerList().removeRef( s ); | 327 | dataMgr->getServerList().removeRef( s ); |
329 | servers->removeItem( currentSelectedServer ); | 328 | servers->removeItem( currentSelectedServer ); |
330 | } | 329 | } |
331 | } | 330 | } |
332 | 331 | ||
333 | void SettingsImpl :: changeServerDetails() | 332 | void SettingsImpl :: changeServerDetails() |
334 | { | 333 | { |
335 | changed = true; | 334 | changed = true; |
336 | 335 | ||
337 | QString newName = servername->text(); | 336 | QString newName = servername->text(); |
338 | 337 | ||
339 | // Convert any spaces to underscores | 338 | // Convert any spaces to underscores |
340 | char *tmpStr = new char[newName.length() + 1]; | 339 | char *tmpStr = new char[newName.length() + 1]; |
341 | for ( unsigned int i = 0 ; i < newName.length() ; ++i ) | 340 | for ( unsigned int i = 0 ; i < newName.length() ; ++i ) |
342 | { | 341 | { |
343 | if ( newName[i] == ' ' ) | 342 | if ( newName[i] == ' ' ) |
344 | tmpStr[i] = '_'; | 343 | tmpStr[i] = '_'; |
345 | else | 344 | else |
346 | tmpStr[i] = newName[i].latin1(); | 345 | tmpStr[i] = newName[i].latin1(); |
347 | } | 346 | } |
348 | tmpStr[newName.length()] = '\0'; | 347 | tmpStr[newName.length()] = '\0'; |
349 | 348 | ||
350 | newName = tmpStr; | 349 | newName = tmpStr; |
351 | delete tmpStr; | 350 | delete tmpStr; |
352 | 351 | ||
353 | if ( !newserver ) | 352 | if ( !newserver ) |
354 | { | 353 | { |
355 | Server *s = dataMgr->getServer( servers->currentText() ); | 354 | Server *s = dataMgr->getServer( servers->currentText() ); |
356 | if ( s ) | 355 | if ( s ) |
357 | { | 356 | { |
358 | // Update url | 357 | // Update url |
359 | s->setServerUrl( serverurl->text() ); | 358 | s->setServerUrl( serverurl->text() ); |
360 | s->setActive( active->isChecked() ); | 359 | s->setActive( active->isChecked() ); |
361 | 360 | ||
362 | // Check if server name has changed, if it has then we need to replace the key in the map | 361 | // Check if server name has changed, if it has then we need to replace the key in the map |
363 | if ( serverName != newName ) | 362 | if ( serverName != newName ) |
364 | { | 363 | { |
365 | // Update server name | 364 | // Update server name |
366 | s->setServerName( newName ); | 365 | s->setServerName( newName ); |
367 | } | 366 | } |
368 | 367 | ||
369 | // Update list box | 368 | // Update list box |
370 | servers->changeItem( newName, currentSelectedServer ); | 369 | servers->changeItem( newName, currentSelectedServer ); |
371 | } | 370 | } |
372 | } | 371 | } |
373 | else | 372 | else |
374 | { | 373 | { |
375 | Server s( newName, serverurl->text() ); | 374 | Server s( newName, serverurl->text() ); |
376 | dataMgr->getServerList().append( new Server( newName, serverurl->text() ) ); | 375 | dataMgr->getServerList().append( new Server( newName, serverurl->text() ) ); |
377 | dataMgr->getServerList().last()->setActive( active->isChecked() ); | 376 | dataMgr->getServerList().last()->setActive( active->isChecked() ); |
378 | servers->insertItem( newName ); | 377 | servers->insertItem( newName ); |
379 | servers->setCurrentItem( servers->count() ); | 378 | servers->setCurrentItem( servers->count() ); |
380 | newserver = false; | 379 | newserver = false; |
381 | } | 380 | } |
382 | } | 381 | } |
383 | 382 | ||
384 | //------------------ Destinations tab ---------------------- | 383 | //------------------ Destinations tab ---------------------- |
385 | 384 | ||
386 | void SettingsImpl :: editDestination( int sel ) | 385 | void SettingsImpl :: editDestination( int sel ) |
387 | { | 386 | { |
388 | currentSelectedDestination = sel; | 387 | currentSelectedDestination = sel; |
389 | Destination *d = dataMgr->getDestination( destinations->currentText() ); | 388 | Destination *d = dataMgr->getDestination( destinations->currentText() ); |
390 | if ( d ) | 389 | if ( d ) |
391 | { | 390 | { |
392 | destinationName = d->getDestinationName(); | 391 | destinationName = d->getDestinationName(); |
393 | destinationname->setText( d->getDestinationName() ); | 392 | destinationname->setText( d->getDestinationName() ); |
394 | destinationurl->setText( d->getDestinationPath() ); | 393 | destinationurl->setText( d->getDestinationPath() ); |
395 | linkToRoot->setChecked( d->linkToRoot() ); | 394 | linkToRoot->setChecked( d->linkToRoot() ); |
396 | } | 395 | } |
397 | else | 396 | else |
398 | { | 397 | { |
399 | destinationName = ""; | 398 | destinationName = ""; |
400 | destinationname->setText( "" ); | 399 | destinationname->setText( "" ); |
401 | destinationurl->setText( "" ); | 400 | destinationurl->setText( "" ); |
402 | linkToRoot->setChecked( false ); | 401 | linkToRoot->setChecked( false ); |
403 | } | 402 | } |
404 | } | 403 | } |
405 | 404 | ||
406 | void SettingsImpl :: newDestination() | 405 | void SettingsImpl :: newDestination() |
407 | { | 406 | { |
408 | newdestination = true; | 407 | newdestination = true; |
409 | destinationname->setText( "" ); | 408 | destinationname->setText( "" ); |
410 | destinationurl->setText( "" ); | 409 | destinationurl->setText( "" ); |
411 | destinationname->setFocus(); | 410 | destinationname->setFocus(); |
412 | linkToRoot->setChecked( true ); | 411 | linkToRoot->setChecked( true ); |
413 | } | 412 | } |
414 | 413 | ||
415 | void SettingsImpl :: removeDestination() | 414 | void SettingsImpl :: removeDestination() |
416 | { | 415 | { |
417 | changed = true; | 416 | changed = true; |
418 | Destination *d = dataMgr->getDestination( destinations->currentText() ); | 417 | Destination *d = dataMgr->getDestination( destinations->currentText() ); |
419 | if ( d ) | 418 | if ( d ) |
420 | { | 419 | { |
421 | dataMgr->getDestinationList().removeRef( d ); | 420 | dataMgr->getDestinationList().removeRef( d ); |
422 | destinations->removeItem( currentSelectedDestination ); | 421 | destinations->removeItem( currentSelectedDestination ); |
423 | } | 422 | } |
424 | } | 423 | } |
425 | 424 | ||
426 | void SettingsImpl :: changeDestinationDetails() | 425 | void SettingsImpl :: changeDestinationDetails() |
427 | { | 426 | { |
428 | changed = true; | 427 | changed = true; |
429 | 428 | ||
430 | #ifdef QWS | 429 | #ifdef QWS |
431 | Config cfg( "aqpkg" ); | 430 | Config cfg( "aqpkg" ); |
432 | cfg.setGroup( "destinations" ); | 431 | cfg.setGroup( "destinations" ); |
433 | #endif | 432 | #endif |
434 | 433 | ||
435 | QString newName = destinationname->text(); | 434 | QString newName = destinationname->text(); |
436 | if ( !newdestination ) | 435 | if ( !newdestination ) |
437 | { | 436 | { |
438 | Destination *d = dataMgr->getDestination( destinations->currentText() ); | 437 | Destination *d = dataMgr->getDestination( destinations->currentText() ); |
439 | if ( d ) | 438 | if ( d ) |
440 | { | 439 | { |
441 | // Update url | 440 | // Update url |
442 | d->setDestinationPath( destinationurl->text() ); | 441 | d->setDestinationPath( destinationurl->text() ); |
443 | d->linkToRoot( linkToRoot->isChecked() ); | 442 | d->linkToRoot( linkToRoot->isChecked() ); |
444 | 443 | ||
445 | // Check if server name has changed, if it has then we need to replace the key in the map | 444 | // Check if server name has changed, if it has then we need to replace the key in the map |
446 | if ( destinationName != newName ) | 445 | if ( destinationName != newName ) |
447 | { | 446 | { |
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index 5a4e284..eadfb63 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp | |||
@@ -1,433 +1,435 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | =. | 3 | =. |
4 | .=l. Copyright (c) 2002-2004 The Opie Team <opie-devel@handhelds.org> | 4 | .=l. Copyright (c) 2002-2004 The Opie Team <opie-devel@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "backuprestore.h" | 29 | #include "backuprestore.h" |
30 | #include "errordialog.h" | 30 | #include "errordialog.h" |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <qpe/qpeapplication.h> | ||
34 | #include <qpe/resource.h> | ||
35 | #include <qpe/config.h> | ||
36 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
37 | #include <opie2/odevice.h> | 34 | #include <opie2/odevice.h> |
38 | #include <opie2/ostorageinfo.h> | 35 | #include <opie2/ostorageinfo.h> |
39 | #include <opie2/ofiledialog.h> | 36 | #include <opie2/ofiledialog.h> |
37 | #include <opie2/oresource.h> | ||
40 | #include <opie2/owait.h> | 38 | #include <opie2/owait.h> |
39 | |||
40 | #include <qpe/qpeapplication.h> | ||
41 | #include <qpe/config.h> | ||
42 | |||
41 | using namespace Opie::Core; | 43 | using namespace Opie::Core; |
42 | using namespace Opie::Ui; | 44 | using namespace Opie::Ui; |
43 | 45 | ||
44 | /* QT */ | 46 | /* QT */ |
45 | #include <qapplication.h> | 47 | #include <qapplication.h> |
46 | #include <qmultilineedit.h> | 48 | #include <qmultilineedit.h> |
47 | #include <qdir.h> | 49 | #include <qdir.h> |
48 | #include <qfile.h> | 50 | #include <qfile.h> |
49 | #include <qfileinfo.h> | 51 | #include <qfileinfo.h> |
50 | #include <qlistview.h> | 52 | #include <qlistview.h> |
51 | #include <qpushbutton.h> | 53 | #include <qpushbutton.h> |
52 | #include <qradiobutton.h> | 54 | #include <qradiobutton.h> |
53 | #include <qheader.h> | 55 | #include <qheader.h> |
54 | #include <qmessagebox.h> | 56 | #include <qmessagebox.h> |
55 | #include <qcombobox.h> | 57 | #include <qcombobox.h> |
56 | #include <qlist.h> | 58 | #include <qlist.h> |
57 | #include <qregexp.h> | 59 | #include <qregexp.h> |
58 | #include <qtextstream.h> | 60 | #include <qtextstream.h> |
59 | #include <qtextview.h> | 61 | #include <qtextview.h> |
60 | #include <qlineedit.h> | 62 | #include <qlineedit.h> |
61 | #include <qstringlist.h> | 63 | #include <qstringlist.h> |
62 | 64 | ||
63 | /* STD */ | 65 | /* STD */ |
64 | #include <errno.h> | 66 | #include <errno.h> |
65 | #include <stdlib.h> | 67 | #include <stdlib.h> |
66 | #include <unistd.h> | 68 | #include <unistd.h> |
67 | #include <sys/stat.h> | 69 | #include <sys/stat.h> |
68 | #include <dirent.h> | 70 | #include <dirent.h> |
69 | 71 | ||
70 | #define HEADER_NAME 0 | 72 | #define HEADER_NAME 0 |
71 | #define HEADER_BACKUP 1 | 73 | #define HEADER_BACKUP 1 |
72 | #define BACKUP_LOCATION 2 | 74 | #define BACKUP_LOCATION 2 |
73 | 75 | ||
74 | #define EXTENSION ".bck" | 76 | #define EXTENSION ".bck" |
75 | 77 | ||
76 | const QString tempFileName = "/tmp/backup.err"; | 78 | const QString tempFileName = "/tmp/backup.err"; |
77 | 79 | ||
78 | BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) | 80 | BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) |
79 | : BackupAndRestoreBase(parent, name, fl) | 81 | : BackupAndRestoreBase(parent, name, fl) |
80 | { | 82 | { |
81 | backupList->header()->hide(); | 83 | backupList->header()->hide(); |
82 | restoreList->header()->hide(); | 84 | restoreList->header()->hide(); |
83 | locationList->header()->hide(); | 85 | locationList->header()->hide(); |
84 | connect( backupButton, SIGNAL( clicked() ), this, SLOT( backup() ) ); | 86 | connect( backupButton, SIGNAL( clicked() ), this, SLOT( backup() ) ); |
85 | connect( restoreButton, SIGNAL( clicked() ), this, SLOT( restore() ) ); | 87 | connect( restoreButton, SIGNAL( clicked() ), this, SLOT( restore() ) ); |
86 | connect( backupList, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( selectItem( QListViewItem* ) ) ); | 88 | connect( backupList, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( selectItem( QListViewItem* ) ) ); |
87 | connect( restoreSource, SIGNAL( activated( int ) ), this, SLOT( sourceDirChanged( int ) ) ); | 89 | connect( restoreSource, SIGNAL( activated( int ) ), this, SLOT( sourceDirChanged( int ) ) ); |
88 | connect( addLocationButton, SIGNAL( clicked() ), this, SLOT( addLocation() ) ); | 90 | connect( addLocationButton, SIGNAL( clicked() ), this, SLOT( addLocation() ) ); |
89 | connect( removeLocationButton, SIGNAL( clicked() ), this, SLOT( removeLocation() ) ); | 91 | connect( removeLocationButton, SIGNAL( clicked() ), this, SLOT( removeLocation() ) ); |
90 | connect( selectLocationButton, SIGNAL( clicked() ), this, SLOT( selectLocation() ) ); | 92 | connect( selectLocationButton, SIGNAL( clicked() ), this, SLOT( selectLocation() ) ); |
91 | 93 | ||
92 | //add directorys for backing up | 94 | //add directorys for backing up |
93 | applicationSettings = new QListViewItem(backupList, "Application Settings", "", "Settings/"); | 95 | applicationSettings = new QListViewItem(backupList, "Application Settings", "", "Settings/"); |
94 | selectItem(applicationSettings); | 96 | selectItem(applicationSettings); |
95 | applicationSettings = new QListViewItem(backupList, "Application Data", "", "Applications/"); | 97 | applicationSettings = new QListViewItem(backupList, "Application Data", "", "Applications/"); |
96 | selectItem(applicationSettings); | 98 | selectItem(applicationSettings); |
97 | documents= new QListViewItem(backupList, "Documents", "", "Documents/"); | 99 | documents= new QListViewItem(backupList, "Documents", "", "Documents/"); |
98 | selectItem(documents); | 100 | selectItem(documents); |
99 | 101 | ||
100 | scanForApplicationSettings(); | 102 | scanForApplicationSettings(); |
101 | refreshLocations(); | 103 | refreshLocations(); |
102 | refreshBackupLocations(); | 104 | refreshBackupLocations(); |
103 | 105 | ||
104 | // Read the list of items to ignore. | 106 | // Read the list of items to ignore. |
105 | QList<QString> dontBackupList; | 107 | QList<QString> dontBackupList; |
106 | dontBackupList.setAutoDelete(true); | 108 | dontBackupList.setAutoDelete(true); |
107 | Config config("BackupAndRestore"); | 109 | Config config("BackupAndRestore"); |
108 | config.setGroup("DontBackup"); | 110 | config.setGroup("DontBackup"); |
109 | int total = config.readNumEntry("Total", 0); | 111 | int total = config.readNumEntry("Total", 0); |
110 | for(int i = 0; i < total; i++) | 112 | for(int i = 0; i < total; i++) |
111 | { | 113 | { |
112 | dontBackupList.append(new QString(config.readEntry(QString("%1").arg(i), ""))); | 114 | dontBackupList.append(new QString(config.readEntry(QString("%1").arg(i), ""))); |
113 | } | 115 | } |
114 | 116 | ||
115 | QList<QListViewItem> list; | 117 | QList<QListViewItem> list; |
116 | getAllItems(backupList->firstChild(), list); | 118 | getAllItems(backupList->firstChild(), list); |
117 | 119 | ||
118 | for(uint i = 0; i < list.count(); i++) | 120 | for(uint i = 0; i < list.count(); i++) |
119 | { | 121 | { |
120 | QString text = list.at(i)->text(HEADER_NAME); | 122 | QString text = list.at(i)->text(HEADER_NAME); |
121 | for(uint i2 = 0; i2 < dontBackupList.count(); i2++) | 123 | for(uint i2 = 0; i2 < dontBackupList.count(); i2++) |
122 | { | 124 | { |
123 | if(*dontBackupList.at(i2) == text) | 125 | if(*dontBackupList.at(i2) == text) |
124 | { | 126 | { |
125 | selectItem(list.at(i)); | 127 | selectItem(list.at(i)); |
126 | break; | 128 | break; |
127 | } | 129 | } |
128 | } | 130 | } |
129 | } | 131 | } |
130 | QPEApplication::showWidget( this ); | 132 | QPEApplication::showWidget( this ); |
131 | } | 133 | } |
132 | 134 | ||
133 | BackupAndRestore::~BackupAndRestore() | 135 | BackupAndRestore::~BackupAndRestore() |
134 | { | 136 | { |
135 | QList<QListViewItem> list; | 137 | QList<QListViewItem> list; |
136 | getAllItems(backupList->firstChild(), list); | 138 | getAllItems(backupList->firstChild(), list); |
137 | 139 | ||
138 | Config config("BackupAndRestore"); | 140 | Config config("BackupAndRestore"); |
139 | config.setGroup("DontBackup"); | 141 | config.setGroup("DontBackup"); |
140 | config.clearGroup(); | 142 | config.clearGroup(); |
141 | 143 | ||
142 | int count = 0; | 144 | int count = 0; |
143 | for(uint i = 0; i < list.count(); i++) | 145 | for(uint i = 0; i < list.count(); i++) |
144 | { | 146 | { |
145 | if(list.at(i)->text(HEADER_BACKUP) == "") | 147 | if(list.at(i)->text(HEADER_BACKUP) == "") |
146 | { | 148 | { |
147 | config.writeEntry(QString("%1").arg(count), list.at(i)->text(HEADER_NAME)); | 149 | config.writeEntry(QString("%1").arg(count), list.at(i)->text(HEADER_NAME)); |
148 | count++; | 150 | count++; |
149 | } | 151 | } |
150 | } | 152 | } |
151 | config.writeEntry("Total", count); | 153 | config.writeEntry("Total", count); |
152 | 154 | ||
153 | // Remove Temp File | 155 | // Remove Temp File |
154 | if ( QFile::exists( tempFileName ) ) | 156 | if ( QFile::exists( tempFileName ) ) |
155 | QFile::remove( tempFileName ); | 157 | QFile::remove( tempFileName ); |
156 | } | 158 | } |
157 | 159 | ||
158 | void BackupAndRestore::refreshBackupLocations() | 160 | void BackupAndRestore::refreshBackupLocations() |
159 | { | 161 | { |
160 | backupLocations.clear(); | 162 | backupLocations.clear(); |
161 | // Add cards | 163 | // Add cards |
162 | Opie::Core::OStorageInfo storage; | 164 | Opie::Core::OStorageInfo storage; |
163 | backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); | 165 | backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); |
164 | if ( storage.hasCf() ) | 166 | if ( storage.hasCf() ) |
165 | { | 167 | { |
166 | backupLocations.insert( "CF", storage.cfPath() ); | 168 | backupLocations.insert( "CF", storage.cfPath() ); |
167 | odebug << "Cf Path: " + storage.cfPath() << oendl; | 169 | odebug << "Cf Path: " + storage.cfPath() << oendl; |
168 | } | 170 | } |
169 | if ( storage.hasSd() ) | 171 | if ( storage.hasSd() ) |
170 | { | 172 | { |
171 | backupLocations.insert( "SD", storage.sdPath() ); | 173 | backupLocations.insert( "SD", storage.sdPath() ); |
172 | odebug << " Sd Path: " + storage.sdPath() << oendl; | 174 | odebug << " Sd Path: " + storage.sdPath() << oendl; |
173 | } | 175 | } |
174 | if ( storage.hasMmc() ) | 176 | if ( storage.hasMmc() ) |
175 | { | 177 | { |
176 | backupLocations.insert( "MMC", storage.mmcPath() ); | 178 | backupLocations.insert( "MMC", storage.mmcPath() ); |
177 | odebug << "Mmc Path: " + storage.mmcPath() << oendl; | 179 | odebug << "Mmc Path: " + storage.mmcPath() << oendl; |
178 | } | 180 | } |
179 | 181 | ||
180 | for ( QListViewItemIterator it( locationList ); it.current(); ++it ) | 182 | for ( QListViewItemIterator it( locationList ); it.current(); ++it ) |
181 | { | 183 | { |
182 | backupLocations.insert( it.current()->text( 0 ), it.current()->text( 0 ) ); | 184 | backupLocations.insert( it.current()->text( 0 ), it.current()->text( 0 ) ); |
183 | } | 185 | } |
184 | 186 | ||
185 | //update QComboBox | 187 | //update QComboBox |
186 | storeToLocation->clear(); | 188 | storeToLocation->clear(); |
187 | restoreSource->clear(); | 189 | restoreSource->clear(); |
188 | 190 | ||
189 | //read last locations | 191 | //read last locations |
190 | Config config("BackupAndRestore"); | 192 | Config config("BackupAndRestore"); |
191 | config.setGroup("LastLocation"); | 193 | config.setGroup("LastLocation"); |
192 | QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" ); | 194 | QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" ); |
193 | QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" ); | 195 | QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" ); |
194 | int locationIndex = 0; | 196 | int locationIndex = 0; |
195 | 197 | ||
196 | //fill QComboBox | 198 | //fill QComboBox |
197 | QMap<QString, QString>::Iterator it; | 199 | QMap<QString, QString>::Iterator it; |
198 | for( it = backupLocations.begin(); it != backupLocations.end(); ++it ) | 200 | for( it = backupLocations.begin(); it != backupLocations.end(); ++it ) |
199 | { | 201 | { |
200 | storeToLocation->insertItem(it.key()); | 202 | storeToLocation->insertItem(it.key()); |
201 | restoreSource->insertItem(it.key()); | 203 | restoreSource->insertItem(it.key()); |
202 | 204 | ||
203 | //check for last locations | 205 | //check for last locations |
204 | if ( it.key() == lastStoreLocation ) | 206 | if ( it.key() == lastStoreLocation ) |
205 | storeToLocation->setCurrentItem( locationIndex ); | 207 | storeToLocation->setCurrentItem( locationIndex ); |
206 | if ( it.key() == lastRestoreLocation ) | 208 | if ( it.key() == lastRestoreLocation ) |
207 | restoreSource->setCurrentItem( locationIndex ); | 209 | restoreSource->setCurrentItem( locationIndex ); |
208 | locationIndex++; | 210 | locationIndex++; |
209 | } | 211 | } |
210 | } | 212 | } |
211 | 213 | ||
212 | QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QListViewItem> &list) | 214 | QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QListViewItem> &list) |
213 | { | 215 | { |
214 | while(item) | 216 | while(item) |
215 | { | 217 | { |
216 | if(item->childCount() > 0) | 218 | if(item->childCount() > 0) |
217 | getAllItems(item->firstChild(), list); | 219 | getAllItems(item->firstChild(), list); |
218 | list.append(item); | 220 | list.append(item); |
219 | item = item->nextSibling(); | 221 | item = item->nextSibling(); |
220 | } | 222 | } |
221 | return list; | 223 | return list; |
222 | } | 224 | } |
223 | 225 | ||
224 | /** | 226 | /** |
225 | * Selects and unselects the item by setting the HEADER_BACKUP to B or !. | 227 | * Selects and unselects the item by setting the HEADER_BACKUP to B or !. |
226 | * and changing the icon to match | 228 | * and changing the icon to match |
227 | * @param currentItem the item to swich the selection choice. | 229 | * @param currentItem the item to swich the selection choice. |
228 | */ | 230 | */ |
229 | void BackupAndRestore::selectItem(QListViewItem *currentItem) | 231 | void BackupAndRestore::selectItem(QListViewItem *currentItem) |
230 | { | 232 | { |
231 | if(!currentItem) | 233 | if(!currentItem) |
232 | return; | 234 | return; |
233 | 235 | ||
234 | if(currentItem->text(HEADER_BACKUP) == "B") | 236 | if(currentItem->text(HEADER_BACKUP) == "B") |
235 | { | 237 | { |
236 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/null")); | 238 | currentItem->setPixmap(HEADER_NAME, Opie::Core::OResource::loadPixmap("backup/null")); |
237 | currentItem->setText(HEADER_BACKUP, ""); | 239 | currentItem->setText(HEADER_BACKUP, ""); |
238 | } | 240 | } |
239 | else | 241 | else |
240 | { | 242 | { |
241 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/check")); | 243 | currentItem->setPixmap(HEADER_NAME, Opie::Core::OResource::loadPixmap("backup/check")); |
242 | currentItem->setText(HEADER_BACKUP, "B"); | 244 | currentItem->setText(HEADER_BACKUP, "B"); |
243 | } | 245 | } |
244 | } | 246 | } |
245 | 247 | ||
246 | void BackupAndRestore::scanForApplicationSettings() | 248 | void BackupAndRestore::scanForApplicationSettings() |
247 | { | 249 | { |
248 | QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) ); | 250 | QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) ); |
249 | d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); | 251 | d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); |
250 | const QFileInfoList *list = d.entryInfoList(); | 252 | const QFileInfoList *list = d.entryInfoList(); |
251 | QFileInfoListIterator it( *list ); | 253 | QFileInfoListIterator it( *list ); |
252 | QFileInfo *fi; | 254 | QFileInfo *fi; |
253 | while ( (fi=it.current()) ) | 255 | while ( (fi=it.current()) ) |
254 | { | 256 | { |
255 | //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; | 257 | //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; |
256 | if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) | 258 | if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) |
257 | { | 259 | { |
258 | QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); | 260 | QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); |
259 | selectItem(newItem); | 261 | selectItem(newItem); |
260 | } | 262 | } |
261 | ++it; | 263 | ++it; |
262 | } | 264 | } |
263 | } | 265 | } |
264 | 266 | ||
265 | /** | 267 | /** |
266 | * The "Backup" button has been pressed. Get a list of all of the files that | 268 | * The "Backup" button has been pressed. Get a list of all of the files that |
267 | * should be backed up. If there are no files, emit and error and exit. | 269 | * should be backed up. If there are no files, emit and error and exit. |
268 | * Determine the file name to store the backup in. Backup the file(s) using | 270 | * Determine the file name to store the backup in. Backup the file(s) using |
269 | * tar and gzip --best. Report failure or success | 271 | * tar and gzip --best. Report failure or success |
270 | */ | 272 | */ |
271 | void BackupAndRestore::backup() | 273 | void BackupAndRestore::backup() |
272 | { | 274 | { |
273 | backupUserData(); | 275 | backupUserData(); |
274 | /* if ( cb_type_userdata->isChecked() ) | 276 | /* if ( cb_type_userdata->isChecked() ) |
275 | backupUserData(); | 277 | backupUserData(); |
276 | else | 278 | else |
277 | backupRootFs();*/ | 279 | backupRootFs();*/ |
278 | } | 280 | } |
279 | 281 | ||
280 | 282 | ||
281 | void BackupAndRestore::backupRootFs() | 283 | void BackupAndRestore::backupRootFs() |
282 | { | 284 | { |
283 | if ( ( ODevice::inst()->model() != Model_Zaurus_SL5000 ) && ( ODevice::inst()->model() != Model_Zaurus_SL5500 ) ) | 285 | if ( ( ODevice::inst()->model() != Model_Zaurus_SL5000 ) && ( ODevice::inst()->model() != Model_Zaurus_SL5500 ) ) |
284 | { | 286 | { |
285 | QMessageBox::critical( this, "Not yet implemented!", "<qt>Sorry, support for this model is not yet done.</qt>", "Ok" ); | 287 | QMessageBox::critical( this, "Not yet implemented!", "<qt>Sorry, support for this model is not yet done.</qt>", "Ok" ); |
286 | return; | 288 | return; |
287 | } | 289 | } |
288 | 290 | ||
289 | if ( !QFile::exists( "/usr/bin/mkfs.jffs2" ) && !QFile::exists( "/usr/sbin/mkfs.jffs2" ) ) | 291 | if ( !QFile::exists( "/usr/bin/mkfs.jffs2" ) && !QFile::exists( "/usr/sbin/mkfs.jffs2" ) ) |
290 | { | 292 | { |
291 | QMessageBox::critical( this, "Can't find utility!", "<qt>Can't find mkfs.jffs2 - Install mtd-utils.</qt>", "Ok" ); | 293 | QMessageBox::critical( this, "Can't find utility!", "<qt>Can't find mkfs.jffs2 - Install mtd-utils.</qt>", "Ok" ); |
292 | return; | 294 | return; |
293 | } | 295 | } |
294 | 296 | ||
295 | // call 'mount' and parse its output to gather the device on which the root partition is mounted | 297 | // call 'mount' and parse its output to gather the device on which the root partition is mounted |
296 | FILE* mountp = popen( "mount", "r" ); | 298 | FILE* mountp = popen( "mount", "r" ); |
297 | QString device; | 299 | QString device; |
298 | QString mountpoint; | 300 | QString mountpoint; |
299 | { | 301 | { |
300 | QTextStream mounto( mountp, IO_ReadOnly ); | 302 | QTextStream mounto( mountp, IO_ReadOnly ); |
301 | QString on; | 303 | QString on; |
302 | QString type; | 304 | QString type; |
303 | QString filesystem; | 305 | QString filesystem; |
304 | QString options; | 306 | QString options; |
305 | while ( !mounto.atEnd() ) | 307 | while ( !mounto.atEnd() ) |
306 | { | 308 | { |
307 | mounto >> device >> on >> mountpoint >> type >> filesystem >> options; | 309 | mounto >> device >> on >> mountpoint >> type >> filesystem >> options; |
308 | if ( mountpoint == "/" ) break; | 310 | if ( mountpoint == "/" ) break; |
309 | } | 311 | } |
310 | odebug << device << " is formatted w/ '" << filesystem << "' and mounted on '" << mountpoint << "'" << oendl; | 312 | odebug << device << " is formatted w/ '" << filesystem << "' and mounted on '" << mountpoint << "'" << oendl; |
311 | 313 | ||
312 | if ( !device.startsWith( "/dev/mtdblock" ) ) | 314 | if ( !device.startsWith( "/dev/mtdblock" ) ) |
313 | { | 315 | { |
314 | QMessageBox::critical( this, "Can't backup!", QString( "<qt>unsupported root device '%1' - needs to be /dev/mtdblockN</qt>").arg( device ), "Ok" ); | 316 | QMessageBox::critical( this, "Can't backup!", QString( "<qt>unsupported root device '%1' - needs to be /dev/mtdblockN</qt>").arg( device ), "Ok" ); |
315 | return; | 317 | return; |
316 | } | 318 | } |
317 | } // at this point, the QTextStream has been destroy and we can close the FILE* | 319 | } // at this point, the QTextStream has been destroy and we can close the FILE* |
318 | pclose( mountp ); | 320 | pclose( mountp ); |
319 | 321 | ||
320 | #if 1 | 322 | #if 1 |
321 | int rootmtd = device.right( 1 ).toInt(); | 323 | int rootmtd = device.right( 1 ).toInt(); |
322 | #else | 324 | #else |
323 | int rootmtd = 0; | 325 | int rootmtd = 0; |
324 | #endif | 326 | #endif |
325 | odebug << "root mtdblock seems to be '" << rootmtd << "'" << oendl; | 327 | odebug << "root mtdblock seems to be '" << rootmtd << "'" << oendl; |
326 | 328 | ||
327 | // scan /proc/mtd to gather the size and erasesize of the root mtdblock | 329 | // scan /proc/mtd to gather the size and erasesize of the root mtdblock |
328 | QFile procmtdf( "/proc/mtd" ); | 330 | QFile procmtdf( "/proc/mtd" ); |
329 | if ( !procmtdf.open( IO_ReadOnly ) ) | 331 | if ( !procmtdf.open( IO_ReadOnly ) ) |
330 | { | 332 | { |
331 | QMessageBox::critical( this, "Can't backup!", "<qt>Can't open /proc/mtd</qt>", "Ok" ); | 333 | QMessageBox::critical( this, "Can't backup!", "<qt>Can't open /proc/mtd</qt>", "Ok" ); |
332 | return; | 334 | return; |
333 | } | 335 | } |
334 | 336 | ||
335 | QTextStream procmtd( &procmtdf ); | 337 | QTextStream procmtd( &procmtdf ); |
336 | for ( int i = 0; i <= rootmtd; ++i ) procmtd.readLine(); // skip uninteresting things | 338 | for ( int i = 0; i <= rootmtd; ++i ) procmtd.readLine(); // skip uninteresting things |
337 | QString dev; | 339 | QString dev; |
338 | QString size; | 340 | QString size; |
339 | QString erasesize; | 341 | QString erasesize; |
340 | QString devname; | 342 | QString devname; |
341 | procmtd >> dev >> size >> erasesize >> devname; | 343 | procmtd >> dev >> size >> erasesize >> devname; |
342 | 344 | ||
343 | odebug << "device " << dev << " size = " << size << ", erase size = " << erasesize << ", name = " << devname << "\"" << oendl; | 345 | odebug << "device " << dev << " size = " << size << ", erase size = " << erasesize << ", name = " << devname << "\"" << oendl; |
344 | 346 | ||
345 | // compute pad | 347 | // compute pad |
346 | QString pad = "--pad"; | 348 | QString pad = "--pad"; |
347 | switch ( ODevice::inst()->model() ) | 349 | switch ( ODevice::inst()->model() ) |
348 | { | 350 | { |
349 | case Model_Zaurus_SL5000: pad = "--pad=14680064"; break; | 351 | case Model_Zaurus_SL5000: pad = "--pad=14680064"; break; |
350 | case Model_Zaurus_SL5500: pad = "--pad=14680064"; break; | 352 | case Model_Zaurus_SL5500: pad = "--pad=14680064"; break; |
351 | // FIXME: Add Beagle and SIMpad | 353 | // FIXME: Add Beagle and SIMpad |
352 | } | 354 | } |
353 | 355 | ||
354 | // compute eraseblock | 356 | // compute eraseblock |
355 | QString eraseblock = "--eraseblock=0x" + erasesize; | 357 | QString eraseblock = "--eraseblock=0x" + erasesize; |
356 | 358 | ||
357 | // compute output | 359 | // compute output |
358 | QString outputFile = "--output=" + backupLocations[storeToLocation->currentText()]; | 360 | QString outputFile = "--output=" + backupLocations[storeToLocation->currentText()]; |
359 | QDateTime datetime = QDateTime::currentDateTime(); | 361 | QDateTime datetime = QDateTime::currentDateTime(); |
360 | QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + | 362 | QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + |
361 | QString::number( datetime.date().day() ).rightJustify(2, '0'); | 363 | QString::number( datetime.date().day() ).rightJustify(2, '0'); |
362 | outputFile += "/initrd.bin-" + dateString; | 364 | outputFile += "/initrd.bin-" + dateString; |
363 | 365 | ||
364 | // call mkfs.jffs2 to create the backup | 366 | // call mkfs.jffs2 to create the backup |
365 | QString cmdline = QString( "mkfs.jffs2 --faketime --root=/ %1 --little-endian %2 %3 -n" ).arg( outputFile ).arg( pad ).arg( eraseblock ); | 367 | QString cmdline = QString( "mkfs.jffs2 --faketime --root=/ %1 --little-endian %2 %3 -n" ).arg( outputFile ).arg( pad ).arg( eraseblock ); |
366 | cmdline.append( " --ignore=/tmp --ignore=/mnt --ignore=/var --ignore=/proc" ); | 368 | cmdline.append( " --ignore=/tmp --ignore=/mnt --ignore=/var --ignore=/proc" ); |
367 | owarn << "Calling '" << cmdline << "'" << oendl; | 369 | owarn << "Calling '" << cmdline << "'" << oendl; |
368 | 370 | ||
369 | OWait *owait = new OWait(); | 371 | OWait *owait = new OWait(); |
370 | Global::statusMessage( tr( "Backing up..." ) ); | 372 | Global::statusMessage( tr( "Backing up..." ) ); |
371 | owait->show(); | 373 | owait->show(); |
372 | qApp->processEvents(); | 374 | qApp->processEvents(); |
373 | 375 | ||
374 | int r = ::system( cmdline ); | 376 | int r = ::system( cmdline ); |
375 | 377 | ||
376 | owait->hide(); | 378 | owait->hide(); |
377 | delete owait; | 379 | delete owait; |
378 | 380 | ||
379 | if ( r != 0 ) | 381 | if ( r != 0 ) |
380 | { | 382 | { |
381 | perror("Error: "); | 383 | perror("Error: "); |
382 | QString errorMsg = QString( tr( "<qt>%1</qt>" ).arg( strerror( errno ) ) ); | 384 | QString errorMsg = QString( tr( "<qt>%1</qt>" ).arg( strerror( errno ) ) ); |
383 | QMessageBox::critical(this, tr( "Backup Failed!" ), errorMsg, QString( tr( "Ok" ) ) ); | 385 | QMessageBox::critical(this, tr( "Backup Failed!" ), errorMsg, QString( tr( "Ok" ) ) ); |
384 | } | 386 | } |
385 | 387 | ||
386 | // FIXME: Add image postprocessing for C7x0 and C8x0, for Beagle, for SIMpad | 388 | // FIXME: Add image postprocessing for C7x0 and C8x0, for Beagle, for SIMpad |
387 | } | 389 | } |
388 | 390 | ||
389 | void BackupAndRestore::backupUserData() | 391 | void BackupAndRestore::backupUserData() |
390 | { | 392 | { |
391 | QString backupFiles; | 393 | QString backupFiles; |
392 | if(getBackupFiles(backupFiles, NULL) == 0) | 394 | if(getBackupFiles(backupFiles, NULL) == 0) |
393 | { | 395 | { |
394 | QMessageBox::critical(this, "Message", | 396 | QMessageBox::critical(this, "Message", |
395 | "No items selected.",QString("Ok") ); | 397 | "No items selected.",QString("Ok") ); |
396 | return; | 398 | return; |
397 | } | 399 | } |
398 | 400 | ||
399 | OWait *owait = new OWait(); | 401 | OWait *owait = new OWait(); |
400 | Global::statusMessage( tr( "Backing up..." ) ); | 402 | Global::statusMessage( tr( "Backing up..." ) ); |
401 | owait->show(); | 403 | owait->show(); |
402 | qApp->processEvents(); | 404 | qApp->processEvents(); |
403 | 405 | ||
404 | QString outputFile = backupLocations[storeToLocation->currentText()]; | 406 | QString outputFile = backupLocations[storeToLocation->currentText()]; |
405 | 407 | ||
406 | QDateTime datetime = QDateTime::currentDateTime(); | 408 | QDateTime datetime = QDateTime::currentDateTime(); |
407 | QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + | 409 | QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + |
408 | QString::number( datetime.date().day() ).rightJustify(2, '0'); | 410 | QString::number( datetime.date().day() ).rightJustify(2, '0'); |
409 | 411 | ||
410 | outputFile += "/" + dateString; | 412 | outputFile += "/" + dateString; |
411 | 413 | ||
412 | QString t = outputFile; | 414 | QString t = outputFile; |
413 | int c = 1; | 415 | int c = 1; |
414 | while(QFile::exists(outputFile + EXTENSION)) | 416 | while(QFile::exists(outputFile + EXTENSION)) |
415 | { | 417 | { |
416 | outputFile = t + QString("%1").arg(c); | 418 | outputFile = t + QString("%1").arg(c); |
417 | c++; | 419 | c++; |
418 | } | 420 | } |
419 | 421 | ||
420 | // We execute tar and compressing its output with gzip.. | 422 | // We execute tar and compressing its output with gzip.. |
421 | // The error output will be written into a temp-file which could be provided | 423 | // The error output will be written into a temp-file which could be provided |
422 | // for debugging.. | 424 | // for debugging.. |
423 | odebug << "Storing file: " << outputFile.latin1() << "" << oendl; | 425 | odebug << "Storing file: " << outputFile.latin1() << "" << oendl; |
424 | outputFile += EXTENSION; | 426 | outputFile += EXTENSION; |
425 | 427 | ||
426 | QString commandLine = QString( "cd %1 && (tar -X %1 -cz %2 Applications/backup/exclude -f %3 ) 2> %4" ).arg( QDir::homeDirPath() ) | 428 | QString commandLine = QString( "cd %1 && (tar -X %1 -cz %2 Applications/backup/exclude -f %3 ) 2> %4" ).arg( QDir::homeDirPath() ) |
427 | .arg( getExcludeFile() ) | 429 | .arg( getExcludeFile() ) |
428 | .arg( backupFiles ) | 430 | .arg( backupFiles ) |
429 | .arg( outputFile.latin1() ) | 431 | .arg( outputFile.latin1() ) |
430 | .arg( tempFileName.latin1() ); | 432 | .arg( tempFileName.latin1() ); |
431 | 433 | ||
432 | odebug << commandLine << oendl; | 434 | odebug << commandLine << oendl; |
433 | 435 | ||