author | drw <drw> | 2004-02-22 00:23:34 (UTC) |
---|---|---|
committer | drw <drw> | 2004-02-22 00:23:34 (UTC) |
commit | 91faf16c7336e54a6472fc9821903782918be539 (patch) (unidiff) | |
tree | 1fe4a46860fab93000b8d633d7fd0c10013904d0 | |
parent | e8aa81decb9a22828dcdbbaf3d08e2c6f1d2217f (diff) | |
download | opie-91faf16c7336e54a6472fc9821903782918be539.zip opie-91faf16c7336e54a6472fc9821903782918be539.tar.gz opie-91faf16c7336e54a6472fc9821903782918be539.tar.bz2 |
AQPkg: libopie->libopie2
-rw-r--r-- | noncore/settings/aqpkg/aqpkg.pro | 70 | ||||
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 254 | ||||
-rw-r--r-- | noncore/settings/aqpkg/ipkg.cpp | 6 | ||||
-rw-r--r-- | noncore/settings/aqpkg/ipkg.h | 14 | ||||
-rw-r--r-- | noncore/settings/aqpkg/main.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/opie-aqpkg.control | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/settingsimpl.cpp | 8 |
7 files changed, 178 insertions, 178 deletions
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro index a24f036..35a7889 100644 --- a/noncore/settings/aqpkg/aqpkg.pro +++ b/noncore/settings/aqpkg/aqpkg.pro | |||
@@ -1,40 +1,40 @@ | |||
1 | CONFIG = qt warn_on release quick-app | 1 | CONFIG = qt warn_on release quick-app |
2 | HEADERS = global.h \ | 2 | HEADERS = global.h \ |
3 | mainwin.h \ | 3 | mainwin.h \ |
4 | datamgr.h \ | 4 | datamgr.h \ |
5 | settingsimpl.h \ | 5 | settingsimpl.h \ |
6 | ipkg.h \ | 6 | ipkg.h \ |
7 | packagewin.h \ | 7 | packagewin.h \ |
8 | package.h \ | 8 | package.h \ |
9 | installdlgimpl.h \ | 9 | installdlgimpl.h \ |
10 | instoptionsimpl.h \ | 10 | instoptionsimpl.h \ |
11 | destination.h \ | 11 | destination.h \ |
12 | utils.h \ | 12 | utils.h \ |
13 | server.h \ | 13 | server.h \ |
14 | letterpushbutton.h \ | 14 | letterpushbutton.h \ |
15 | inputdlg.h \ | 15 | inputdlg.h \ |
16 | categoryfilterimpl.h | 16 | categoryfilterimpl.h |
17 | SOURCES = mainwin.cpp \ | 17 | SOURCES = mainwin.cpp \ |
18 | datamgr.cpp \ | 18 | datamgr.cpp \ |
19 | mem.cpp \ | 19 | mem.cpp \ |
20 | settingsimpl.cpp \ | 20 | settingsimpl.cpp \ |
21 | ipkg.cpp \ | 21 | ipkg.cpp \ |
22 | main.cpp \ | 22 | main.cpp \ |
23 | packagewin.cpp \ | 23 | packagewin.cpp \ |
24 | package.cpp \ | 24 | package.cpp \ |
25 | installdlgimpl.cpp \ | 25 | installdlgimpl.cpp \ |
26 | instoptionsimpl.cpp \ | 26 | instoptionsimpl.cpp \ |
27 | destination.cpp \ | 27 | destination.cpp \ |
28 | utils.cpp \ | 28 | utils.cpp \ |
29 | server.cpp \ | 29 | server.cpp \ |
30 | letterpushbutton.cpp \ | 30 | letterpushbutton.cpp \ |
31 | inputdlg.cpp \ | 31 | inputdlg.cpp \ |
32 | version.cpp \ | 32 | version.cpp \ |
33 | categoryfilterimpl.cpp | 33 | categoryfilterimpl.cpp |
34 | TARGET = aqpkg | 34 | TARGET = aqpkg |
35 | INCLUDEPATH += $(OPIEDIR)/include | 35 | INCLUDEPATH += $(OPIEDIR)/include |
36 | DEPENDPATH += $(OPIEDIR)/include | 36 | DEPENDPATH += $(OPIEDIR)/include |
37 | LIBS += -lqpe -lopie | 37 | LIBS += -lqpe -lopiecore2 -lopieui2 |
38 | 38 | ||
39 | include ( $(OPIEDIR)/include.pro ) | 39 | include ( $(OPIEDIR)/include.pro ) |
40 | 40 | ||
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index ea2c47f..d927a36 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp | |||
@@ -1,476 +1,476 @@ | |||
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 <opie/ofiledialog.h> | 32 | #include <opie2/ofiledialog.h> |
33 | 33 | ||
34 | #ifdef QWS | 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> | 38 | #include <qpe/resource.h> |
39 | #include <qpe/storage.h> | 39 | #include <qpe/storage.h> |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #include <qcheckbox.h> | 42 | #include <qcheckbox.h> |
43 | #include <qcombobox.h> | 43 | #include <qcombobox.h> |
44 | #include <qdialog.h> | 44 | #include <qdialog.h> |
45 | #include <qfileinfo.h> | 45 | #include <qfileinfo.h> |
46 | #include <qgroupbox.h> | 46 | #include <qgroupbox.h> |
47 | #include <qmultilineedit.h> | 47 | #include <qmultilineedit.h> |
48 | #include <qlabel.h> | 48 | #include <qlabel.h> |
49 | #include <qlayout.h> | 49 | #include <qlayout.h> |
50 | #include <qpushbutton.h> | 50 | #include <qpushbutton.h> |
51 | 51 | ||
52 | #include "datamgr.h" | 52 | #include "datamgr.h" |
53 | #include "destination.h" | 53 | #include "destination.h" |
54 | #include "instoptionsimpl.h" | 54 | #include "instoptionsimpl.h" |
55 | #include "installdlgimpl.h" | 55 | #include "installdlgimpl.h" |
56 | #include "ipkg.h" | 56 | #include "ipkg.h" |
57 | #include "utils.h" | 57 | #include "utils.h" |
58 | #include "global.h" | 58 | #include "global.h" |
59 | 59 | ||
60 | enum { | 60 | enum { |
61 | MAXLINES = 100, | 61 | MAXLINES = 100, |
62 | }; | 62 | }; |
63 | 63 | ||
64 | InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title ) | 64 | InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title ) |
65 | : QWidget( 0, 0, 0 ) | 65 | : QWidget( 0, 0, 0 ) |
66 | { | 66 | { |
67 | setCaption( title ); | 67 | setCaption( title ); |
68 | init( TRUE ); | 68 | init( TRUE ); |
69 | 69 | ||
70 | pIpkg = 0; | 70 | pIpkg = 0; |
71 | upgradePackages = false; | 71 | upgradePackages = false; |
72 | dataMgr = dataManager; | 72 | dataMgr = dataManager; |
73 | 73 | ||
74 | QString defaultDest = "root"; | 74 | QString defaultDest = "root"; |
75 | #ifdef QWS | 75 | #ifdef QWS |
76 | Config cfg( "aqpkg" ); | 76 | Config cfg( "aqpkg" ); |
77 | cfg.setGroup( "settings" ); | 77 | cfg.setGroup( "settings" ); |
78 | defaultDest = cfg.readEntry( "dest", "root" ); | 78 | defaultDest = cfg.readEntry( "dest", "root" ); |
79 | 79 | ||
80 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) | 80 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) |
81 | flags = cfg.readNumEntry( "installFlags", 0 ); | 81 | flags = cfg.readNumEntry( "installFlags", 0 ); |
82 | infoLevel = cfg.readNumEntry( "infoLevel", 1 ); | 82 | infoLevel = cfg.readNumEntry( "infoLevel", 1 ); |
83 | #else | 83 | #else |
84 | flags = 0; | 84 | flags = 0; |
85 | #endif | 85 | #endif |
86 | 86 | ||
87 | // Output text is read only | 87 | // Output text is read only |
88 | output->setReadOnly( true ); | 88 | output->setReadOnly( true ); |
89 | //QFont f( "helvetica" ); | 89 | // QFont f( "helvetica" ); |
90 | //f.setPointSize( 10 ); | 90 | // f.setPointSize( 10 ); |
91 | //output->setFont( f ); | 91 | // output->setFont( f ); |
92 | 92 | ||
93 | 93 | ||
94 | // setup destination data | 94 | // setup destination data |
95 | int defIndex = 0; | 95 | int defIndex = 0; |
96 | int i; | 96 | int i; |
97 | QListIterator<Destination> dit( dataMgr->getDestinationList() ); | 97 | QListIterator<Destination> dit( dataMgr->getDestinationList() ); |
98 | for ( i = 0; dit.current(); ++dit, ++i ) | 98 | for ( i = 0; dit.current(); ++dit, ++i ) |
99 | { | 99 | { |
100 | destination->insertItem( dit.current()->getDestinationName() ); | 100 | destination->insertItem( dit.current()->getDestinationName() ); |
101 | if ( dit.current()->getDestinationName() == defaultDest ) | 101 | if ( dit.current()->getDestinationName() == defaultDest ) |
102 | defIndex = i; | 102 | defIndex = i; |
103 | } | 103 | } |
104 | 104 | ||
105 | destination->setCurrentItem( defIndex ); | 105 | destination->setCurrentItem( defIndex ); |
106 | 106 | ||
107 | QListIterator<InstallData> it( packageList ); | 107 | QListIterator<InstallData> it( packageList ); |
108 | // setup package data | 108 | // setup package data |
109 | QString remove = tr( "Remove\n" ); | 109 | QString remove = tr( "Remove\n" ); |
110 | QString install = tr( "Install\n" ); | 110 | QString install = tr( "Install\n" ); |
111 | QString upgrade = tr( "Upgrade\n" ); | 111 | QString upgrade = tr( "Upgrade\n" ); |
112 | for ( ; it.current(); ++it ) | 112 | for ( ; it.current(); ++it ) |
113 | { | 113 | { |
114 | InstallData *item = it.current(); | 114 | InstallData *item = it.current(); |
115 | InstallData *newitem = new InstallData(); | 115 | InstallData *newitem = new InstallData(); |
116 | 116 | ||
117 | newitem->option = item->option; | 117 | newitem->option = item->option; |
118 | newitem->packageName = item->packageName; | 118 | newitem->packageName = item->packageName; |
119 | newitem->destination = item->destination; | 119 | newitem->destination = item->destination; |
120 | newitem->recreateLinks = item->recreateLinks; | 120 | newitem->recreateLinks = item->recreateLinks; |
121 | packages.append( newitem ); | 121 | packages.append( newitem ); |
122 | 122 | ||
123 | if ( item->option == "I" ) | 123 | if ( item->option == "I" ) |
124 | { | 124 | { |
125 | install.append( QString( " %1\n" ).arg( item->packageName ) ); | 125 | install.append( QString( " %1\n" ).arg( item->packageName ) ); |
126 | } | 126 | } |
127 | else if ( item->option == "D" ) | 127 | else if ( item->option == "D" ) |
128 | { | 128 | { |
129 | remove.append( QString( " %1\n" ).arg( item->packageName ) ); | 129 | remove.append( QString( " %1\n" ).arg( item->packageName ) ); |
130 | } | 130 | } |
131 | else if ( item->option == "U" || item->option == "R" ) | 131 | else if ( item->option == "U" || item->option == "R" ) |
132 | { | 132 | { |
133 | QString type; | 133 | QString type; |
134 | if ( item->option == "R" ) | 134 | if ( item->option == "R" ) |
135 | type = tr( "(ReInstall)" ); | 135 | type = tr( "(ReInstall)" ); |
136 | else | 136 | else |
137 | type = tr( "(Upgrade)" ); | 137 | type = tr( "(Upgrade)" ); |
138 | upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) ); | 138 | upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) ); |
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); | 142 | output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); |
143 | 143 | ||
144 | displayAvailableSpace( destination->currentText() ); | 144 | displayAvailableSpace( destination->currentText() ); |
145 | } | 145 | } |
146 | 146 | ||
147 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title ) | 147 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title ) |
148 | : QWidget( 0, 0, 0 ) | 148 | : QWidget( 0, 0, 0 ) |
149 | { | 149 | { |
150 | setCaption( title ); | 150 | setCaption( title ); |
151 | init( FALSE ); | 151 | init( FALSE ); |
152 | pIpkg = ipkg; | 152 | pIpkg = ipkg; |
153 | output->setText( initialText ); | 153 | output->setText( initialText ); |
154 | } | 154 | } |
155 | 155 | ||
156 | 156 | ||
157 | InstallDlgImpl::~InstallDlgImpl() | 157 | InstallDlgImpl::~InstallDlgImpl() |
158 | { | 158 | { |
159 | if ( pIpkg ) | 159 | if ( pIpkg ) |
160 | delete pIpkg; | 160 | delete pIpkg; |
161 | } | 161 | } |
162 | 162 | ||
163 | void InstallDlgImpl :: init( bool displayextrainfo ) | 163 | void InstallDlgImpl :: init( bool displayextrainfo ) |
164 | { | 164 | { |
165 | QGridLayout *layout = new QGridLayout( this ); | 165 | QGridLayout *layout = new QGridLayout( this ); |
166 | layout->setSpacing( 4 ); | 166 | layout->setSpacing( 4 ); |
167 | layout->setMargin( 4 ); | 167 | layout->setMargin( 4 ); |
168 | 168 | ||
169 | if ( displayextrainfo ) | 169 | if ( displayextrainfo ) |
170 | { | 170 | { |
171 | QLabel *label = new QLabel( tr( "Destination" ), this ); | 171 | QLabel *label = new QLabel( tr( "Destination" ), this ); |
172 | layout->addWidget( label, 0, 0 ); | 172 | layout->addWidget( label, 0, 0 ); |
173 | destination = new QComboBox( FALSE, this ); | 173 | destination = new QComboBox( FALSE, this ); |
174 | layout->addWidget( destination, 0, 1 ); | 174 | layout->addWidget( destination, 0, 1 ); |
175 | connect( destination, SIGNAL( highlighted( const QString & ) ), | 175 | connect( destination, SIGNAL( highlighted( const QString & ) ), |
176 | this, SLOT( displayAvailableSpace( const QString & ) ) ); | 176 | this, SLOT( displayAvailableSpace( const QString & ) ) ); |
177 | 177 | ||
178 | QLabel *label2 = new QLabel( tr( "Space Avail" ), this ); | 178 | QLabel *label2 = new QLabel( tr( "Space Avail" ), this ); |
179 | layout->addWidget( label2, 1, 0 ); | 179 | layout->addWidget( label2, 1, 0 ); |
180 | txtAvailableSpace = new QLabel( "", this ); | 180 | txtAvailableSpace = new QLabel( "", this ); |
181 | layout->addWidget( txtAvailableSpace, 1, 1 ); | 181 | layout->addWidget( txtAvailableSpace, 1, 1 ); |
182 | } | 182 | } |
183 | else | 183 | else |
184 | { | 184 | { |
185 | destination = 0x0; | 185 | destination = 0x0; |
186 | txtAvailableSpace = 0x0; | 186 | txtAvailableSpace = 0x0; |
187 | } | 187 | } |
188 | 188 | ||
189 | QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); | 189 | QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); |
190 | GroupBox2->layout()->setSpacing( 0 ); | 190 | GroupBox2->layout()->setSpacing( 0 ); |
191 | GroupBox2->layout()->setMargin( 4 ); | 191 | GroupBox2->layout()->setMargin( 4 ); |
192 | 192 | ||
193 | QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() ); | 193 | QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() ); |
194 | output = new QMultiLineEdit( GroupBox2 ); | 194 | output = new QMultiLineEdit( GroupBox2 ); |
195 | GroupBox2Layout->addWidget( output ); | 195 | GroupBox2Layout->addWidget( output ); |
196 | layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 ); | 196 | layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 ); |
197 | 197 | ||
198 | btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this ); | 198 | btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this ); |
199 | layout->addWidget( btnInstall, 3, 0 ); | 199 | layout->addWidget( btnInstall, 3, 0 ); |
200 | connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) ); | 200 | connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) ); |
201 | 201 | ||
202 | btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this ); | 202 | btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this ); |
203 | layout->addWidget( btnOptions, 3, 1 ); | 203 | layout->addWidget( btnOptions, 3, 1 ); |
204 | connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) ); | 204 | connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) ); |
205 | } | 205 | } |
206 | 206 | ||
207 | void InstallDlgImpl :: optionsSelected() | 207 | void InstallDlgImpl :: optionsSelected() |
208 | { | 208 | { |
209 | if ( btnOptions->text() == tr( "Options" ) ) | 209 | if ( btnOptions->text() == tr( "Options" ) ) |
210 | { | 210 | { |
211 | InstallOptionsDlgImpl opt( flags, infoLevel, this, "Option", true ); | 211 | InstallOptionsDlgImpl opt( flags, infoLevel, this, "Option", true ); |
212 | if ( opt.exec() == QDialog::Accepted ) | 212 | if ( opt.exec() == QDialog::Accepted ) |
213 | { | 213 | { |
214 | // set options selected from dialog | 214 | // set options selected from dialog |
215 | flags = opt.getFlags(); | 215 | flags = opt.getFlags(); |
216 | infoLevel = opt.getInfoLevel(); | 216 | infoLevel = opt.getInfoLevel(); |
217 | 217 | ||
218 | #ifdef QWS | 218 | #ifdef QWS |
219 | Config cfg( "aqpkg" ); | 219 | Config cfg( "aqpkg" ); |
220 | cfg.setGroup( "settings" ); | 220 | cfg.setGroup( "settings" ); |
221 | cfg.writeEntry( "installFlags", flags ); | 221 | cfg.writeEntry( "installFlags", flags ); |
222 | cfg.writeEntry( "infoLevel", infoLevel ); | 222 | cfg.writeEntry( "infoLevel", infoLevel ); |
223 | #endif | 223 | #endif |
224 | } | 224 | } |
225 | } | 225 | } |
226 | else // Save output | 226 | else // Save output |
227 | { | 227 | { |
228 | QMap<QString, QStringList> map; | 228 | QMap<QString, QStringList> map; |
229 | map.insert( tr( "All" ), QStringList() ); | 229 | map.insert( tr( "All" ), QStringList() ); |
230 | QStringList text; | 230 | QStringList text; |
231 | text << "text/*"; | 231 | text << "text/*"; |
232 | map.insert(tr( "Text" ), text ); | 232 | map.insert(tr( "Text" ), text ); |
233 | text << "*"; | 233 | text << "*"; |
234 | map.insert( tr( "All" ), text ); | 234 | map.insert( tr( "All" ), text ); |
235 | 235 | ||
236 | QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); | 236 | QString filename = Opie::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); |
237 | if( !filename.isEmpty() ) | 237 | if( !filename.isEmpty() ) |
238 | { | 238 | { |
239 | QString currentFileName = QFileInfo( filename ).fileName(); | 239 | QString currentFileName = QFileInfo( filename ).fileName(); |
240 | DocLnk doc; | 240 | DocLnk doc; |
241 | doc.setType( "text/plain" ); | 241 | doc.setType( "text/plain" ); |
242 | doc.setFile( filename ); | 242 | doc.setFile( filename ); |
243 | doc.setName( currentFileName ); | 243 | doc.setName( currentFileName ); |
244 | FileManager fm; | 244 | FileManager fm; |
245 | fm.saveFile( doc, output->text() ); | 245 | fm.saveFile( doc, output->text() ); |
246 | } | 246 | } |
247 | } | 247 | } |
248 | } | 248 | } |
249 | 249 | ||
250 | void InstallDlgImpl :: installSelected() | 250 | void InstallDlgImpl :: installSelected() |
251 | { | 251 | { |
252 | if ( btnInstall->text() == tr( "Abort" ) ) | 252 | if ( btnInstall->text() == tr( "Abort" ) ) |
253 | { | 253 | { |
254 | if ( pIpkg ) | 254 | if ( pIpkg ) |
255 | { | 255 | { |
256 | displayText( tr( "\n**** User Clicked ABORT ***" ) ); | 256 | displayText( tr( "\n**** User Clicked ABORT ***" ) ); |
257 | pIpkg->abort(); | 257 | pIpkg->abort(); |
258 | displayText( tr( "**** Process Aborted ****" ) ); | 258 | displayText( tr( "**** Process Aborted ****" ) ); |
259 | } | 259 | } |
260 | 260 | ||
261 | btnInstall->setText( tr( "Close" ) ); | 261 | btnInstall->setText( tr( "Close" ) ); |
262 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); | 262 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); |
263 | return; | 263 | return; |
264 | } | 264 | } |
265 | else if ( btnInstall->text() == tr( "Close" ) ) | 265 | else if ( btnInstall->text() == tr( "Close" ) ) |
266 | { | 266 | { |
267 | emit reloadData( this ); | 267 | emit reloadData( this ); |
268 | return; | 268 | return; |
269 | } | 269 | } |
270 | 270 | ||
271 | // Disable buttons | 271 | // Disable buttons |
272 | btnOptions->setEnabled( false ); | 272 | btnOptions->setEnabled( false ); |
273 | // btnInstall->setEnabled( false ); | 273 | // btnInstall->setEnabled( false ); |
274 | 274 | ||
275 | btnInstall->setText( tr( "Abort" ) ); | 275 | btnInstall->setText( tr( "Abort" ) ); |
276 | btnInstall->setIconSet( Resource::loadPixmap( "close" ) ); | 276 | btnInstall->setIconSet( Resource::loadPixmap( "close" ) ); |
277 | 277 | ||
278 | if ( pIpkg ) | 278 | if ( pIpkg ) |
279 | { | 279 | { |
280 | output->setText( "" ); | 280 | output->setText( "" ); |
281 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | 281 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
282 | connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); | 282 | connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); |
283 | pIpkg->runIpkg(); | 283 | pIpkg->runIpkg(); |
284 | } | 284 | } |
285 | else | 285 | else |
286 | { | 286 | { |
287 | output->setText( "" ); | 287 | output->setText( "" ); |
288 | Destination *d = dataMgr->getDestination( destination->currentText() ); | 288 | Destination *d = dataMgr->getDestination( destination->currentText() ); |
289 | QString dest = d->getDestinationName(); | 289 | QString dest = d->getDestinationName(); |
290 | QString destDir = d->getDestinationPath(); | 290 | QString destDir = d->getDestinationPath(); |
291 | int instFlags = flags; | 291 | int instFlags = flags; |
292 | if ( d->linkToRoot() ) | 292 | if ( d->linkToRoot() ) |
293 | instFlags |= MAKE_LINKS; | 293 | instFlags |= MAKE_LINKS; |
294 | 294 | ||
295 | #ifdef QWS | 295 | #ifdef QWS |
296 | // Save settings | 296 | // Save settings |
297 | Config cfg( "aqpkg" ); | 297 | Config cfg( "aqpkg" ); |
298 | cfg.setGroup( "settings" ); | 298 | cfg.setGroup( "settings" ); |
299 | cfg.writeEntry( "dest", dest ); | 299 | cfg.writeEntry( "dest", dest ); |
300 | #endif | 300 | #endif |
301 | 301 | ||
302 | pIpkg = new Ipkg; | 302 | pIpkg = new Ipkg; |
303 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | 303 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
304 | connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); | 304 | connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); |
305 | 305 | ||
306 | firstPackage = TRUE; | 306 | firstPackage = TRUE; |
307 | ipkgFinished(); | 307 | ipkgFinished(); |
308 | 308 | ||
309 | // First run through the remove list, then the install list then the upgrade list | 309 | // First run through the remove list, then the install list then the upgrade list |
310 | /* | 310 | /* |
311 | pIpkg->setOption( "remove" ); | 311 | pIpkg->setOption( "remove" ); |
312 | QListIterator<InstallData> it( removeList ); | 312 | QListIterator<InstallData> it( removeList ); |
313 | InstallData *idata; | 313 | InstallData *idata; |
314 | for ( ; it.current(); ++it ) | 314 | for ( ; it.current(); ++it ) |
315 | { | 315 | { |
316 | idata = it.current(); | 316 | idata = it.current(); |
317 | pIpkg->setDestination( idata->destination->getDestinationName() ); | 317 | pIpkg->setDestination( idata->destination->getDestinationName() ); |
318 | pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); | 318 | pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); |
319 | pIpkg->setPackage( idata->packageName ); | 319 | pIpkg->setPackage( idata->packageName ); |
320 | 320 | ||
321 | int tmpFlags = flags; | 321 | int tmpFlags = flags; |
322 | if ( idata->destination->linkToRoot() ) | 322 | if ( idata->destination->linkToRoot() ) |
323 | tmpFlags |= MAKE_LINKS; | 323 | tmpFlags |= MAKE_LINKS; |
324 | 324 | ||
325 | pIpkg->setFlags( tmpFlags, infoLevel ); | 325 | pIpkg->setFlags( tmpFlags, infoLevel ); |
326 | pIpkg->runIpkg(); | 326 | pIpkg->runIpkg(); |
327 | } | 327 | } |
328 | 328 | ||
329 | pIpkg->setOption( "install" ); | 329 | pIpkg->setOption( "install" ); |
330 | pIpkg->setDestination( dest ); | 330 | pIpkg->setDestination( dest ); |
331 | pIpkg->setDestinationDir( destDir ); | 331 | pIpkg->setDestinationDir( destDir ); |
332 | pIpkg->setFlags( instFlags, infoLevel ); | 332 | pIpkg->setFlags( instFlags, infoLevel ); |
333 | QListIterator<InstallData> it2( installList ); | 333 | QListIterator<InstallData> it2( installList ); |
334 | for ( ; it2.current(); ++it2 ) | 334 | for ( ; it2.current(); ++it2 ) |
335 | { | 335 | { |
336 | pIpkg->setPackage( it2.current()->packageName ); | 336 | pIpkg->setPackage( it2.current()->packageName ); |
337 | pIpkg->runIpkg(); | 337 | pIpkg->runIpkg(); |
338 | } | 338 | } |
339 | 339 | ||
340 | flags |= FORCE_REINSTALL; | 340 | flags |= FORCE_REINSTALL; |
341 | QListIterator<InstallData> it3( updateList ); | 341 | QListIterator<InstallData> it3( updateList ); |
342 | for ( ; it3.current() ; ++it3 ) | 342 | for ( ; it3.current() ; ++it3 ) |
343 | { | 343 | { |
344 | idata = it3.current(); | 344 | idata = it3.current(); |
345 | if ( idata->option == "R" ) | 345 | if ( idata->option == "R" ) |
346 | pIpkg->setOption( "reinstall" ); | 346 | pIpkg->setOption( "reinstall" ); |
347 | else | 347 | else |
348 | pIpkg->setOption( "upgrade" ); | 348 | pIpkg->setOption( "upgrade" ); |
349 | pIpkg->setDestination( idata->destination->getDestinationName() ); | 349 | pIpkg->setDestination( idata->destination->getDestinationName() ); |
350 | pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); | 350 | pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); |
351 | pIpkg->setPackage( idata->packageName ); | 351 | pIpkg->setPackage( idata->packageName ); |
352 | 352 | ||
353 | int tmpFlags = flags; | 353 | int tmpFlags = flags; |
354 | if ( idata->destination->linkToRoot() && idata->recreateLinks ) | 354 | if ( idata->destination->linkToRoot() && idata->recreateLinks ) |
355 | tmpFlags |= MAKE_LINKS; | 355 | tmpFlags |= MAKE_LINKS; |
356 | pIpkg->setFlags( tmpFlags, infoLevel ); | 356 | pIpkg->setFlags( tmpFlags, infoLevel ); |
357 | pIpkg->runIpkg(); | 357 | pIpkg->runIpkg(); |
358 | } | 358 | } |
359 | 359 | ||
360 | delete pIpkg; | 360 | delete pIpkg; |
361 | pIpkg = 0; | 361 | pIpkg = 0; |
362 | */ | 362 | */ |
363 | } | 363 | } |
364 | } | 364 | } |
365 | 365 | ||
366 | 366 | ||
367 | void InstallDlgImpl :: displayText(const QString &text ) | 367 | void InstallDlgImpl :: displayText(const QString &text ) |
368 | { | 368 | { |
369 | QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); | 369 | QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); |
370 | 370 | ||
371 | /* Set a max line count for the QMultiLineEdit, as users have reported | 371 | /* Set a max line count for the QMultiLineEdit, as users have reported |
372 | * performance issues when line count gets extreme. | 372 | * performance issues when line count gets extreme. |
373 | */ | 373 | */ |
374 | if(output->numLines() >= MAXLINES) | 374 | if(output->numLines() >= MAXLINES) |
375 | output->removeLine(0); | 375 | output->removeLine(0); |
376 | output->setText( newtext ); | 376 | output->setText( newtext ); |
377 | output->setCursorPosition( output->numLines(), 0 ); | 377 | output->setCursorPosition( output->numLines(), 0 ); |
378 | } | 378 | } |
379 | 379 | ||
380 | 380 | ||
381 | void InstallDlgImpl :: displayAvailableSpace( const QString &text ) | 381 | void InstallDlgImpl :: displayAvailableSpace( const QString &text ) |
382 | { | 382 | { |
383 | Destination *d = dataMgr->getDestination( text ); | 383 | Destination *d = dataMgr->getDestination( text ); |
384 | QString destDir = d->getDestinationPath(); | 384 | QString destDir = d->getDestinationPath(); |
385 | 385 | ||
386 | long blockSize = 0; | 386 | long blockSize = 0; |
387 | long totalBlocks = 0; | 387 | long totalBlocks = 0; |
388 | long availBlocks = 0; | 388 | long availBlocks = 0; |
389 | QString space; | 389 | QString space; |
390 | if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) | 390 | if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) |
391 | { | 391 | { |
392 | long mult = blockSize / 1024; | 392 | long mult = blockSize / 1024; |
393 | long div = 1024 / blockSize; | 393 | long div = 1024 / blockSize; |
394 | 394 | ||
395 | if ( !mult ) mult = 1; | 395 | if ( !mult ) mult = 1; |
396 | if ( !div ) div = 1; | 396 | if ( !div ) div = 1; |
397 | long avail = availBlocks * mult / div; | 397 | long avail = availBlocks * mult / div; |
398 | 398 | ||
399 | space = tr( "%1 Kb" ).arg( avail ); | 399 | space = tr( "%1 Kb" ).arg( avail ); |
400 | } | 400 | } |
401 | else | 401 | else |
402 | space = tr( "Unknown" ); | 402 | space = tr( "Unknown" ); |
403 | 403 | ||
404 | if ( txtAvailableSpace ) | 404 | if ( txtAvailableSpace ) |
405 | txtAvailableSpace->setText( space ); | 405 | txtAvailableSpace->setText( space ); |
406 | } | 406 | } |
407 | 407 | ||
408 | void InstallDlgImpl :: ipkgFinished() | 408 | void InstallDlgImpl :: ipkgFinished() |
409 | { | 409 | { |
410 | InstallData *item; | 410 | InstallData *item; |
411 | if ( firstPackage ) | 411 | if ( firstPackage ) |
412 | item = packages.first(); | 412 | item = packages.first(); |
413 | else | 413 | else |
414 | { | 414 | { |
415 | // Create symlinks if necessary before moving on to next package | 415 | // Create symlinks if necessary before moving on to next package |
416 | pIpkg->createSymLinks(); | 416 | pIpkg->createSymLinks(); |
417 | 417 | ||
418 | item = packages.next(); | 418 | item = packages.next(); |
419 | } | 419 | } |
420 | 420 | ||
421 | firstPackage = FALSE; | 421 | firstPackage = FALSE; |
422 | if ( item ) | 422 | if ( item ) |
423 | { | 423 | { |
424 | pIpkg->setPackage( item->packageName ); | 424 | pIpkg->setPackage( item->packageName ); |
425 | int tmpFlags = flags; | 425 | int tmpFlags = flags; |
426 | 426 | ||
427 | if ( item->option == "I" ) | 427 | if ( item->option == "I" ) |
428 | { | 428 | { |
429 | pIpkg->setOption( "install" ); | 429 | pIpkg->setOption( "install" ); |
430 | Destination *d = dataMgr->getDestination( destination->currentText() ); | 430 | Destination *d = dataMgr->getDestination( destination->currentText() ); |
431 | pIpkg->setDestination( d->getDestinationName() ); | 431 | pIpkg->setDestination( d->getDestinationName() ); |
432 | pIpkg->setDestinationDir( d->getDestinationPath() ); | 432 | pIpkg->setDestinationDir( d->getDestinationPath() ); |
433 | 433 | ||
434 | if ( d->linkToRoot() ) | 434 | if ( d->linkToRoot() ) |
435 | tmpFlags |= MAKE_LINKS; | 435 | tmpFlags |= MAKE_LINKS; |
436 | } | 436 | } |
437 | else if ( item->option == "D" ) | 437 | else if ( item->option == "D" ) |
438 | { | 438 | { |
439 | pIpkg->setOption( "remove" ); | 439 | pIpkg->setOption( "remove" ); |
440 | pIpkg->setDestination( item->destination->getDestinationName() ); | 440 | pIpkg->setDestination( item->destination->getDestinationName() ); |
441 | pIpkg->setDestinationDir( item->destination->getDestinationPath() ); | 441 | pIpkg->setDestinationDir( item->destination->getDestinationPath() ); |
442 | 442 | ||
443 | if ( item->destination->linkToRoot() ) | 443 | if ( item->destination->linkToRoot() ) |
444 | tmpFlags |= MAKE_LINKS; | 444 | tmpFlags |= MAKE_LINKS; |
445 | } | 445 | } |
446 | else | 446 | else |
447 | { | 447 | { |
448 | if ( item->option == "R" ) | 448 | if ( item->option == "R" ) |
449 | pIpkg->setOption( "reinstall" ); | 449 | pIpkg->setOption( "reinstall" ); |
450 | else | 450 | else |
451 | pIpkg->setOption( "upgrade" ); | 451 | pIpkg->setOption( "upgrade" ); |
452 | 452 | ||
453 | pIpkg->setDestination( item->destination->getDestinationName() ); | 453 | pIpkg->setDestination( item->destination->getDestinationName() ); |
454 | pIpkg->setDestinationDir( item->destination->getDestinationPath() ); | 454 | pIpkg->setDestinationDir( item->destination->getDestinationPath() ); |
455 | pIpkg->setPackage( item->packageName ); | 455 | pIpkg->setPackage( item->packageName ); |
456 | 456 | ||
457 | tmpFlags |= FORCE_REINSTALL; | 457 | tmpFlags |= FORCE_REINSTALL; |
458 | if ( item->destination->linkToRoot() && item->recreateLinks ) | 458 | if ( item->destination->linkToRoot() && item->recreateLinks ) |
459 | tmpFlags |= MAKE_LINKS; | 459 | tmpFlags |= MAKE_LINKS; |
460 | } | 460 | } |
461 | pIpkg->setFlags( tmpFlags, infoLevel ); | 461 | pIpkg->setFlags( tmpFlags, infoLevel ); |
462 | pIpkg->runIpkg(); | 462 | pIpkg->runIpkg(); |
463 | } | 463 | } |
464 | else | 464 | else |
465 | { | 465 | { |
466 | btnOptions->setEnabled( true ); | 466 | btnOptions->setEnabled( true ); |
467 | btnInstall->setText( tr( "Close" ) ); | 467 | btnInstall->setText( tr( "Close" ) ); |
468 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); | 468 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); |
469 | 469 | ||
470 | btnOptions->setText( tr( "Save output" ) ); | 470 | btnOptions->setText( tr( "Save output" ) ); |
471 | btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); | 471 | btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); |
472 | 472 | ||
473 | if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) | 473 | if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) |
474 | displayAvailableSpace( destination->currentText() ); | 474 | displayAvailableSpace( destination->currentText() ); |
475 | } | 475 | } |
476 | } | 476 | } |
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp index 2a9c576..3761b67 100644 --- a/noncore/settings/aqpkg/ipkg.cpp +++ b/noncore/settings/aqpkg/ipkg.cpp | |||
@@ -1,520 +1,520 @@ | |||
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 <opie2/oprocess.h> | ||
31 | |||
30 | #ifdef QWS | 32 | #ifdef QWS |
31 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
32 | #else | 34 | #else |
33 | #include <qapplication.h> | 35 | #include <qapplication.h> |
34 | #endif | 36 | #endif |
35 | #include <qdir.h> | 37 | #include <qdir.h> |
36 | #include <qfile.h> | 38 | #include <qfile.h> |
37 | #include <qtextstream.h> | 39 | #include <qtextstream.h> |
38 | 40 | ||
39 | #include <opie/oprocess.h> | ||
40 | |||
41 | #include "utils.h" | 41 | #include "utils.h" |
42 | #include "ipkg.h" | 42 | #include "ipkg.h" |
43 | #include "global.h" | 43 | #include "global.h" |
44 | 44 | ||
45 | Ipkg :: Ipkg() | 45 | Ipkg :: Ipkg() |
46 | { | 46 | { |
47 | proc = 0; | 47 | proc = 0; |
48 | } | 48 | } |
49 | 49 | ||
50 | Ipkg :: ~Ipkg() | 50 | Ipkg :: ~Ipkg() |
51 | { | 51 | { |
52 | } | 52 | } |
53 | 53 | ||
54 | // Option is what we are going to do - install, upgrade, download, reinstall | 54 | // Option is what we are going to do - install, upgrade, download, reinstall |
55 | // package is the package name to install - either a fully qualified path and ipk | 55 | // package is the package name to install - either a fully qualified path and ipk |
56 | // file (if stored locally) or just the name of the package (for a network package) | 56 | // file (if stored locally) or just the name of the package (for a network package) |
57 | // packageName is the package name - (for a network package this will be the same as | 57 | // packageName is the package name - (for a network package this will be the same as |
58 | // package parameter) | 58 | // package parameter) |
59 | // dest is the destination alias (from ipk.conf) | 59 | // dest is the destination alias (from ipk.conf) |
60 | // destDir is the dir that the destination alias points to (used to link to root) | 60 | // destDir is the dir that the destination alias points to (used to link to root) |
61 | // flags is the ipkg options flags | 61 | // flags is the ipkg options flags |
62 | // dir is the directory to run ipkg in (defaults to "") | 62 | // dir is the directory to run ipkg in (defaults to "") |
63 | void Ipkg :: runIpkg() | 63 | void Ipkg :: runIpkg() |
64 | { | 64 | { |
65 | error = false; | 65 | error = false; |
66 | QStringList commands; | 66 | QStringList commands; |
67 | 67 | ||
68 | QDir::setCurrent( "/tmp" ); | 68 | QDir::setCurrent( "/tmp" ); |
69 | 69 | ||
70 | if ( runtimeDir != "" ) | 70 | if ( runtimeDir != "" ) |
71 | { | 71 | { |
72 | commands << "cd "; | 72 | commands << "cd "; |
73 | commands << runtimeDir; | 73 | commands << runtimeDir; |
74 | commands << ";"; | 74 | commands << ";"; |
75 | } | 75 | } |
76 | commands << "ipkg" << "-V" << QString::number( infoLevel ) << "-force-defaults"; | 76 | commands << "ipkg" << "-V" << QString::number( infoLevel ) << "-force-defaults"; |
77 | 77 | ||
78 | // only set the destination for an install operation | 78 | // only set the destination for an install operation |
79 | if ( option == "install" ) | 79 | if ( option == "install" ) |
80 | commands << "-dest" << destination; | 80 | commands << "-dest" << destination; |
81 | 81 | ||
82 | 82 | ||
83 | if ( option != "update" && option != "download" ) | 83 | if ( option != "update" && option != "download" ) |
84 | { | 84 | { |
85 | if ( flags & FORCE_DEPENDS ) | 85 | if ( flags & FORCE_DEPENDS ) |
86 | commands << "-force-depends"; | 86 | commands << "-force-depends"; |
87 | if ( flags & FORCE_REINSTALL ) | 87 | if ( flags & FORCE_REINSTALL ) |
88 | commands << "-force-reinstall"; | 88 | commands << "-force-reinstall"; |
89 | if ( flags & FORCE_REMOVE ) | 89 | if ( flags & FORCE_REMOVE ) |
90 | commands << "-force-removal-of-essential-packages"; | 90 | commands << "-force-removal-of-essential-packages"; |
91 | if ( flags & FORCE_OVERWRITE ) | 91 | if ( flags & FORCE_OVERWRITE ) |
92 | commands << "-force-overwrite"; | 92 | commands << "-force-overwrite"; |
93 | if ( infoLevel == 3 ) | 93 | if ( infoLevel == 3 ) |
94 | commands << "-verbose_wget"; | 94 | commands << "-verbose_wget"; |
95 | 95 | ||
96 | // Handle make links | 96 | // Handle make links |
97 | // Rules - If make links is switched on, create links to root | 97 | // Rules - If make links is switched on, create links to root |
98 | // if destDir is NOT / | 98 | // if destDir is NOT / |
99 | if ( flags & MAKE_LINKS ) | 99 | if ( flags & MAKE_LINKS ) |
100 | { | 100 | { |
101 | // If destDir == / turn off make links as package is being insalled | 101 | // If destDir == / turn off make links as package is being insalled |
102 | // to root already. | 102 | // to root already. |
103 | if ( destDir == "/" ) | 103 | if ( destDir == "/" ) |
104 | flags ^= MAKE_LINKS; | 104 | flags ^= MAKE_LINKS; |
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | #ifdef X86 | 108 | #ifdef X86 |
109 | commands << "-f"; | 109 | commands << "-f"; |
110 | commands << IPKG_CONF; | 110 | commands << IPKG_CONF; |
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | 113 | ||
114 | if ( option == "reinstall" ) | 114 | if ( option == "reinstall" ) |
115 | commands << "install"; | 115 | commands << "install"; |
116 | else | 116 | else |
117 | commands << option; | 117 | commands << option; |
118 | if ( package != "" ) | 118 | if ( package != "" ) |
119 | commands << package; | 119 | commands << package; |
120 | 120 | ||
121 | 121 | ||
122 | if ( package != "" ) | 122 | if ( package != "" ) |
123 | emit outputText( tr( "Dealing with package %1" ).arg( package) ); | 123 | emit outputText( tr( "Dealing with package %1" ).arg( package) ); |
124 | 124 | ||
125 | qApp->processEvents(); | 125 | qApp->processEvents(); |
126 | 126 | ||
127 | // If we are removing, reinstalling or upgrading packages and make links option is selected | 127 | // If we are removing, reinstalling or upgrading packages and make links option is selected |
128 | // create the links | 128 | // create the links |
129 | if ( option == "remove" || option == "reinstall" || option == "upgrade" ) | 129 | if ( option == "remove" || option == "reinstall" || option == "upgrade" ) |
130 | { | 130 | { |
131 | createLinks = false; | 131 | createLinks = false; |
132 | if ( flags & MAKE_LINKS ) | 132 | if ( flags & MAKE_LINKS ) |
133 | { | 133 | { |
134 | emit outputText( tr( "Removing symbolic links...\n" ) ); | 134 | emit outputText( tr( "Removing symbolic links...\n" ) ); |
135 | linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); | 135 | linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); |
136 | emit outputText( QString( " " ) ); | 136 | emit outputText( QString( " " ) ); |
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | // Execute command | 140 | // Execute command |
141 | dependantPackages = new QList<QString>; | 141 | dependantPackages = new QList<QString>; |
142 | dependantPackages->setAutoDelete( true ); | 142 | dependantPackages->setAutoDelete( true ); |
143 | 143 | ||
144 | executeIpkgCommand( commands, option ); | 144 | executeIpkgCommand( commands, option ); |
145 | 145 | ||
146 | } | 146 | } |
147 | 147 | ||
148 | void Ipkg :: createSymLinks() | 148 | void Ipkg :: createSymLinks() |
149 | { | 149 | { |
150 | if ( option == "install" || option == "reinstall" || option == "upgrade" ) | 150 | if ( option == "install" || option == "reinstall" || option == "upgrade" ) |
151 | { | 151 | { |
152 | // If we are not removing packages and make links option is selected | 152 | // If we are not removing packages and make links option is selected |
153 | // create the links | 153 | // create the links |
154 | createLinks = true; | 154 | createLinks = true; |
155 | if ( flags & MAKE_LINKS ) | 155 | if ( flags & MAKE_LINKS ) |
156 | { | 156 | { |
157 | emit outputText( " " ); | 157 | emit outputText( " " ); |
158 | emit outputText( tr( "Creating symbolic links for %1." ).arg( package) ); | 158 | emit outputText( tr( "Creating symbolic links for %1." ).arg( package) ); |
159 | 159 | ||
160 | linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); | 160 | linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); |
161 | 161 | ||
162 | // link dependant packages that were installed with this release | 162 | // link dependant packages that were installed with this release |
163 | QString *pkg; | 163 | QString *pkg; |
164 | for ( pkg = dependantPackages->first(); pkg != 0; pkg = dependantPackages->next() ) | 164 | for ( pkg = dependantPackages->first(); pkg != 0; pkg = dependantPackages->next() ) |
165 | { | 165 | { |
166 | if ( *pkg == package ) | 166 | if ( *pkg == package ) |
167 | continue; | 167 | continue; |
168 | emit outputText( " " ); | 168 | emit outputText( " " ); |
169 | emit outputText( tr( "Creating symbolic links for %1" ).arg( *pkg ) ); | 169 | emit outputText( tr( "Creating symbolic links for %1" ).arg( *pkg ) ); |
170 | linkPackage( Utils::getPackageNameFromIpkFilename( *pkg ), destination, destDir ); | 170 | linkPackage( Utils::getPackageNameFromIpkFilename( *pkg ), destination, destDir ); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | delete dependantPackages; | 175 | delete dependantPackages; |
176 | 176 | ||
177 | emit outputText( tr("Finished") ); | 177 | emit outputText( tr("Finished") ); |
178 | emit outputText( "" ); | 178 | emit outputText( "" ); |
179 | } | 179 | } |
180 | 180 | ||
181 | void Ipkg :: removeStatusEntry() | 181 | void Ipkg :: removeStatusEntry() |
182 | { | 182 | { |
183 | QString statusFile = destDir; | 183 | QString statusFile = destDir; |
184 | if ( statusFile.right( 1 ) != "/" ) | 184 | if ( statusFile.right( 1 ) != "/" ) |
185 | statusFile.append( "/" ); | 185 | statusFile.append( "/" ); |
186 | statusFile.append( "usr/lib/ipkg/status" ); | 186 | statusFile.append( "usr/lib/ipkg/status" ); |
187 | QString outStatusFile = statusFile; | 187 | QString outStatusFile = statusFile; |
188 | outStatusFile.append( ".tmp" ); | 188 | outStatusFile.append( ".tmp" ); |
189 | 189 | ||
190 | emit outputText( "" ); | 190 | emit outputText( "" ); |
191 | emit outputText( tr("Removing status entry...") ); | 191 | emit outputText( tr("Removing status entry...") ); |
192 | QString tempstr = tr("status file - "); | 192 | QString tempstr = tr("status file - "); |
193 | tempstr.append( statusFile ); | 193 | tempstr.append( statusFile ); |
194 | emit outputText( tempstr ); | 194 | emit outputText( tempstr ); |
195 | tempstr = tr("package - "); | 195 | tempstr = tr("package - "); |
196 | tempstr.append( package ); | 196 | tempstr.append( package ); |
197 | emit outputText( tempstr ); | 197 | emit outputText( tempstr ); |
198 | 198 | ||
199 | QFile readFile( statusFile ); | 199 | QFile readFile( statusFile ); |
200 | QFile writeFile( outStatusFile ); | 200 | QFile writeFile( outStatusFile ); |
201 | 201 | ||
202 | if ( !readFile.open( IO_ReadOnly ) ) | 202 | if ( !readFile.open( IO_ReadOnly ) ) |
203 | { | 203 | { |
204 | tempstr = tr("Couldn't open status file - "); | 204 | tempstr = tr("Couldn't open status file - "); |
205 | tempstr.append( statusFile ); | 205 | tempstr.append( statusFile ); |
206 | emit outputText( tempstr ); | 206 | emit outputText( tempstr ); |
207 | return; | 207 | return; |
208 | } | 208 | } |
209 | 209 | ||
210 | if ( !writeFile.open( IO_WriteOnly ) ) | 210 | if ( !writeFile.open( IO_WriteOnly ) ) |
211 | { | 211 | { |
212 | tempstr = tr("Couldn't create tempory status file - "); | 212 | tempstr = tr("Couldn't create tempory status file - "); |
213 | tempstr.append( outStatusFile ); | 213 | tempstr.append( outStatusFile ); |
214 | emit outputText( tempstr ); | 214 | emit outputText( tempstr ); |
215 | return; | 215 | return; |
216 | } | 216 | } |
217 | 217 | ||
218 | int i = 0; | 218 | int i = 0; |
219 | 219 | ||
220 | QTextStream readStream( &readFile ); | 220 | QTextStream readStream( &readFile ); |
221 | QTextStream writeStream( &writeFile ); | 221 | QTextStream writeStream( &writeFile ); |
222 | QString line; | 222 | QString line; |
223 | 223 | ||
224 | char k[21]; | 224 | char k[21]; |
225 | char v[1001]; | 225 | char v[1001]; |
226 | QString key; | 226 | QString key; |
227 | QString value; | 227 | QString value; |
228 | 228 | ||
229 | while ( !readStream.atEnd() ) | 229 | while ( !readStream.atEnd() ) |
230 | { | 230 | { |
231 | //read new line | 231 | //read new line |
232 | line = readStream.readLine(); | 232 | line = readStream.readLine(); |
233 | 233 | ||
234 | if ( line.contains( ":", TRUE ) ) | 234 | if ( line.contains( ":", TRUE ) ) |
235 | { | 235 | { |
236 | //grep key and value from line | 236 | //grep key and value from line |
237 | k[0] = '\0'; | 237 | k[0] = '\0'; |
238 | v[0] = '\0'; | 238 | v[0] = '\0'; |
239 | sscanf( line, "%[^:]: %[^\n]", k, v ); | 239 | sscanf( line, "%[^:]: %[^\n]", k, v ); |
240 | key = k; | 240 | key = k; |
241 | value = v; | 241 | value = v; |
242 | key = key.stripWhiteSpace(); | 242 | key = key.stripWhiteSpace(); |
243 | value = value.stripWhiteSpace(); | 243 | value = value.stripWhiteSpace(); |
244 | } else { | 244 | } else { |
245 | key = ""; | 245 | key = ""; |
246 | value = ""; | 246 | value = ""; |
247 | } | 247 | } |
248 | 248 | ||
249 | if ( key == "Package" && value == package ) | 249 | if ( key == "Package" && value == package ) |
250 | { | 250 | { |
251 | //skip lines from the deleted package | 251 | //skip lines from the deleted package |
252 | while ( ( !readStream.atEnd() ) && ( line.stripWhiteSpace() != "" ) ) | 252 | while ( ( !readStream.atEnd() ) && ( line.stripWhiteSpace() != "" ) ) |
253 | { | 253 | { |
254 | line = readStream.readLine(); | 254 | line = readStream.readLine(); |
255 | } | 255 | } |
256 | } else { | 256 | } else { |
257 | 257 | ||
258 | //write other lines into the tempfile | 258 | //write other lines into the tempfile |
259 | writeStream << line << "\n"; | 259 | writeStream << line << "\n"; |
260 | 260 | ||
261 | // Improve UI responsiveness | 261 | // Improve UI responsiveness |
262 | i++; | 262 | i++; |
263 | if ( ( i % 50 ) == 0 ) | 263 | if ( ( i % 50 ) == 0 ) |
264 | qApp->processEvents(); | 264 | qApp->processEvents(); |
265 | } | 265 | } |
266 | } | 266 | } |
267 | 267 | ||
268 | readFile.close(); | 268 | readFile.close(); |
269 | writeFile.close(); | 269 | writeFile.close(); |
270 | 270 | ||
271 | // Remove old status file and put tmp stats file in its place | 271 | // Remove old status file and put tmp stats file in its place |
272 | remove( statusFile ); | 272 | remove( statusFile ); |
273 | rename( outStatusFile, statusFile ); | 273 | rename( outStatusFile, statusFile ); |
274 | } | 274 | } |
275 | 275 | ||
276 | int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ ) | 276 | int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ ) |
277 | { | 277 | { |
278 | // If one is already running - should never be but just to be safe | 278 | // If one is already running - should never be but just to be safe |
279 | if ( proc ) | 279 | if ( proc ) |
280 | { | 280 | { |
281 | delete proc; | 281 | delete proc; |
282 | proc = 0; | 282 | proc = 0; |
283 | } | 283 | } |
284 | 284 | ||
285 | // OK we're gonna use OProcess to run this thing | 285 | // OK we're gonna use OProcess to run this thing |
286 | proc = new OProcess(); | 286 | proc = new OProcess(); |
287 | aborted = false; | 287 | aborted = false; |
288 | 288 | ||
289 | 289 | ||
290 | // Connect up our slots | 290 | // Connect up our slots |
291 | connect(proc, SIGNAL(processExited(OProcess *)), | 291 | connect(proc, SIGNAL(processExited(OProcess *)), |
292 | this, SLOT( processFinished())); | 292 | this, SLOT( processFinished())); |
293 | 293 | ||
294 | connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), | 294 | connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), |
295 | this, SLOT(commandStdout(OProcess *, char *, int))); | 295 | this, SLOT(commandStdout(OProcess *, char *, int))); |
296 | 296 | ||
297 | connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), | 297 | connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), |
298 | this, SLOT(commandStderr(OProcess *, char *, int))); | 298 | this, SLOT(commandStderr(OProcess *, char *, int))); |
299 | 299 | ||
300 | for ( QStringList::Iterator it = cmd.begin(); it != cmd.end(); ++it ) | 300 | for ( QStringList::Iterator it = cmd.begin(); it != cmd.end(); ++it ) |
301 | { | 301 | { |
302 | *proc << (*it).latin1(); | 302 | *proc << (*it).latin1(); |
303 | } | 303 | } |
304 | 304 | ||
305 | // Start the process going | 305 | // Start the process going |
306 | finished = false; | 306 | finished = false; |
307 | if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) | 307 | if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) |
308 | { | 308 | { |
309 | emit outputText( tr("Couldn't start ipkg process" ) ); | 309 | emit outputText( tr("Couldn't start ipkg process" ) ); |
310 | } | 310 | } |
311 | } | 311 | } |
312 | 312 | ||
313 | void Ipkg::commandStdout(OProcess*, char *buffer, int buflen) | 313 | void Ipkg::commandStdout(OProcess*, char *buffer, int buflen) |
314 | { | 314 | { |
315 | QString lineStr = buffer; | 315 | QString lineStr = buffer; |
316 | if ( lineStr[buflen-1] == '\n' ) | 316 | if ( lineStr[buflen-1] == '\n' ) |
317 | buflen --; | 317 | buflen --; |
318 | lineStr = lineStr.left( buflen ); | 318 | lineStr = lineStr.left( buflen ); |
319 | emit outputText( lineStr ); | 319 | emit outputText( lineStr ); |
320 | 320 | ||
321 | // check if we are installing dependant packages | 321 | // check if we are installing dependant packages |
322 | if ( option == "install" || option == "reinstall" ) | 322 | if ( option == "install" || option == "reinstall" ) |
323 | { | 323 | { |
324 | // Need to keep track of any dependant packages that get installed | 324 | // Need to keep track of any dependant packages that get installed |
325 | // so that we can create links to them as necessary | 325 | // so that we can create links to them as necessary |
326 | if ( lineStr.startsWith( "Installing " ) ) | 326 | if ( lineStr.startsWith( "Installing " ) ) |
327 | { | 327 | { |
328 | int start = lineStr.find( " " ) + 1; | 328 | int start = lineStr.find( " " ) + 1; |
329 | int end = lineStr.find( " ", start ); | 329 | int end = lineStr.find( " ", start ); |
330 | QString *package = new QString( lineStr.mid( start, end-start ) ); | 330 | QString *package = new QString( lineStr.mid( start, end-start ) ); |
331 | dependantPackages->append( package ); | 331 | dependantPackages->append( package ); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | else if ( option == "remove" && !( flags & FORCE_DEPENDS ) && | 334 | else if ( option == "remove" && !( flags & FORCE_DEPENDS ) && |
335 | lineStr.find( "is depended upon by packages:" ) != -1 ) | 335 | lineStr.find( "is depended upon by packages:" ) != -1 ) |
336 | { | 336 | { |
337 | // Ipkg should send this to STDERR, but doesn't - so trap here | 337 | // Ipkg should send this to STDERR, but doesn't - so trap here |
338 | error = true; | 338 | error = true; |
339 | } | 339 | } |
340 | 340 | ||
341 | buffer[0] = '\0'; | 341 | buffer[0] = '\0'; |
342 | } | 342 | } |
343 | 343 | ||
344 | void Ipkg::commandStderr(OProcess*, char *buffer, int buflen) | 344 | void Ipkg::commandStderr(OProcess*, char *buffer, int buflen) |
345 | { | 345 | { |
346 | QString lineStr = buffer; | 346 | QString lineStr = buffer; |
347 | if ( lineStr[buflen-1] == '\n' ) | 347 | if ( lineStr[buflen-1] == '\n' ) |
348 | buflen --; | 348 | buflen --; |
349 | lineStr=lineStr.left( buflen ); | 349 | lineStr=lineStr.left( buflen ); |
350 | emit outputText( lineStr ); | 350 | emit outputText( lineStr ); |
351 | buffer[0] = '\0'; | 351 | buffer[0] = '\0'; |
352 | error = true; | 352 | error = true; |
353 | } | 353 | } |
354 | 354 | ||
355 | void Ipkg::processFinished() | 355 | void Ipkg::processFinished() |
356 | { | 356 | { |
357 | // Finally, if we are removing a package, remove its entry from the <destdir>/usr/lib/ipkg/status file | 357 | // Finally, if we are removing a package, remove its entry from the <destdir>/usr/lib/ipkg/status file |
358 | // to workaround an ipkg bug which stops reinstall to a different location | 358 | // to workaround an ipkg bug which stops reinstall to a different location |
359 | 359 | ||
360 | if ( !error && option == "remove" ) | 360 | if ( !error && option == "remove" ) |
361 | removeStatusEntry(); | 361 | removeStatusEntry(); |
362 | 362 | ||
363 | delete proc; | 363 | delete proc; |
364 | proc = 0; | 364 | proc = 0; |
365 | finished = true; | 365 | finished = true; |
366 | 366 | ||
367 | emit ipkgFinished(); | 367 | emit ipkgFinished(); |
368 | } | 368 | } |
369 | 369 | ||
370 | 370 | ||
371 | void Ipkg :: abort() | 371 | void Ipkg :: abort() |
372 | { | 372 | { |
373 | if ( proc ) | 373 | if ( proc ) |
374 | { | 374 | { |
375 | proc->kill(); | 375 | proc->kill(); |
376 | aborted = true; | 376 | aborted = true; |
377 | } | 377 | } |
378 | } | 378 | } |
379 | 379 | ||
380 | void Ipkg :: linkPackage( const QString &packFileName, const QString &dest, const QString &destDir ) | 380 | void Ipkg :: linkPackage( const QString &packFileName, const QString &dest, const QString &destDir ) |
381 | { | 381 | { |
382 | if ( dest == "root" || dest == "/" ) | 382 | if ( dest == "root" || dest == "/" ) |
383 | return; | 383 | return; |
384 | 384 | ||
385 | qApp->processEvents(); | 385 | qApp->processEvents(); |
386 | QStringList *fileList = getList( packFileName, destDir ); | 386 | QStringList *fileList = getList( packFileName, destDir ); |
387 | qApp->processEvents(); | 387 | qApp->processEvents(); |
388 | processFileList( fileList, destDir ); | 388 | processFileList( fileList, destDir ); |
389 | delete fileList; | 389 | delete fileList; |
390 | } | 390 | } |
391 | 391 | ||
392 | QStringList* Ipkg :: getList( const QString &packageFilename, const QString &destDir ) | 392 | QStringList* Ipkg :: getList( const QString &packageFilename, const QString &destDir ) |
393 | { | 393 | { |
394 | QString packageFileDir = destDir; | 394 | QString packageFileDir = destDir; |
395 | packageFileDir.append( "/usr/lib/ipkg/info/" ); | 395 | packageFileDir.append( "/usr/lib/ipkg/info/" ); |
396 | packageFileDir.append( packageFilename ); | 396 | packageFileDir.append( packageFilename ); |
397 | packageFileDir.append( ".list" ); | 397 | packageFileDir.append( ".list" ); |
398 | QFile f( packageFileDir ); | 398 | QFile f( packageFileDir ); |
399 | 399 | ||
400 | if ( !f.open(IO_ReadOnly) ) | 400 | if ( !f.open(IO_ReadOnly) ) |
401 | { | 401 | { |
402 | // Couldn't open from dest, try from / | 402 | // Couldn't open from dest, try from / |
403 | f.close(); | 403 | f.close(); |
404 | 404 | ||
405 | packageFileDir = "/usr/lib/ipkg/info/"; | 405 | packageFileDir = "/usr/lib/ipkg/info/"; |
406 | packageFileDir.append( packageFilename ); | 406 | packageFileDir.append( packageFilename ); |
407 | packageFileDir.append( ".list" ); | 407 | packageFileDir.append( ".list" ); |
408 | f.setName( packageFileDir ); | 408 | f.setName( packageFileDir ); |
409 | if ( ! f.open(IO_ReadOnly) ) | 409 | if ( ! f.open(IO_ReadOnly) ) |
410 | { | 410 | { |
411 | QString tempstr = tr("Could not open :"); | 411 | QString tempstr = tr("Could not open :"); |
412 | tempstr.append( packageFileDir ); | 412 | tempstr.append( packageFileDir ); |
413 | emit outputText( tempstr ); | 413 | emit outputText( tempstr ); |
414 | return (QStringList*)0; | 414 | return (QStringList*)0; |
415 | } | 415 | } |
416 | } | 416 | } |
417 | QStringList *fileList = new QStringList(); | 417 | QStringList *fileList = new QStringList(); |
418 | QTextStream t( &f ); | 418 | QTextStream t( &f ); |
419 | while ( !t.eof() ) | 419 | while ( !t.eof() ) |
420 | *fileList += t.readLine(); | 420 | *fileList += t.readLine(); |
421 | 421 | ||
422 | f.close(); | 422 | f.close(); |
423 | return fileList; | 423 | return fileList; |
424 | } | 424 | } |
425 | 425 | ||
426 | void Ipkg :: processFileList( const QStringList *fileList, const QString &destDir ) | 426 | void Ipkg :: processFileList( const QStringList *fileList, const QString &destDir ) |
427 | { | 427 | { |
428 | if ( !fileList || fileList->isEmpty() ) | 428 | if ( !fileList || fileList->isEmpty() ) |
429 | return; | 429 | return; |
430 | 430 | ||
431 | QString baseDir = ROOT; | 431 | QString baseDir = ROOT; |
432 | 432 | ||
433 | if ( createLinks == true ) | 433 | if ( createLinks == true ) |
434 | { | 434 | { |
435 | for ( uint i=0; i < fileList->count(); i++ ) | 435 | for ( uint i=0; i < fileList->count(); i++ ) |
436 | { | 436 | { |
437 | processLinkDir( (*fileList)[i], baseDir, destDir ); | 437 | processLinkDir( (*fileList)[i], baseDir, destDir ); |
438 | qApp->processEvents(); | 438 | qApp->processEvents(); |
439 | } | 439 | } |
440 | } | 440 | } |
441 | else | 441 | else |
442 | { | 442 | { |
443 | for ( int i = fileList->count()-1; i >= 0 ; i-- ) | 443 | for ( int i = fileList->count()-1; i >= 0 ; i-- ) |
444 | { | 444 | { |
445 | processLinkDir( (*fileList)[i], baseDir, destDir ); | 445 | processLinkDir( (*fileList)[i], baseDir, destDir ); |
446 | qApp->processEvents(); | 446 | qApp->processEvents(); |
447 | } | 447 | } |
448 | } | 448 | } |
449 | } | 449 | } |
450 | 450 | ||
451 | void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const QString &baseDir ) | 451 | void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const QString &baseDir ) |
452 | { | 452 | { |
453 | 453 | ||
454 | QString sourceFile = baseDir; | 454 | QString sourceFile = baseDir; |
455 | sourceFile.append( file ); | 455 | sourceFile.append( file ); |
456 | 456 | ||
457 | QString linkFile = destDir; | 457 | QString linkFile = destDir; |
458 | if ( file.startsWith( "/" ) && destDir.right( 1 ) == "/" ) | 458 | if ( file.startsWith( "/" ) && destDir.right( 1 ) == "/" ) |
459 | { | 459 | { |
460 | linkFile.append( file.mid( 1 ) ); | 460 | linkFile.append( file.mid( 1 ) ); |
461 | } | 461 | } |
462 | else | 462 | else |
463 | { | 463 | { |
464 | linkFile.append( file ); | 464 | linkFile.append( file ); |
465 | } | 465 | } |
466 | QString text; | 466 | QString text; |
467 | if ( createLinks ) | 467 | if ( createLinks ) |
468 | { | 468 | { |
469 | // If this file is a directory (ends with a /) and it doesn't exist, | 469 | // If this file is a directory (ends with a /) and it doesn't exist, |
470 | // we need to create it | 470 | // we need to create it |
471 | if ( file.right(1) == "/" ) | 471 | if ( file.right(1) == "/" ) |
472 | { | 472 | { |
473 | QFileInfo f( linkFile ); | 473 | QFileInfo f( linkFile ); |
474 | if ( !f.exists() ) | 474 | if ( !f.exists() ) |
475 | { | 475 | { |
476 | QString tempstr = tr("Creating directory "); | 476 | QString tempstr = tr("Creating directory "); |
477 | tempstr.append( linkFile ); | 477 | tempstr.append( linkFile ); |
478 | emit outputText( tempstr ); | 478 | emit outputText( tempstr ); |
479 | QDir d; | 479 | QDir d; |
480 | d.mkdir( linkFile, true ); | 480 | d.mkdir( linkFile, true ); |
481 | } | 481 | } |
482 | // else | 482 | // else |
483 | // emit outputText( QString( "Directory " ) + linkFile + " already exists" ); | 483 | // emit outputText( QString( "Directory " ) + linkFile + " already exists" ); |
484 | 484 | ||
485 | } | 485 | } |
486 | else | 486 | else |
487 | { | 487 | { |
488 | int rc = symlink( sourceFile, linkFile ); | 488 | int rc = symlink( sourceFile, linkFile ); |
489 | text = ( rc == 0 ? tr( "Linked %1 to %2" ) : tr( "Failed to link %1 to %2" ) ). | 489 | text = ( rc == 0 ? tr( "Linked %1 to %2" ) : tr( "Failed to link %1 to %2" ) ). |
490 | arg( sourceFile ). | 490 | arg( sourceFile ). |
491 | arg( linkFile ); | 491 | arg( linkFile ); |
492 | emit outputText( text ); | 492 | emit outputText( text ); |
493 | } | 493 | } |
494 | } | 494 | } |
495 | else | 495 | else |
496 | { | 496 | { |
497 | QFileInfo f( linkFile ); | 497 | QFileInfo f( linkFile ); |
498 | if ( f.exists() ) | 498 | if ( f.exists() ) |
499 | { | 499 | { |
500 | if ( f.isFile() ) | 500 | if ( f.isFile() ) |
501 | { | 501 | { |
502 | QFile f( linkFile ); | 502 | QFile f( linkFile ); |
503 | bool rc = f.remove(); | 503 | bool rc = f.remove(); |
504 | 504 | ||
505 | text = ( rc ? tr( "Removed %1" ) : tr( "Failed to remove %1" ) ).arg( linkFile ); | 505 | text = ( rc ? tr( "Removed %1" ) : tr( "Failed to remove %1" ) ).arg( linkFile ); |
506 | emit outputText( text ); | 506 | emit outputText( text ); |
507 | } | 507 | } |
508 | else if ( f.isDir() ) | 508 | else if ( f.isDir() ) |
509 | { | 509 | { |
510 | QDir d; | 510 | QDir d; |
511 | bool rc = d.rmdir( linkFile, true ); | 511 | bool rc = d.rmdir( linkFile, true ); |
512 | if ( rc ) | 512 | if ( rc ) |
513 | { | 513 | { |
514 | text = ( rc ? tr( "Removed " ) : tr( "Failed to remove " ) ).arg( linkFile ); | 514 | text = ( rc ? tr( "Removed " ) : tr( "Failed to remove " ) ).arg( linkFile ); |
515 | emit outputText( text ); | 515 | emit outputText( text ); |
516 | } | 516 | } |
517 | } | 517 | } |
518 | } | 518 | } |
519 | } | 519 | } |
520 | } | 520 | } |
diff --git a/noncore/settings/aqpkg/ipkg.h b/noncore/settings/aqpkg/ipkg.h index 8f254f9..f892038 100644 --- a/noncore/settings/aqpkg/ipkg.h +++ b/noncore/settings/aqpkg/ipkg.h | |||
@@ -1,104 +1,104 @@ | |||
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 | #ifndef IPKG_H | 30 | #ifndef IPKG_H |
31 | #define IPKG_H | 31 | #define IPKG_H |
32 | 32 | ||
33 | 33 | ||
34 | /** | 34 | /** |
35 | *@author Andy Qua | 35 | *@author Andy Qua |
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include <qobject.h> | 38 | #include <qobject.h> |
39 | #include <qstring.h> | 39 | #include <qstring.h> |
40 | #include <qstringlist.h> | 40 | #include <qstringlist.h> |
41 | #include <qlist.h> | 41 | #include <qlist.h> |
42 | 42 | ||
43 | #define FORCE_DEPENDS 0x0001 | 43 | #define FORCE_DEPENDS 0x0001 |
44 | #define FORCE_REMOVE 0x0002 | 44 | #define FORCE_REMOVE 0x0002 |
45 | #define FORCE_REINSTALL 0x0004 | 45 | #define FORCE_REINSTALL 0x0004 |
46 | #define FORCE_OVERWRITE 0x0008 | 46 | #define FORCE_OVERWRITE 0x0008 |
47 | #define MAKE_LINKS 0x0010 | 47 | #define MAKE_LINKS 0x0010 |
48 | #define VERBOSE_WGET 0x0020 | 48 | #define VERBOSE_WGET 0x0020 |
49 | 49 | ||
50 | class OProcess; | 50 | class OProcess; |
51 | 51 | ||
52 | class Ipkg : public QObject | 52 | class Ipkg : public QObject |
53 | { | 53 | { |
54 | Q_OBJECT | 54 | Q_OBJECT |
55 | public: | 55 | public: |
56 | Ipkg(); | 56 | Ipkg(); |
57 | ~Ipkg(); | 57 | ~Ipkg(); |
58 | void runIpkg(); | 58 | void runIpkg(); |
59 | void createSymLinks(); | 59 | void createSymLinks(); |
60 | 60 | ||
61 | void setOption( const char *opt ) { option = opt; } | 61 | void setOption( const char *opt ) { option = opt; } |
62 | void setPackage( const char *pkg ) { package = pkg; } | 62 | void setPackage( const char *pkg ) { package = pkg; } |
63 | void setDestination( const char *dest ) { destination = dest; } | 63 | void setDestination( const char *dest ) { destination = dest; } |
64 | void setDestinationDir( const char *dir ) { destDir = dir; } | 64 | void setDestinationDir( const char *dir ) { destDir = dir; } |
65 | void setFlags( int fl, int il ) { flags = fl; infoLevel = il; } | 65 | void setFlags( int fl, int il ) { flags = fl; infoLevel = il; } |
66 | void setRuntimeDirectory( const char *dir ) { runtimeDir = dir; } | 66 | void setRuntimeDirectory( const char *dir ) { runtimeDir = dir; } |
67 | 67 | ||
68 | signals: | 68 | signals: |
69 | void outputText( const QString &text ); | 69 | void outputText( const QString &text ); |
70 | void ipkgFinished(); | 70 | void ipkgFinished(); |
71 | 71 | ||
72 | public slots: | 72 | public slots: |
73 | void commandStdout(OProcess*, char *buffer, int buflen); | 73 | void commandStdout(OProcess*, char *buffer, int buflen); |
74 | void commandStderr(OProcess*, char *buffer, int buflen); | 74 | void commandStderr(OProcess*, char *buffer, int buflen); |
75 | void processFinished(); | 75 | void processFinished(); |
76 | void abort(); | 76 | void abort(); |
77 | 77 | ||
78 | 78 | ||
79 | private: | 79 | private: |
80 | bool createLinks; | 80 | bool createLinks; |
81 | bool aborted; | 81 | bool aborted; |
82 | bool error; | 82 | bool error; |
83 | QString option; | 83 | QString option; |
84 | QString package; | 84 | QString package; |
85 | QString destination; | 85 | QString destination; |
86 | QString destDir; | 86 | QString destDir; |
87 | QString runtimeDir; | 87 | QString runtimeDir; |
88 | OProcess *proc; | 88 | OProcess *proc; |
89 | int flags; | 89 | int flags; |
90 | int infoLevel; | 90 | int infoLevel; |
91 | bool finished; | 91 | bool finished; |
92 | 92 | ||
93 | QList<QString> *dependantPackages; | 93 | QList<QString> *dependantPackages; |
94 | 94 | ||
95 | int executeIpkgCommand( QStringList &cmd, const QString option ); | 95 | int executeIpkgCommand( QStringList &cmd, const QString option ); |
96 | void removeStatusEntry(); | 96 | void removeStatusEntry(); |
97 | void linkPackage( const QString &packFileName, const QString &dest, const QString &destDir ); | 97 | void linkPackage( const QString &packFileName, const QString &dest, const QString &destDir ); |
98 | QStringList* getList( const QString &packageFilename, const QString &destDir ); | 98 | QStringList* getList( const QString &packageFilename, const QString &destDir ); |
99 | void processFileList( const QStringList *fileList, const QString &destDir ); | 99 | void processFileList( const QStringList *fileList, const QString &destDir ); |
100 | void processLinkDir( const QString &file, const QString &baseDir, const QString &destDir ); | 100 | void processLinkDir( const QString &file, const QString &baseDir, const QString &destDir ); |
101 | 101 | ||
102 | }; | 102 | }; |
103 | 103 | ||
104 | #endif | 104 | #endif |
diff --git a/noncore/settings/aqpkg/main.cpp b/noncore/settings/aqpkg/main.cpp index 179f8b7..b391714 100644 --- a/noncore/settings/aqpkg/main.cpp +++ b/noncore/settings/aqpkg/main.cpp | |||
@@ -1,38 +1,38 @@ | |||
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 "mainwin.h" | 30 | #include "mainwin.h" |
31 | 31 | ||
32 | #include <opie/oapplicationfactory.h> | 32 | #include <opie2/oapplicationfactory.h> |
33 | 33 | ||
34 | /* be less intrusive for translation -zecke */ | 34 | /* be less intrusive for translation -zecke */ |
35 | extern QString LOCAL_SERVER; | 35 | extern QString LOCAL_SERVER; |
36 | extern QString LOCAL_IPKGS; | 36 | extern QString LOCAL_IPKGS; |
37 | 37 | ||
38 | OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) | 38 | OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) |
diff --git a/noncore/settings/aqpkg/opie-aqpkg.control b/noncore/settings/aqpkg/opie-aqpkg.control index b9e143f..2edb794 100644 --- a/noncore/settings/aqpkg/opie-aqpkg.control +++ b/noncore/settings/aqpkg/opie-aqpkg.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-aqpkg | 1 | Package: opie-aqpkg |
2 | Files: plugins/application/libaqpkg.so* bin/aqpkg pics/aqpkg apps/Settings/aqpkg.desktop | 2 | Files: plugins/application/libaqpkg.so* bin/aqpkg pics/aqpkg apps/Settings/aqpkg.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Depends: task-opie-minimal | 5 | Depends: task-opie-minimal, libopiecore2, libopieui2 |
6 | Replaces: aqpkg | 6 | Replaces: aqpkg |
7 | Architecture: arm | 7 | Architecture: arm |
8 | Maintainer: Andy Qua (andy.qua@blueyonder.co.uk) | 8 | Maintainer: Andy Qua (andy.qua@blueyonder.co.uk) |
9 | Description: A Package Manager | 9 | Description: A Package Manager |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp index 9fdf31e..6e9dd99 100644 --- a/noncore/settings/aqpkg/settingsimpl.cpp +++ b/noncore/settings/aqpkg/settingsimpl.cpp | |||
@@ -1,322 +1,322 @@ | |||
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 <opie/otabwidget.h> | 34 | #include <opie2/otabwidget.h> |
35 | #ifdef QWS | 35 | #ifdef QWS |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
38 | #endif | 38 | #endif |
39 | #include <qpe/qpeapplication.h> | 39 | #include <qpe/qpeapplication.h> |
40 | 40 | ||
41 | /* QT */ | 41 | /* QT */ |
42 | #include <qcheckbox.h> | 42 | #include <qcheckbox.h> |
43 | #include <qgroupbox.h> | 43 | #include <qgroupbox.h> |
44 | #include <qlabel.h> | 44 | #include <qlabel.h> |
45 | #include <qlayout.h> | 45 | #include <qlayout.h> |
46 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
47 | #include <qlistbox.h> | 47 | #include <qlistbox.h> |
48 | #include <qpushbutton.h> | 48 | #include <qpushbutton.h> |
49 | 49 | ||
50 | /* STD */ | 50 | /* STD */ |
51 | #include <fstream> | 51 | #include <fstream> |
52 | #include <algorithm> | 52 | #include <algorithm> |
53 | using namespace std; | 53 | using namespace std; |
54 | 54 | ||
55 | SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) | 55 | SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) |
56 | : QDialog( parent, name, modal, fl ) | 56 | : QDialog( parent, name, modal, fl ) |
57 | { | 57 | { |
58 | setCaption( tr( "Configuration" ) ); | 58 | setCaption( tr( "Configuration" ) ); |
59 | 59 | ||
60 | // Setup layout to make everything pretty | 60 | // Setup layout to make everything pretty |
61 | QVBoxLayout *layout = new QVBoxLayout( this ); | 61 | QVBoxLayout *layout = new QVBoxLayout( this ); |
62 | layout->setMargin( 2 ); | 62 | layout->setMargin( 2 ); |
63 | layout->setSpacing( 4 ); | 63 | layout->setSpacing( 4 ); |
64 | 64 | ||
65 | // Setup tabs for all info | 65 | // Setup tabs for all info |
66 | OTabWidget *tabwidget = new OTabWidget( this ); | 66 | Opie::OTabWidget *tabwidget = new Opie::OTabWidget( this ); |
67 | layout->addWidget( tabwidget ); | 67 | layout->addWidget( tabwidget ); |
68 | 68 | ||
69 | tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) ); | 69 | tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) ); |
70 | tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); | 70 | tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); |
71 | tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); | 71 | tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); |
72 | tabwidget->setCurrentTab( tr( "Servers" ) ); | 72 | tabwidget->setCurrentTab( tr( "Servers" ) ); |
73 | 73 | ||
74 | dataMgr = dataManager; | 74 | dataMgr = dataManager; |
75 | setupData(); | 75 | setupData(); |
76 | changed = false; | 76 | changed = false; |
77 | newserver = false; | 77 | newserver = false; |
78 | newdestination = false; | 78 | newdestination = false; |
79 | } | 79 | } |
80 | 80 | ||
81 | SettingsImpl :: ~SettingsImpl() | 81 | SettingsImpl :: ~SettingsImpl() |
82 | { | 82 | { |
83 | } | 83 | } |
84 | 84 | ||
85 | bool SettingsImpl :: showDlg() | 85 | bool SettingsImpl :: showDlg() |
86 | { | 86 | { |
87 | QPEApplication::execDialog( this ); | 87 | QPEApplication::execDialog( this ); |
88 | if ( changed ) | 88 | if ( changed ) |
89 | dataMgr->writeOutIpkgConf(); | 89 | dataMgr->writeOutIpkgConf(); |
90 | 90 | ||
91 | return changed; | 91 | return changed; |
92 | } | 92 | } |
93 | 93 | ||
94 | QWidget *SettingsImpl :: initServerTab() | 94 | QWidget *SettingsImpl :: initServerTab() |
95 | { | 95 | { |
96 | QWidget *control = new QWidget( this ); | 96 | QWidget *control = new QWidget( this ); |
97 | 97 | ||
98 | QVBoxLayout *vb = new QVBoxLayout( control ); | 98 | QVBoxLayout *vb = new QVBoxLayout( control ); |
99 | 99 | ||
100 | QScrollView *sv = new QScrollView( control ); | 100 | QScrollView *sv = new QScrollView( control ); |
101 | vb->addWidget( sv, 0, 0 ); | 101 | vb->addWidget( sv, 0, 0 ); |
102 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 102 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
103 | sv->setFrameStyle( QFrame::NoFrame ); | 103 | sv->setFrameStyle( QFrame::NoFrame ); |
104 | 104 | ||
105 | QWidget *container = new QWidget( sv->viewport() ); | 105 | QWidget *container = new QWidget( sv->viewport() ); |
106 | sv->addChild( container ); | 106 | sv->addChild( container ); |
107 | 107 | ||
108 | QGridLayout *layout = new QGridLayout( container ); | 108 | QGridLayout *layout = new QGridLayout( container ); |
109 | layout->setSpacing( 2 ); | 109 | layout->setSpacing( 2 ); |
110 | layout->setMargin( 4 ); | 110 | layout->setMargin( 4 ); |
111 | 111 | ||
112 | servers = new QListBox( container ); | 112 | servers = new QListBox( container ); |
113 | servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 113 | servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
114 | connect( servers, SIGNAL( highlighted( int ) ), this, SLOT( editServer( int ) ) ); | 114 | connect( servers, SIGNAL( highlighted( int ) ), this, SLOT( editServer( int ) ) ); |
115 | layout->addMultiCellWidget( servers, 0, 0, 0, 1 ); | 115 | layout->addMultiCellWidget( servers, 0, 0, 0, 1 ); |
116 | 116 | ||
117 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); | 117 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); |
118 | connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) ); | 118 | connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) ); |
119 | layout->addWidget( btn, 1, 0 ); | 119 | layout->addWidget( btn, 1, 0 ); |
120 | 120 | ||
121 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 121 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); |
122 | connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) ); | 122 | connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) ); |
123 | layout->addWidget( btn, 1, 1 ); | 123 | layout->addWidget( btn, 1, 1 ); |
124 | 124 | ||
125 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); | 125 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); |
126 | grpbox->layout()->setSpacing( 2 ); | 126 | grpbox->layout()->setSpacing( 2 ); |
127 | grpbox->layout()->setMargin( 4 ); | 127 | grpbox->layout()->setMargin( 4 ); |
128 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); | 128 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); |
129 | 129 | ||
130 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); | 130 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); |
131 | 131 | ||
132 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); | 132 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); |
133 | grplayout->addWidget( label, 0, 0 ); | 133 | grplayout->addWidget( label, 0, 0 ); |
134 | servername = new QLineEdit( grpbox ); | 134 | servername = new QLineEdit( grpbox ); |
135 | grplayout->addWidget( servername, 0, 1 ); | 135 | grplayout->addWidget( servername, 0, 1 ); |
136 | 136 | ||
137 | label = new QLabel( tr( "Address:" ), grpbox ); | 137 | label = new QLabel( tr( "Address:" ), grpbox ); |
138 | grplayout->addWidget( label, 1, 0 ); | 138 | grplayout->addWidget( label, 1, 0 ); |
139 | serverurl = new QLineEdit( grpbox ); | 139 | serverurl = new QLineEdit( grpbox ); |
140 | grplayout->addWidget( serverurl, 1, 1 ); | 140 | grplayout->addWidget( serverurl, 1, 1 ); |
141 | 141 | ||
142 | active = new QCheckBox( tr( "Active Server" ), grpbox ); | 142 | active = new QCheckBox( tr( "Active Server" ), grpbox ); |
143 | grplayout->addMultiCellWidget( active, 2, 2, 0, 1 ); | 143 | grplayout->addMultiCellWidget( active, 2, 2, 0, 1 ); |
144 | 144 | ||
145 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); | 145 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); |
146 | connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) ); | 146 | connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) ); |
147 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); | 147 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); |
148 | 148 | ||
149 | return control; | 149 | return control; |
150 | } | 150 | } |
151 | 151 | ||
152 | QWidget *SettingsImpl :: initDestinationTab() | 152 | QWidget *SettingsImpl :: initDestinationTab() |
153 | { | 153 | { |
154 | QWidget *control = new QWidget( this ); | 154 | QWidget *control = new QWidget( this ); |
155 | 155 | ||
156 | QVBoxLayout *vb = new QVBoxLayout( control ); | 156 | QVBoxLayout *vb = new QVBoxLayout( control ); |
157 | 157 | ||
158 | QScrollView *sv = new QScrollView( control ); | 158 | QScrollView *sv = new QScrollView( control ); |
159 | vb->addWidget( sv, 0, 0 ); | 159 | vb->addWidget( sv, 0, 0 ); |
160 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 160 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
161 | sv->setFrameStyle( QFrame::NoFrame ); | 161 | sv->setFrameStyle( QFrame::NoFrame ); |
162 | 162 | ||
163 | QWidget *container = new QWidget( sv->viewport() ); | 163 | QWidget *container = new QWidget( sv->viewport() ); |
164 | sv->addChild( container ); | 164 | sv->addChild( container ); |
165 | 165 | ||
166 | QGridLayout *layout = new QGridLayout( container ); | 166 | QGridLayout *layout = new QGridLayout( container ); |
167 | layout->setSpacing( 2 ); | 167 | layout->setSpacing( 2 ); |
168 | layout->setMargin( 4 ); | 168 | layout->setMargin( 4 ); |
169 | 169 | ||
170 | destinations = new QListBox( container ); | 170 | destinations = new QListBox( container ); |
171 | destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 171 | destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
172 | connect( destinations, SIGNAL( highlighted( int ) ), this, SLOT( editDestination( int ) ) ); | 172 | connect( destinations, SIGNAL( highlighted( int ) ), this, SLOT( editDestination( int ) ) ); |
173 | layout->addMultiCellWidget( destinations, 0, 0, 0, 1 ); | 173 | layout->addMultiCellWidget( destinations, 0, 0, 0, 1 ); |
174 | 174 | ||
175 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); | 175 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); |
176 | connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) ); | 176 | connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) ); |
177 | layout->addWidget( btn, 1, 0 ); | 177 | layout->addWidget( btn, 1, 0 ); |
178 | 178 | ||
179 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 179 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); |
180 | connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) ); | 180 | connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) ); |
181 | layout->addWidget( btn, 1, 1 ); | 181 | layout->addWidget( btn, 1, 1 ); |
182 | 182 | ||
183 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); | 183 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); |
184 | grpbox->layout()->setSpacing( 2 ); | 184 | grpbox->layout()->setSpacing( 2 ); |
185 | grpbox->layout()->setMargin( 4 ); | 185 | grpbox->layout()->setMargin( 4 ); |
186 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); | 186 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); |
187 | 187 | ||
188 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); | 188 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); |
189 | 189 | ||
190 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); | 190 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); |
191 | grplayout->addWidget( label, 0, 0 ); | 191 | grplayout->addWidget( label, 0, 0 ); |
192 | destinationname = new QLineEdit( grpbox ); | 192 | destinationname = new QLineEdit( grpbox ); |
193 | grplayout->addWidget( destinationname, 0, 1 ); | 193 | grplayout->addWidget( destinationname, 0, 1 ); |
194 | 194 | ||
195 | label = new QLabel( tr( "Location:" ), grpbox ); | 195 | label = new QLabel( tr( "Location:" ), grpbox ); |
196 | grplayout->addWidget( label, 1, 0 ); | 196 | grplayout->addWidget( label, 1, 0 ); |
197 | destinationurl = new QLineEdit( grpbox ); | 197 | destinationurl = new QLineEdit( grpbox ); |
198 | grplayout->addWidget( destinationurl, 1, 1 ); | 198 | grplayout->addWidget( destinationurl, 1, 1 ); |
199 | 199 | ||
200 | linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox ); | 200 | linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox ); |
201 | grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 ); | 201 | grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 ); |
202 | 202 | ||
203 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); | 203 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); |
204 | connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) ); | 204 | connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) ); |
205 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); | 205 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); |
206 | 206 | ||
207 | return control; | 207 | return control; |
208 | } | 208 | } |
209 | 209 | ||
210 | QWidget *SettingsImpl :: initProxyTab() | 210 | QWidget *SettingsImpl :: initProxyTab() |
211 | { | 211 | { |
212 | QWidget *control = new QWidget( this ); | 212 | QWidget *control = new QWidget( this ); |
213 | 213 | ||
214 | QVBoxLayout *vb = new QVBoxLayout( control ); | 214 | QVBoxLayout *vb = new QVBoxLayout( control ); |
215 | 215 | ||
216 | QScrollView *sv = new QScrollView( control ); | 216 | QScrollView *sv = new QScrollView( control ); |
217 | vb->addWidget( sv, 0, 0 ); | 217 | vb->addWidget( sv, 0, 0 ); |
218 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 218 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
219 | sv->setFrameStyle( QFrame::NoFrame ); | 219 | sv->setFrameStyle( QFrame::NoFrame ); |
220 | 220 | ||
221 | QWidget *container = new QWidget( sv->viewport() ); | 221 | QWidget *container = new QWidget( sv->viewport() ); |
222 | sv->addChild( container ); | 222 | sv->addChild( container ); |
223 | 223 | ||
224 | QGridLayout *layout = new QGridLayout( container ); | 224 | QGridLayout *layout = new QGridLayout( container ); |
225 | layout->setSpacing( 2 ); | 225 | layout->setSpacing( 2 ); |
226 | layout->setMargin( 4 ); | 226 | layout->setMargin( 4 ); |
227 | 227 | ||
228 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); | 228 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); |
229 | grpbox->layout()->setSpacing( 2 ); | 229 | grpbox->layout()->setSpacing( 2 ); |
230 | grpbox->layout()->setMargin( 4 ); | 230 | grpbox->layout()->setMargin( 4 ); |
231 | layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); | 231 | layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); |
232 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); | 232 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); |
233 | txtHttpProxy = new QLineEdit( grpbox ); | 233 | txtHttpProxy = new QLineEdit( grpbox ); |
234 | grplayout->addWidget( txtHttpProxy ); | 234 | grplayout->addWidget( txtHttpProxy ); |
235 | chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); | 235 | chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); |
236 | grplayout->addWidget( chkHttpProxyEnabled ); | 236 | grplayout->addWidget( chkHttpProxyEnabled ); |
237 | 237 | ||
238 | grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); | 238 | grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); |
239 | grpbox->layout()->setSpacing( 2 ); | 239 | grpbox->layout()->setSpacing( 2 ); |
240 | grpbox->layout()->setMargin( 4 ); | 240 | grpbox->layout()->setMargin( 4 ); |
241 | layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); | 241 | layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); |
242 | grplayout = new QVBoxLayout( grpbox->layout() ); | 242 | grplayout = new QVBoxLayout( grpbox->layout() ); |
243 | txtFtpProxy = new QLineEdit( grpbox ); | 243 | txtFtpProxy = new QLineEdit( grpbox ); |
244 | grplayout->addWidget( txtFtpProxy ); | 244 | grplayout->addWidget( txtFtpProxy ); |
245 | chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); | 245 | chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); |
246 | grplayout->addWidget( chkFtpProxyEnabled ); | 246 | grplayout->addWidget( chkFtpProxyEnabled ); |
247 | 247 | ||
248 | QLabel *label = new QLabel( tr( "Username:" ), container ); | 248 | QLabel *label = new QLabel( tr( "Username:" ), container ); |
249 | layout->addWidget( label, 2, 0 ); | 249 | layout->addWidget( label, 2, 0 ); |
250 | txtUsername = new QLineEdit( container ); | 250 | txtUsername = new QLineEdit( container ); |
251 | layout->addWidget( txtUsername, 2, 1 ); | 251 | layout->addWidget( txtUsername, 2, 1 ); |
252 | 252 | ||
253 | label = new QLabel( tr( "Password:" ), container ); | 253 | label = new QLabel( tr( "Password:" ), container ); |
254 | layout->addWidget( label, 3, 0 ); | 254 | layout->addWidget( label, 3, 0 ); |
255 | txtPassword = new QLineEdit( container ); | 255 | txtPassword = new QLineEdit( container ); |
256 | layout->addWidget( txtPassword, 3, 1 ); | 256 | layout->addWidget( txtPassword, 3, 1 ); |
257 | 257 | ||
258 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container ); | 258 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container ); |
259 | connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) ); | 259 | connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) ); |
260 | layout->addMultiCellWidget( btn, 4, 4, 0, 1 ); | 260 | layout->addMultiCellWidget( btn, 4, 4, 0, 1 ); |
261 | 261 | ||
262 | return control; | 262 | return control; |
263 | } | 263 | } |
264 | 264 | ||
265 | void SettingsImpl :: setupData() | 265 | void SettingsImpl :: setupData() |
266 | { | 266 | { |
267 | // add servers | 267 | // add servers |
268 | QString serverName; | 268 | QString serverName; |
269 | QListIterator<Server> it( dataMgr->getServerList() ); | 269 | QListIterator<Server> it( dataMgr->getServerList() ); |
270 | for ( ; it.current(); ++it ) | 270 | for ( ; it.current(); ++it ) |
271 | { | 271 | { |
272 | serverName = it.current()->getServerName(); | 272 | serverName = it.current()->getServerName(); |
273 | if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS ) | 273 | if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS ) |
274 | continue; | 274 | continue; |
275 | 275 | ||
276 | servers->insertItem( serverName ); | 276 | servers->insertItem( serverName ); |
277 | } | 277 | } |
278 | 278 | ||
279 | 279 | ||
280 | // add destinations | 280 | // add destinations |
281 | QListIterator<Destination> it2( dataMgr->getDestinationList() ); | 281 | QListIterator<Destination> it2( dataMgr->getDestinationList() ); |
282 | for ( ; it2.current(); ++it2 ) | 282 | for ( ; it2.current(); ++it2 ) |
283 | destinations->insertItem( it2.current()->getDestinationName() ); | 283 | destinations->insertItem( it2.current()->getDestinationName() ); |
284 | 284 | ||
285 | // setup proxy tab | 285 | // setup proxy tab |
286 | txtHttpProxy->setText( dataMgr->getHttpProxy() ); | 286 | txtHttpProxy->setText( dataMgr->getHttpProxy() ); |
287 | txtFtpProxy->setText( dataMgr->getFtpProxy() ); | 287 | txtFtpProxy->setText( dataMgr->getFtpProxy() ); |
288 | txtUsername->setText( dataMgr->getProxyUsername() ); | 288 | txtUsername->setText( dataMgr->getProxyUsername() ); |
289 | txtPassword->setText( dataMgr->getProxyPassword() ); | 289 | txtPassword->setText( dataMgr->getProxyPassword() ); |
290 | chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() ); | 290 | chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() ); |
291 | chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() ); | 291 | chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() ); |
292 | } | 292 | } |
293 | 293 | ||
294 | //------------------ Servers tab ---------------------- | 294 | //------------------ Servers tab ---------------------- |
295 | 295 | ||
296 | void SettingsImpl :: editServer( int sel ) | 296 | void SettingsImpl :: editServer( int sel ) |
297 | { | 297 | { |
298 | currentSelectedServer = sel; | 298 | currentSelectedServer = sel; |
299 | Server *s = dataMgr->getServer( servers->currentText() ); | 299 | Server *s = dataMgr->getServer( servers->currentText() ); |
300 | if ( s ) | 300 | if ( s ) |
301 | { | 301 | { |
302 | serverName = s->getServerName(); | 302 | serverName = s->getServerName(); |
303 | servername->setText( s->getServerName() ); | 303 | servername->setText( s->getServerName() ); |
304 | serverurl->setText( s->getServerUrl() ); | 304 | serverurl->setText( s->getServerUrl() ); |
305 | active->setChecked( s->isServerActive() ); | 305 | active->setChecked( s->isServerActive() ); |
306 | } | 306 | } |
307 | else | 307 | else |
308 | { | 308 | { |
309 | serverName = ""; | 309 | serverName = ""; |
310 | servername->setText( "" ); | 310 | servername->setText( "" ); |
311 | serverurl->setText( "" ); | 311 | serverurl->setText( "" ); |
312 | active->setChecked( false ); | 312 | active->setChecked( false ); |
313 | } | 313 | } |
314 | } | 314 | } |
315 | 315 | ||
316 | void SettingsImpl :: newServer() | 316 | void SettingsImpl :: newServer() |
317 | { | 317 | { |
318 | newserver = true; | 318 | newserver = true; |
319 | servername->setText( "" ); | 319 | servername->setText( "" ); |
320 | serverurl->setText( "" ); | 320 | serverurl->setText( "" ); |
321 | servername->setFocus(); | 321 | servername->setFocus(); |
322 | active->setChecked( true ); | 322 | active->setChecked( true ); |