author | tille <tille> | 2002-04-26 00:50:30 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-26 00:50:30 (UTC) |
commit | a111f57eedcf27623e9bff2816c83d3287272aff (patch) (unidiff) | |
tree | b43ac41ffbdc741f731cf3f91aab064ba94ab0f3 /noncore | |
parent | 5198d98daeaa1e8eb8568ccd3c516ab70fbed512 (diff) | |
download | opie-a111f57eedcf27623e9bff2816c83d3287272aff.zip opie-a111f57eedcf27623e9bff2816c83d3287272aff.tar.gz opie-a111f57eedcf27623e9bff2816c83d3287272aff.tar.bz2 |
added support for scipt ipkg (again;)
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 23 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.h | 4 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 75 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 11 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/settings.h | 5 |
6 files changed, 98 insertions, 21 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 54ee115..c803ca0 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -45,207 +45,207 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
45 | listViewPackages->setColumnWidthMode(0,QListView::Manual); | 45 | listViewPackages->setColumnWidthMode(0,QListView::Manual); |
46 | listViewPackages->setColumnWidthMode(1,QListView::Manual); | 46 | listViewPackages->setColumnWidthMode(1,QListView::Manual); |
47 | listViewPackages->setColumnWidthMode(2,QListView::Manual); | 47 | listViewPackages->setColumnWidthMode(2,QListView::Manual); |
48 | listViewPackages->setSelectionMode( QListView::Multi ); | 48 | listViewPackages->setSelectionMode( QListView::Multi ); |
49 | 49 | ||
50 | connect( section, SIGNAL( activated(int) ), | 50 | connect( section, SIGNAL( activated(int) ), |
51 | this, SLOT( sectionChanged() ) ); | 51 | this, SLOT( sectionChanged() ) ); |
52 | connect( subsection, SIGNAL(activated(int) ), | 52 | connect( subsection, SIGNAL(activated(int) ), |
53 | this, SLOT( subSectionChanged() ) ); | 53 | this, SLOT( subSectionChanged() ) ); |
54 | connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ), | 54 | connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ), |
55 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 55 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
56 | 56 | ||
57 | settings = new PackageManagerSettings(this,0,TRUE); | 57 | settings = new PackageManagerSettings(this,0,TRUE); |
58 | 58 | ||
59 | ipkg = new PmIpkg( settings, this ); | 59 | ipkg = new PmIpkg( settings, this ); |
60 | packageList.setSettings( settings ); | 60 | packageList.setSettings( settings ); |
61 | getList(); | 61 | getList(); |
62 | setSections(); | 62 | setSections(); |
63 | setSubSections(); | 63 | setSubSections(); |
64 | displayList(); | 64 | displayList(); |
65 | } | 65 | } |
66 | 66 | ||
67 | void MainWindow::makeMenu() | 67 | void MainWindow::makeMenu() |
68 | { | 68 | { |
69 | 69 | ||
70 | QPEToolBar *toolBar = new QPEToolBar( this ); | 70 | QPEToolBar *toolBar = new QPEToolBar( this ); |
71 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 71 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
72 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 72 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
73 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 73 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
74 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 74 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
75 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 75 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
76 | 76 | ||
77 | popupMenu = new QPopupMenu( this ); | 77 | popupMenu = new QPopupMenu( this ); |
78 | 78 | ||
79 | contextMenu = new QPopupMenu( this ); | 79 | contextMenu = new QPopupMenu( this ); |
80 | 80 | ||
81 | setToolBarsMovable( false ); | 81 | setToolBarsMovable( false ); |
82 | toolBar->setHorizontalStretchable( true ); | 82 | toolBar->setHorizontalStretchable( true ); |
83 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 83 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
84 | menuBar->insertItem( tr( "View" ), viewMenu ); | 84 | menuBar->insertItem( tr( "View" ), viewMenu ); |
85 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 85 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
86 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); | 86 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); |
87 | 87 | ||
88 | QLabel *spacer = new QLabel( "", toolBar ); | 88 | QLabel *spacer = new QLabel( "", toolBar ); |
89 | spacer->setBackgroundColor( toolBar->backgroundColor() ); | 89 | spacer->setBackgroundColor( toolBar->backgroundColor() ); |
90 | toolBar->setStretchableWidget( spacer ); | 90 | toolBar->setStretchableWidget( spacer ); |
91 | 91 | ||
92 | 92 | ||
93 | runAction = new QAction( tr( "Commit" ), | 93 | runAction = new QAction( tr( "Apply" ), |
94 | Resource::loadPixmap( "oipkg/install" ), | 94 | Resource::loadPixmap( "oipkg/install" ), |
95 | QString::null, 0, this, 0 ); | 95 | QString::null, 0, this, 0 ); |
96 | connect( runAction, SIGNAL( activated() ), | 96 | connect( runAction, SIGNAL( activated() ), |
97 | this, SLOT( runIpkg() ) ); | 97 | this, SLOT( runIpkg() ) ); |
98 | runAction->addTo( toolBar ); | 98 | runAction->addTo( toolBar ); |
99 | runAction->addTo( srvMenu ); | 99 | runAction->addTo( srvMenu ); |
100 | 100 | ||
101 | srvMenu->insertSeparator (); | 101 | srvMenu->insertSeparator (); |
102 | 102 | ||
103 | updateAction = new QAction( tr( "Update" ), | 103 | updateAction = new QAction( tr( "Update" ), |
104 | Resource::loadIconSet( "oipkg/update" ), | 104 | Resource::loadIconSet( "oipkg/update" ), |
105 | QString::null, 0, this, 0 ); | 105 | QString::null, 0, this, 0 ); |
106 | connect( updateAction, SIGNAL( activated() ), | 106 | connect( updateAction, SIGNAL( activated() ), |
107 | this , SLOT( updateList() ) ); | 107 | this , SLOT( updateList() ) ); |
108 | updateAction->addTo( toolBar ); | 108 | updateAction->addTo( toolBar ); |
109 | updateAction->addTo( srvMenu ); | 109 | updateAction->addTo( srvMenu ); |
110 | 110 | ||
111 | detailsAction = new QAction( tr( "Details" ), | 111 | detailsAction = new QAction( tr( "Details" ), |
112 | Resource::loadIconSet( "find" ), | 112 | Resource::loadIconSet( "find" ), |
113 | QString::null, 0, this, 0 ); | 113 | QString::null, 0, this, 0 ); |
114 | connect( detailsAction, SIGNAL( activated() ), | 114 | connect( detailsAction, SIGNAL( activated() ), |
115 | this , SLOT( showDetails() ) ); | 115 | this , SLOT( showDetails() ) ); |
116 | detailsAction->addTo( toolBar ); | 116 | detailsAction->addTo( toolBar ); |
117 | detailsAction->addTo( srvMenu ); | 117 | detailsAction->addTo( srvMenu ); |
118 | 118 | ||
119 | QAction *cfgact; | 119 | QAction *cfgact; |
120 | 120 | ||
121 | cfgact = new QAction( tr( "Setups" ), | 121 | cfgact = new QAction( tr( "Setups" ), |
122 | // Resource::loadIconSet( "" ), | 122 | // Resource::loadIconSet( "" ), |
123 | QString::null, 0, this, 0 ); | 123 | QString::null, 0, this, 0 ); |
124 | connect( cfgact, SIGNAL( activated() ), | 124 | connect( cfgact, SIGNAL( activated() ), |
125 | SLOT( showSettings() ) ); | 125 | SLOT( showSettings() ) ); |
126 | cfgact->addTo( cfgMenu ); | 126 | cfgact->addTo( cfgMenu ); |
127 | 127 | ||
128 | cfgact = new QAction( tr( "Servers" ), | 128 | cfgact = new QAction( tr( "Servers" ), |
129 | // Resource::loadIconSet( "" ), | 129 | // Resource::loadIconSet( "" ), |
130 | QString::null, 0, this, 0 ); | 130 | QString::null, 0, this, 0 ); |
131 | connect( cfgact, SIGNAL( activated() ), | 131 | connect( cfgact, SIGNAL( activated() ), |
132 | SLOT( showSettingsSrv() ) ); | 132 | SLOT( showSettingsSrv() ) ); |
133 | cfgact->addTo( cfgMenu ); | 133 | cfgact->addTo( cfgMenu ); |
134 | cfgact = new QAction( tr( "Destinations" ), | 134 | cfgact = new QAction( tr( "Destinations" ), |
135 | //Resource::loadIconSet( "" ), | 135 | //Resource::loadIconSet( "" ), |
136 | QString::null, 0, this, 0 ); | 136 | QString::null, 0, this, 0 ); |
137 | connect( cfgact, SIGNAL( activated() ), | 137 | connect( cfgact, SIGNAL( activated() ), |
138 | SLOT( showSettingsDst() ) ); | 138 | SLOT( showSettingsDst() ) ); |
139 | cfgact->addTo( cfgMenu ); | 139 | cfgact->addTo( cfgMenu ); |
140 | 140 | ||
141 | QAction *a; | 141 | QAction *a; |
142 | 142 | ||
143 | sectionBar = new QPEToolBar( this ); | 143 | sectionBar = new QPEToolBar( this ); |
144 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); | 144 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); |
145 | sectionBar->setHorizontalStretchable( true ); | 145 | sectionBar->setHorizontalStretchable( true ); |
146 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | 146 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); |
147 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 147 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
148 | sectionBar->setStretchableWidget( label ); | 148 | sectionBar->setStretchableWidget( label ); |
149 | section = new QComboBox( false, sectionBar ); | 149 | section = new QComboBox( false, sectionBar ); |
150 | // section->setBackgroundMode( PaletteBackground ); | 150 | // section->setBackgroundMode( PaletteBackground ); |
151 | label = new QLabel( " / ", sectionBar ); | 151 | label = new QLabel( " / ", sectionBar ); |
152 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 152 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
153 | subsection = new QComboBox( false, sectionBar ); | 153 | subsection = new QComboBox( false, sectionBar ); |
154 | 154 | ||
155 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 155 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
156 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); | 156 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); |
157 | a->addTo( sectionBar ); | 157 | a->addTo( sectionBar ); |
158 | 158 | ||
159 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); | 159 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); |
160 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); | 160 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); |
161 | sectionAction->setToggleAction( true ); | 161 | sectionAction->setToggleAction( true ); |
162 | sectionAction->setOn( true ); | 162 | sectionAction->setOn( true ); |
163 | sectionAction->addTo( viewMenu ); | 163 | sectionAction->addTo( viewMenu ); |
164 | 164 | ||
165 | findBar = new QPEToolBar(this); | 165 | findBar = new QPEToolBar(this); |
166 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); | 166 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); |
167 | label = new QLabel( tr("Filter: "), findBar ); | 167 | label = new QLabel( tr("Filter: "), findBar ); |
168 | label->setBackgroundColor( findBar->backgroundColor() ); | 168 | label->setBackgroundColor( findBar->backgroundColor() ); |
169 | findBar->setHorizontalStretchable( TRUE ); | 169 | findBar->setHorizontalStretchable( TRUE ); |
170 | findEdit = new QLineEdit( findBar, "findEdit" ); | 170 | findEdit = new QLineEdit( findBar, "findEdit" ); |
171 | findBar->setStretchableWidget( findEdit ); | 171 | findBar->setStretchableWidget( findEdit ); |
172 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), | 172 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), |
173 | this, SLOT( displayList() ) ); | 173 | this, SLOT( displayList() ) ); |
174 | //a = new QAction( tr( "Filter" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); | 174 | |
175 | // connect( a, SIGNAL( activated() ), this, SLOT( filterList() ) ); | ||
176 | // a->addTo( findBar ); | ||
177 | // a->addTo( edit ); | ||
178 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 175 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
179 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 176 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
180 | a->addTo( findBar ); | 177 | a->addTo( findBar ); |
181 | findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); | 178 | findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); |
182 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | 179 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); |
183 | findAction->setToggleAction( true ); | 180 | findAction->setToggleAction( true ); |
184 | findAction->setOn( true ); | 181 | findAction->setOn( true ); |
185 | findAction->addTo( viewMenu ); | 182 | findAction->addTo( viewMenu ); |
186 | |||
187 | } | 183 | } |
188 | 184 | ||
189 | MainWindow::~MainWindow() | 185 | MainWindow::~MainWindow() |
190 | { | 186 | { |
191 | } | 187 | } |
192 | 188 | ||
193 | void MainWindow::runIpkg() | 189 | void MainWindow::runIpkg() |
194 | { | 190 | { |
195 | ipkg->commit( packageList ); | 191 | ipkg->commit( packageList ); |
196 | updateList(); //to remove | 192 | // updateList(); //to remove |
197 | } | 193 | } |
198 | 194 | ||
199 | void MainWindow::updateList() | 195 | void MainWindow::updateList() |
200 | { | 196 | { |
197 | QTimer *t = new QTimer( this ); | ||
198 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); | ||
199 | t->start( 0, false ); | ||
201 | packageList.clear(); | 200 | packageList.clear(); |
202 | ipkg->update(); | 201 | ipkg->update(); |
203 | getList(); | 202 | getList(); |
203 | t->stop(); | ||
204 | } | 204 | } |
205 | 205 | ||
206 | void MainWindow::getList() | 206 | void MainWindow::getList() |
207 | { | 207 | { |
208 | packageList.update(); | 208 | packageList.update(); |
209 | displayList(); | 209 | displayList(); |
210 | } | 210 | } |
211 | 211 | ||
212 | void MainWindow::filterList() | 212 | void MainWindow::filterList() |
213 | { | 213 | { |
214 | QString f = ""; | 214 | QString f = ""; |
215 | if ( findAction->isOn() ) f = findEdit->text(); | 215 | if ( findAction->isOn() ) f = findEdit->text(); |
216 | packageList.filterPackages( f ); | 216 | packageList.filterPackages( f ); |
217 | } | 217 | } |
218 | 218 | ||
219 | void MainWindow::displayList() | 219 | void MainWindow::displayList() |
220 | { | 220 | { |
221 | filterList(); | 221 | filterList(); |
222 | listViewPackages->clear(); | 222 | listViewPackages->clear(); |
223 | Package *pack = packageList.first(); | 223 | Package *pack = packageList.first(); |
224 | while( pack ) | 224 | while( pack ) |
225 | { | 225 | { |
226 | if ( pack && (pack->name() != "") ) | 226 | if ( pack && (pack->name() != "") ) |
227 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack ) ); | 227 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack ) ); |
228 | pack = packageList.next(); | 228 | pack = packageList.next(); |
229 | } | 229 | } |
230 | } | 230 | } |
231 | 231 | ||
232 | void MainWindow::sectionChanged() | 232 | void MainWindow::sectionChanged() |
233 | { | 233 | { |
234 | disconnect( section, SIGNAL( activated(int) ), | 234 | disconnect( section, SIGNAL( activated(int) ), |
235 | this, SLOT( sectionChanged() ) ); | 235 | this, SLOT( sectionChanged() ) ); |
236 | disconnect( subsection, SIGNAL(activated(int) ), | 236 | disconnect( subsection, SIGNAL(activated(int) ), |
237 | this, SLOT( subSectionChanged() ) ); | 237 | this, SLOT( subSectionChanged() ) ); |
238 | subsection->clear(); | 238 | subsection->clear(); |
239 | packageList.setSection( section->currentText() ); | 239 | packageList.setSection( section->currentText() ); |
240 | setSubSections(); | 240 | setSubSections(); |
241 | connect( section, SIGNAL( activated(int) ), | 241 | connect( section, SIGNAL( activated(int) ), |
242 | this, SLOT( sectionChanged() ) ); | 242 | this, SLOT( sectionChanged() ) ); |
243 | connect( subsection, SIGNAL(activated(int) ), | 243 | connect( subsection, SIGNAL(activated(int) ), |
244 | this, SLOT( subSectionChanged() ) ); | 244 | this, SLOT( subSectionChanged() ) ); |
245 | displayList(); | 245 | displayList(); |
246 | } | 246 | } |
247 | 247 | ||
248 | void MainWindow::subSectionChanged() | 248 | void MainWindow::subSectionChanged() |
249 | { | 249 | { |
250 | disconnect( section, SIGNAL( activated(int) ), | 250 | disconnect( section, SIGNAL( activated(int) ), |
251 | this, SLOT( sectionChanged() ) ); | 251 | this, SLOT( sectionChanged() ) ); |
@@ -301,48 +301,57 @@ void MainWindow::showDetails() | |||
301 | details->description->setTextFormat(RichText); | 301 | details->description->setTextFormat(RichText); |
302 | } | 302 | } |
303 | 303 | ||
304 | details->setCaption("Package: " + activePackage->name()); | 304 | details->setCaption("Package: " + activePackage->name()); |
305 | details->description->setText(activePackage->details() ); | 305 | details->description->setText(activePackage->details() ); |
306 | details->install->setEnabled(!activePackage->installed()); | 306 | details->install->setEnabled(!activePackage->installed()); |
307 | details->remove->setEnabled(activePackage->installed()); | 307 | details->remove->setEnabled(activePackage->installed()); |
308 | details->showMaximized(); | 308 | details->showMaximized(); |
309 | } | 309 | } |
310 | 310 | ||
311 | void MainWindow::toggleActivePackage() | 311 | void MainWindow::toggleActivePackage() |
312 | { | 312 | { |
313 | activePackage->toggleProcess(); | 313 | activePackage->toggleProcess(); |
314 | if ( details ) details->close(); | 314 | if ( details ) details->close(); |
315 | } | 315 | } |
316 | 316 | ||
317 | void MainWindow::setCurrent( QListViewItem* p ) | 317 | void MainWindow::setCurrent( QListViewItem* p ) |
318 | { | 318 | { |
319 | pvDebug(2, "MainWindow::setCurrent "); | 319 | pvDebug(2, "MainWindow::setCurrent "); |
320 | return; | 320 | return; |
321 | pvDebug(2, "name "+((Package*)p)->name()); | 321 | pvDebug(2, "name "+((Package*)p)->name()); |
322 | activePackage = (Package*)p; | 322 | activePackage = (Package*)p; |
323 | } | 323 | } |
324 | 324 | ||
325 | void MainWindow::sectionShow(bool b) | 325 | void MainWindow::sectionShow(bool b) |
326 | { | 326 | { |
327 | if (b) sectionBar->show(); | 327 | if (b) sectionBar->show(); |
328 | else sectionBar->hide(); | 328 | else sectionBar->hide(); |
329 | sectionAction->setOn( b ); | 329 | sectionAction->setOn( b ); |
330 | } | 330 | } |
331 | 331 | ||
332 | void MainWindow::sectionClose() | 332 | void MainWindow::sectionClose() |
333 | { | 333 | { |
334 | sectionAction->setOn( false ); | 334 | sectionAction->setOn( false ); |
335 | } | 335 | } |
336 | 336 | ||
337 | void MainWindow::findShow(bool b) | 337 | void MainWindow::findShow(bool b) |
338 | { | 338 | { |
339 | if (b) findBar->show(); | 339 | if (b) findBar->show(); |
340 | else findBar->hide(); | 340 | else findBar->hide(); |
341 | findAction->setOn( b ); | 341 | findAction->setOn( b ); |
342 | } | 342 | } |
343 | 343 | ||
344 | void MainWindow::findClose() | 344 | void MainWindow::findClose() |
345 | { | 345 | { |
346 | findAction->setOn( false ); | 346 | findAction->setOn( false ); |
347 | } | 347 | } |
348 | 348 | ||
349 | void MainWindow::rotateUpdateIcon() | ||
350 | { | ||
351 | pvDebug(2, "MainWindow::rotateUpdateIcon"); | ||
352 | if ( updateIcon ) | ||
353 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); | ||
354 | else | ||
355 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); | ||
356 | updateIcon = !updateIcon; | ||
357 | } | ||
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index 0c1e474..892d5e8 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h | |||
@@ -1,74 +1,78 @@ | |||
1 | #ifndef MAINWINDOW_H | 1 | #ifndef MAINWINDOW_H |
2 | #define MAINWINDOW_H | 2 | #define MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qaction.h> | 5 | #include <qaction.h> |
6 | #include <qtimer.h> | ||
6 | #include <qpopupmenu.h> | 7 | #include <qpopupmenu.h> |
7 | 8 | ||
8 | #include "packagelist.h" | 9 | #include "packagelist.h" |
9 | #include "pmipkg.h" | 10 | #include "pmipkg.h" |
10 | #include "pksettings.h" | 11 | #include "pksettings.h" |
11 | #include "pkdesc.h" | 12 | #include "pkdesc.h" |
12 | 13 | ||
13 | class QComboBox; | 14 | class QComboBox; |
14 | class QPEToolBar; | 15 | class QPEToolBar; |
15 | class QLineEdit; | 16 | class QLineEdit; |
16 | class QListView; | 17 | class QListView; |
17 | 18 | ||
18 | 19 | ||
19 | class MainWindow : public QMainWindow | 20 | class MainWindow : public QMainWindow |
20 | { | 21 | { |
21 | Q_OBJECT | 22 | Q_OBJECT |
22 | 23 | ||
23 | 24 | ||
24 | public: | 25 | public: |
25 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 26 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
26 | ~MainWindow(); | 27 | ~MainWindow(); |
27 | 28 | ||
28 | protected slots: | 29 | protected slots: |
29 | void runIpkg(); | 30 | void runIpkg(); |
30 | void getList(); | 31 | void getList(); |
31 | void updateList(); | 32 | void updateList(); |
32 | void displayList(); | 33 | void displayList(); |
33 | void subSectionChanged(); | 34 | void subSectionChanged(); |
34 | void sectionChanged(); | 35 | void sectionChanged(); |
35 | void showSettings(); | 36 | void showSettings(); |
36 | void showSettingsSrv(); | 37 | void showSettingsSrv(); |
37 | void showSettingsDst(); | 38 | void showSettingsDst(); |
38 | 39 | ||
39 | public slots: | 40 | public slots: |
40 | void showDetails(); | 41 | void showDetails(); |
41 | void toggleActivePackage(); | 42 | void toggleActivePackage(); |
42 | void setCurrent( QListViewItem* ); | 43 | void setCurrent( QListViewItem* ); |
43 | void sectionClose(); | 44 | void sectionClose(); |
44 | void sectionShow(bool); | 45 | void sectionShow(bool); |
45 | void findClose(); | 46 | void findClose(); |
46 | void findShow(bool); | 47 | void findShow(bool); |
47 | void filterList(); | 48 | void filterList(); |
48 | 49 | ||
49 | private: | 50 | private: |
50 | void makeMenu(); | 51 | void makeMenu(); |
51 | void setSections(); | 52 | void setSections(); |
52 | void setSubSections(); | 53 | void setSubSections(); |
53 | 54 | ||
54 | PmIpkg* ipkg; | 55 | PmIpkg* ipkg; |
55 | PackageManagerSettings *settings; | 56 | PackageManagerSettings *settings; |
56 | PackageDetails* details; | 57 | PackageDetails* details; |
57 | PackageList packageList; | 58 | PackageList packageList; |
58 | Package *activePackage; | 59 | Package *activePackage; |
59 | QAction *runAction; | 60 | QAction *runAction; |
60 | QAction *detailsAction; | 61 | QAction *detailsAction; |
61 | QAction *updateAction; | 62 | QAction *updateAction; |
62 | QAction *findAction; | 63 | QAction *findAction; |
63 | QAction *sectionAction; | 64 | QAction *sectionAction; |
64 | QListView *listViewPackages; | 65 | QListView *listViewPackages; |
65 | QPopupMenu *contextMenu; | 66 | QPopupMenu *contextMenu; |
66 | QPEToolBar *findBar; | 67 | QPEToolBar *findBar; |
67 | QLineEdit *findEdit; | 68 | QLineEdit *findEdit; |
68 | QPEToolBar *sectionBar; | 69 | QPEToolBar *sectionBar; |
69 | QComboBox *section; | 70 | QComboBox *section; |
70 | QComboBox *subsection; | 71 | QComboBox *subsection; |
71 | QPopupMenu *popupMenu; | 72 | QPopupMenu *popupMenu; |
73 | bool updateIcon; | ||
74 | private slots: | ||
75 | void rotateUpdateIcon(); | ||
72 | }; | 76 | }; |
73 | 77 | ||
74 | #endif | 78 | #endif |
diff --git a/noncore/unsupported/oipkg/pksettings.h b/noncore/unsupported/oipkg/pksettings.h index cda352a..2982f1c 100644 --- a/noncore/unsupported/oipkg/pksettings.h +++ b/noncore/unsupported/oipkg/pksettings.h | |||
@@ -1,62 +1,61 @@ | |||
1 | #ifndef PACKAGEMANAGERSETTINGS_H | 1 | #ifndef PACKAGEMANAGERSETTINGS_H |
2 | #define PACKAGEMANAGERSETTINGS_H | 2 | #define PACKAGEMANAGERSETTINGS_H |
3 | 3 | ||
4 | #include "pksettingsbase.h" | 4 | #include "pksettingsbase.h" |
5 | #include <qintdict.h> | 5 | #include <qintdict.h> |
6 | 6 | ||
7 | 7 | ||
8 | class PackageManagerSettings : private PackageManagerSettingsBase | 8 | class PackageManagerSettings : private PackageManagerSettingsBase |
9 | { | 9 | { |
10 | // Q_OBJECT | 10 | // Q_OBJECT |
11 | public: | 11 | public: |
12 | PackageManagerSettings( QWidget* , const char* , WFlags ); | 12 | PackageManagerSettings( QWidget* , const char* , WFlags ); |
13 | ~PackageManagerSettings(); | 13 | ~PackageManagerSettings(); |
14 | 14 | ||
15 | bool showDialog( int ) ; | 15 | bool showDialog( int ) ; |
16 | QString getDestinationUrl(); | 16 | QString getDestinationUrl(); |
17 | QString getDestinationName(); | 17 | QString getDestinationName(); |
18 | QString getLinkDestinationName(); | 18 | QString getLinkDestinationName(); |
19 | bool createLinks(); | 19 | bool createLinks(); |
20 | QStringList getActiveServers(); | 20 | QStringList getActiveServers(); |
21 | QStringList getDestinationUrls(); | 21 | QStringList getDestinationUrls(); |
22 | |||
23 | private: | 22 | private: |
24 | QIntDict<QString> serverurlDic; | 23 | QIntDict<QString> serverurlDic; |
25 | QIntDict<QString> destinationurlDic; | 24 | QIntDict<QString> destinationurlDic; |
26 | int ipkg_old; | 25 | int ipkg_old; |
27 | int editedserver; | 26 | int editedserver; |
28 | int editeddestination; | 27 | int editeddestination; |
29 | int currentSetting; | 28 | int currentSetting; |
30 | int installationSettingsCount; | 29 | int installationSettingsCount; |
31 | bool changed; | 30 | bool changed; |
32 | 31 | ||
33 | bool readIpkgConfig(const QString&); | 32 | bool readIpkgConfig(const QString&); |
34 | void writeIpkgConfig(const QString&); | 33 | void writeIpkgConfig(const QString&); |
35 | void writeSettings(); | 34 | void writeSettings(); |
36 | void readSettings(); | 35 | void readSettings(); |
37 | 36 | ||
38 | public slots: | 37 | public slots: |
39 | void writeInstallationSettings(); | 38 | void writeInstallationSettings(); |
40 | void readInstallationSettings(); | 39 | void readInstallationSettings(); |
41 | void writeCurrentInstallationSetting(); | 40 | void writeCurrentInstallationSetting(); |
42 | void readInstallationSetting(int); | 41 | void readInstallationSetting(int); |
43 | void installationSettingSetName(const QString &); | 42 | void installationSettingSetName(const QString &); |
44 | 43 | ||
45 | void newServer(); | 44 | void newServer(); |
46 | void editServer(int); | 45 | void editServer(int); |
47 | void removeDestination(); | 46 | void removeDestination(); |
48 | void newDestination(); | 47 | void newDestination(); |
49 | void editDestination(int); | 48 | void editDestination(int); |
50 | void linkEnabled(bool); | 49 | void linkEnabled(bool); |
51 | void removeServer(); | 50 | void removeServer(); |
52 | void serverNameChanged(const QString&); | 51 | void serverNameChanged(const QString&); |
53 | void serverUrlChanged(const QString&); | 52 | void serverUrlChanged(const QString&); |
54 | void destNameChanged(const QString&); | 53 | void destNameChanged(const QString&); |
55 | void destUrlChanged(const QString&); | 54 | void destUrlChanged(const QString&); |
56 | void installationSettingChange(int); | 55 | void installationSettingChange(int); |
57 | void newInstallationSetting(); | 56 | void newInstallationSetting(); |
58 | void removeInstallationSetting(); | 57 | void removeInstallationSetting(); |
59 | void renameInstallationSetting(); | 58 | void renameInstallationSetting(); |
60 | }; | 59 | }; |
61 | 60 | ||
62 | #endif | 61 | #endif |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index b23b9ea..eae73ad 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -1,93 +1,101 @@ | |||
1 | #include "pmipkg.h" | 1 | #include "pmipkg.h" |
2 | #include "pkdesc.h" | 2 | #include "pkdesc.h" |
3 | #include "pksettings.h" | 3 | #include "pksettings.h" |
4 | #include "package.h" | 4 | #include "package.h" |
5 | #include "packagelistitem.h" | 5 | #include "packagelistitem.h" |
6 | 6 | ||
7 | #include <qpe/process.h> | 7 | #include <qpe/process.h> |
8 | #include <qpe/resource.h> | 8 | #include <qpe/resource.h> |
9 | #include <qpe/config.h> | 9 | #include <qpe/config.h> |
10 | #include <qpe/stringutil.h> | 10 | #include <qpe/stringutil.h> |
11 | #include <qpe/qcopenvelope_qws.h> | 11 | #include <qpe/qcopenvelope_qws.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qfile.h> | 13 | #include <qfile.h> |
14 | #include <qmultilineedit.h> | 14 | #include <qmultilineedit.h> |
15 | #include <qstring.h> | 15 | #include <qstring.h> |
16 | #include <qtextstream.h> | 16 | #include <qtextstream.h> |
17 | #include <qtextview.h> | 17 | #include <qtextview.h> |
18 | 18 | ||
19 | #include <qprogressbar.h> | 19 | #include <qprogressbar.h> |
20 | #include <qpushbutton.h> | 20 | #include <qpushbutton.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | 22 | ||
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | #include <unistd.h> | 24 | #include <unistd.h> |
25 | 25 | ||
26 | #include "mainwindow.h" | 26 | #include "mainwindow.h" |
27 | 27 | ||
28 | 28 | ||
29 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) | 29 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) |
30 | : QObject ( p ) | 30 | : QObject ( p ) |
31 | { | 31 | { |
32 | settings = s; | 32 | settings = s; |
33 | runwindowopen = false; | 33 | runwindowopen = false; |
34 | runwindow = new RunWindow( p, name, true, f ); | 34 | runwindow = new RunWindow( p, name, true, f ); |
35 | } | 35 | } |
36 | 36 | ||
37 | PmIpkg::~PmIpkg() | 37 | PmIpkg::~PmIpkg() |
38 | { | 38 | { |
39 | } | 39 | } |
40 | 40 | ||
41 | //#define PROC | 41 | //#define PROC |
42 | #define SYSTEM | 42 | #define SYSTEM |
43 | int PmIpkg::runIpkg(const QString& args) | 43 | int PmIpkg::runIpkg(const QString& args) |
44 | { | 44 | { |
45 | pvDebug(2,"PmIpkg::runIpkg "+args); | 45 | pvDebug(2,"PmIpkg::runIpkg "+args); |
46 | |||
47 | //to make script ipkg happy | ||
48 | pvDebug(2, "cd "+settings->getDestinationUrl()+"/tmp/ipkg"); | ||
49 | if (!QDir::setCurrent(settings->getDestinationUrl()+"/tmp/ipkg")) | ||
50 | { | ||
51 | QDir instDir = QDir(settings->getDestinationUrl()+"/tmp/ipkg"); | ||
52 | instDir.mkdir(settings->getDestinationUrl()+"/tmp/ipkg"); | ||
53 | } | ||
46 | #ifdef PROC | 54 | #ifdef PROC |
47 | QStringList cmd = "/usr/bin/ipkg "; | 55 | QStringList cmd = "/usr/bin/ipkg "; |
48 | #endif | 56 | #endif |
49 | #ifdef SYSTEM | 57 | #ifdef SYSTEM |
50 | QString cmd = "/usr/bin/ipkg "; | 58 | QString cmd = "/usr/bin/ipkg "; |
51 | #endif | 59 | #endif |
52 | cmd += " -dest "+settings->getDestinationName(); | 60 | cmd += " -dest "+settings->getDestinationName(); |
53 | cmd += " -force-defaults "; | 61 | cmd += " -force-defaults "; |
54 | 62 | ||
55 | out( "<hr><br>Starting to "+ args+"<br>\n"); | 63 | out( "<hr><br>Starting to "+ args+"<br>\n"); |
56 | cmd += args; | 64 | cmd += args; |
57 | out( "running:<br>\n"+cmd+"<br>\n" ); | 65 | out( "running:<br>\n"+cmd+"<br>\n" ); |
58 | int r = 0; | 66 | int r = 0; |
59 | #ifdef PROC | 67 | #ifdef PROC |
60 | QString o = "start"; | 68 | QString o = "start"; |
61 | Process ipkg( cmd ); | 69 | Process ipkg( cmd ); |
62 | QString description; | 70 | QString description; |
63 | ipkg.exec("",o); | 71 | ipkg.exec("",o); |
64 | out( o ); | 72 | out( o ); |
65 | #endif | 73 | #endif |
66 | #ifdef SYSTEM | 74 | #ifdef SYSTEM |
67 | QString redirect = "/tmp/oipkg.pipe"; | 75 | QString redirect = "/tmp/oipkg.pipe"; |
68 | cmd += " | tee "+redirect+" 2>&1"; | 76 | cmd += " | tee "+redirect+" 2>&1"; |
69 | pvDebug(2, "running >"+cmd+"<"); | 77 | pvDebug(2, "running >"+cmd+"<"); |
70 | r = system(cmd.latin1()); | 78 | r = system(cmd.latin1()); |
71 | QFile f( redirect ); | 79 | QFile f( redirect ); |
72 | QString line; | 80 | QString line; |
73 | QString oldLine; | 81 | QString oldLine; |
74 | while ( ! f.open(IO_ReadOnly) ) {}; | 82 | while ( ! f.open(IO_ReadOnly) ) {}; |
75 | { | 83 | { |
76 | QTextStream t( &f ); | 84 | QTextStream t( &f ); |
77 | // QString fp; | 85 | // QString fp; |
78 | while ( !t.eof() ) | 86 | while ( !t.eof() ) |
79 | { | 87 | { |
80 | line = t.readLine(); | 88 | line = t.readLine(); |
81 | if ( line != oldLine ) out( line +"<br>" ); | 89 | if ( line != oldLine ) out( line +"<br>" ); |
82 | oldLine = line; | 90 | oldLine = line; |
83 | } | 91 | } |
84 | } | 92 | } |
85 | f.close(); | 93 | f.close(); |
86 | out( "Finished!<br>"); | 94 | out( "Finished!<br>"); |
87 | #endif | 95 | #endif |
88 | 96 | ||
89 | return r; | 97 | return r; |
90 | } | 98 | } |
91 | 99 | ||
92 | void PmIpkg::makeLinks(QString pack) | 100 | void PmIpkg::makeLinks(QString pack) |
93 | { | 101 | { |
@@ -108,190 +116,237 @@ void PmIpkg::makeLinks(QString pack) | |||
108 | }; | 116 | }; |
109 | QTextStream t( &f ); | 117 | QTextStream t( &f ); |
110 | QString fp; | 118 | QString fp; |
111 | while ( !t.eof() ) | 119 | while ( !t.eof() ) |
112 | { | 120 | { |
113 | fp = t.readLine(); | 121 | fp = t.readLine(); |
114 | processLinkDir( fp, dest ); | 122 | processLinkDir( fp, dest ); |
115 | } | 123 | } |
116 | f.close(); | 124 | f.close(); |
117 | } | 125 | } |
118 | 126 | ||
119 | void PmIpkg::processLinkDir( QString file, QString dest ) | 127 | void PmIpkg::processLinkDir( QString file, QString dest ) |
120 | { | 128 | { |
121 | QString destFile = file; | 129 | QString destFile = file; |
122 | file = dest+"/"+file; | 130 | file = dest+"/"+file; |
123 | QFileInfo fileInfo( file ); | 131 | QFileInfo fileInfo( file ); |
124 | if ( fileInfo.isDir() ) | 132 | if ( fileInfo.isDir() ) |
125 | { | 133 | { |
126 | QDir destDir( destFile ); | 134 | QDir destDir( destFile ); |
127 | destDir.mkdir( destFile, true ); | 135 | destDir.mkdir( destFile, true ); |
128 | QDir d( file ); | 136 | QDir d( file ); |
129 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 137 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
130 | const QFileInfoList *list = d.entryInfoList(); | 138 | const QFileInfoList *list = d.entryInfoList(); |
131 | QFileInfoListIterator it( *list ); | 139 | QFileInfoListIterator it( *list ); |
132 | QFileInfo *fi; | 140 | QFileInfo *fi; |
133 | while ( (fi=it.current()) ) | 141 | while ( (fi=it.current()) ) |
134 | { | 142 | { |
135 | // out( "<b>"+fi->absFilePath()+"</b>" ); | 143 | // out( "<b>"+fi->absFilePath()+"</b>" ); |
136 | processLinkDir( fi->absFilePath(), dest ); | 144 | processLinkDir( fi->absFilePath(), dest ); |
137 | ++it; | 145 | ++it; |
138 | } | 146 | } |
139 | } else | 147 | } else |
140 | if ( fileInfo.isFile() ) | 148 | if ( fileInfo.isFile() ) |
141 | { | 149 | { |
142 | const char *instFile = strdup( (file).ascii() ); | 150 | const char *instFile = strdup( (file).ascii() ); |
143 | const char *linkFile = strdup( (destFile).ascii()); | 151 | const char *linkFile = strdup( (destFile).ascii()); |
144 | // out( "linking: "+file+" -> "+destFile ); | 152 | // out( "linking: "+file+" -> "+destFile ); |
145 | qDebug( "linking: %s -> %s", instFile, linkFile ); | 153 | qDebug( "linking: %s -> %s", instFile, linkFile ); |
146 | symlink( instFile, linkFile ); | 154 | symlink( instFile, linkFile ); |
147 | } | 155 | } |
148 | } | 156 | } |
149 | 157 | ||
150 | void PmIpkg::commit( PackageList pl ) | 158 | void PmIpkg::commit( PackageList pl ) |
151 | { | 159 | { |
152 | show( false ); | 160 | show( false ); |
153 | runwindow->outPut->setText(""); | 161 | runwindow->outPut->setText(""); |
154 | out( "<h1>"+tr("Todo")+"</h1>\n"); | 162 | out( "<h1>"+tr("Todo")+"</h1>\n"); |
155 | 163 | ||
164 | to_install.clear(); | ||
165 | to_remove.clear(); | ||
166 | int sizecount = 0; | ||
156 | QString rem="<b>To remove:</b><br>\n"; | 167 | QString rem="<b>To remove:</b><br>\n"; |
157 | QString inst="<b>To install:</b><br>\n";; | 168 | QString inst="<b>To install:</b><br>\n";; |
158 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) | 169 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) |
159 | { | 170 | { |
160 | if ( pack && (pack->name() != "") && pack) | 171 | if ( pack && (pack->name() != "") && pack) |
161 | { | 172 | { |
162 | if ( pack->toInstall() ) | 173 | if ( pack->toInstall() ) |
163 | { | 174 | { |
175 | #ifndef NEWLIST | ||
164 | to_install.append( pack->name() ); | 176 | to_install.append( pack->name() ); |
177 | #endif | ||
178 | #ifdef NEWLIST | ||
179 | to_install.append( pack ); | ||
180 | sizecount += pack->size().toInt(); | ||
181 | #endif | ||
165 | inst += pack->name()+"<br>"; | 182 | inst += pack->name()+"<br>"; |
166 | } | 183 | } |
167 | if ( pack->toRemove() ) | 184 | if ( pack->toRemove() ) |
168 | { | 185 | { |
186 | #ifndef NEWLIST | ||
169 | to_remove.append( pack->name() ); | 187 | to_remove.append( pack->name() ); |
188 | #endif | ||
189 | #ifdef NEWLIST | ||
190 | to_remove.append( pack ); | ||
191 | sizecount += 1; | ||
192 | #endif | ||
170 | rem += pack->name()+"<br>"; | 193 | rem += pack->name()+"<br>"; |
171 | } | 194 | } |
172 | } | 195 | } |
173 | } | 196 | } |
174 | 197 | ||
175 | out("<p>"+inst+"</p>"+"<p>"+rem+"</p><hl>"); | 198 | out("<p>"+inst+"</p>"+"<p>"+rem+"</p><hl>"); |
176 | 199 | ||
177 | qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count()); | 200 | qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count()); |
178 | 201 | ||
202 | runwindow->progress->setTotalSteps( sizecount ); | ||
203 | |||
179 | connect( runwindow->doItButton, SIGNAL( clicked() ), | 204 | connect( runwindow->doItButton, SIGNAL( clicked() ), |
180 | SLOT( doIt() ) ); | 205 | SLOT( doIt() ) ); |
181 | connect( runwindow->installButton, SIGNAL( clicked() ), | 206 | connect( runwindow->installButton, SIGNAL( clicked() ), |
182 | this, SLOT( install() ) ); | 207 | this, SLOT( install() ) ); |
183 | connect( runwindow->removeButton, SIGNAL( clicked() ), | 208 | connect( runwindow->removeButton, SIGNAL( clicked() ), |
184 | this, SLOT( remove() ) ); | 209 | this, SLOT( remove() ) ); |
185 | connect( runwindow->cancelButton, SIGNAL( clicked() ), | 210 | connect( runwindow->cancelButton, SIGNAL( clicked() ), |
186 | runwindow, SLOT( close() ) ); | 211 | runwindow, SLOT( close() ) ); |
187 | 212 | ||
188 | runwindow->exec(); | 213 | runwindow->exec(); |
189 | // ##### If we looked in the list of files, we could send out accurate | 214 | // ##### If we looked in the list of files, we could send out accurate |
190 | // ##### messages. But we don't bother yet, and just do an "all". | 215 | // ##### messages. But we don't bother yet, and just do an "all". |
191 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 216 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
192 | QString lf = QString::null; | 217 | QString lf = QString::null; |
193 | e << lf; | 218 | e << lf; |
194 | return; | 219 | return; |
195 | } | 220 | } |
196 | 221 | ||
197 | void PmIpkg::doIt() | 222 | void PmIpkg::doIt() |
198 | { | 223 | { |
199 | remove(); | 224 | remove(); |
200 | install(); | 225 | install(); |
201 | } | 226 | } |
202 | 227 | ||
203 | 228 | ||
204 | void PmIpkg::remove() | 229 | void PmIpkg::remove() |
205 | { | 230 | { |
206 | if ( to_remove.count() == 0 ) return; | 231 | if ( to_remove.count() == 0 ) return; |
207 | show( true ); | 232 | show( true ); |
208 | 233 | ||
209 | out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>"); | 234 | out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>"); |
210 | for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it) | 235 | |
211 | { | 236 | #ifndef NEWLIST |
237 | for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it) | ||
238 | { | ||
212 | if ( runIpkg("remove " + *it) == 0) | 239 | if ( runIpkg("remove " + *it) == 0) |
213 | { | 240 | { |
214 | 241 | ||
215 | }else{ | 242 | }else{ |
216 | out("<b>"+tr("Error while removing")+"</b>"+*it); | 243 | out("<b>"+tr("Error while removing")+"</b>"+*it); |
217 | } | 244 | } |
218 | } | 245 | } |
246 | #endif | ||
247 | #ifdef NEWLIST | ||
248 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | ||
249 | { | ||
250 | if ( runIpkg("remove " + it->name()) == 0) | ||
251 | { | ||
252 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | ||
253 | it->processed(); | ||
254 | runwindow->progress->setProgress( 1 ); | ||
255 | }else{ | ||
256 | out("<b>"+tr("Error while removing")+"</b>"+it->name()); | ||
257 | } | ||
258 | } | ||
259 | #endif | ||
219 | } | 260 | } |
220 | 261 | ||
221 | 262 | ||
222 | void PmIpkg::install() | 263 | void PmIpkg::install() |
223 | { | 264 | { |
224 | if ( to_install.count() == 0 ) return; | 265 | if ( to_install.count() == 0 ) return; |
225 | show( true ); | 266 | show( true ); |
226 | out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"<b><br>"); | 267 | out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); |
227 | if ( to_install.count() ) | 268 | #ifndef NEWLIST |
228 | for (QStringList::ConstIterator it=to_install.begin(); it!=to_install.end(); ++it) | 269 | for (QStringList::ConstIterator it=to_install.begin(); it!=to_install.end(); ++it) |
229 | { | 270 | { |
230 | if ( runIpkg("install " + *it) == 0 ) | 271 | if ( runIpkg("install " + *it) == 0 ) |
231 | { | 272 | { |
232 | if ( settings->createLinks() ) | 273 | if ( settings->createLinks() ) |
233 | makeLinks( *it ); | 274 | makeLinks( *it ); |
234 | }else{ | 275 | }else{ |
235 | out("<b>"+tr("Error while installing")+"</b>"+*it); | 276 | out("<b>"+tr("Error while installing")+"</b>"+*it); |
236 | } | 277 | } |
237 | } | 278 | } |
238 | 279 | #endif | |
280 | #ifdef NEWLIST | ||
281 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | ||
282 | { | ||
283 | if ( runIpkg("install " + it->name()) == 0 ) | ||
284 | { | ||
285 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | ||
286 | if ( settings->createLinks() ) | ||
287 | makeLinks( it->name() ); | ||
288 | it->processed(); | ||
289 | }else{ | ||
290 | out("<b>"+tr("Error while installing")+"</b>"+it->name()); | ||
291 | } | ||
292 | } | ||
293 | #endif | ||
239 | } | 294 | } |
240 | 295 | ||
241 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) | 296 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) |
242 | // add 3rd package parameter | 297 | // add 3rd package parameter |
243 | { | 298 | { |
244 | qDebug("msg="+msg+" -- "+QString(dest) ); | 299 | qDebug("msg="+msg+" -- "+QString(dest) ); |
245 | // QDir d( src ); | 300 | // QDir d( src ); |
246 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 301 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
247 | //// if (! d.exists() ) return; | 302 | //// if (! d.exists() ) return; |
248 | // const QFileInfoList *list = d.entryInfoList(); | 303 | // const QFileInfoList *list = d.entryInfoList(); |
249 | // QFileInfoListIterator it( *list ); | 304 | // QFileInfoListIterator it( *list ); |
250 | // QFileInfo *fi; | 305 | // QFileInfo *fi; |
251 | // while ( (fi=it.current()) ) { | 306 | // while ( (fi=it.current()) ) { |
252 | // processLinkDir( fi->absFilePath(), dest ); | 307 | // processLinkDir( fi->absFilePath(), dest ); |
253 | // ++it; | 308 | // ++it; |
254 | // } | 309 | // } |
255 | } | 310 | } |
256 | 311 | ||
257 | void PmIpkg::update() | 312 | void PmIpkg::update() |
258 | { | 313 | { |
259 | show( false ); | 314 | show( false ); |
260 | runIpkg( "update" ); | 315 | runIpkg( "update" ); |
261 | runwindow->close(); | 316 | runwindow->close(); |
262 | } | 317 | } |
263 | 318 | ||
264 | void PmIpkg::out( QString o ) | 319 | void PmIpkg::out( QString o ) |
265 | { | 320 | { |
266 | runwindow->outPut->setText( runwindow->outPut->text()+o ); | 321 | runwindow->outPut->setText( runwindow->outPut->text()+o ); |
267 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); | 322 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); |
268 | } | 323 | } |
269 | 324 | ||
270 | 325 | ||
271 | void PmIpkg::showButtons(bool b) | 326 | void PmIpkg::showButtons(bool b) |
272 | { | 327 | { |
273 | if ( b ) | 328 | if ( b ) |
274 | { | 329 | { |
275 | runwindow->cancelButton->hide(); | 330 | runwindow->cancelButton->hide(); |
276 | runwindow->doItButton->hide(); | 331 | runwindow->doItButton->hide(); |
277 | runwindow->removeButton->hide(); | 332 | runwindow->removeButton->hide(); |
278 | runwindow->installButton->hide(); | 333 | runwindow->installButton->hide(); |
279 | }else{ | 334 | }else{ |
280 | runwindow->cancelButton->show(); | 335 | runwindow->cancelButton->show(); |
281 | runwindow->doItButton->show(); | 336 | runwindow->doItButton->show(); |
282 | runwindow->removeButton->show(); | 337 | runwindow->removeButton->show(); |
283 | runwindow->installButton->show(); | 338 | runwindow->installButton->show(); |
284 | 339 | ||
285 | } | 340 | } |
286 | } | 341 | } |
287 | 342 | ||
288 | void PmIpkg::show(bool b) | 343 | void PmIpkg::show(bool b) |
289 | { | 344 | { |
290 | if (!runwindow->isVisible()) | 345 | if (!runwindow->isVisible()) |
291 | runwindow->showMaximized(); | 346 | runwindow->showMaximized(); |
292 | showButtons(b); | 347 | showButtons(b); |
293 | if ( b ) | 348 | //if ( b ) |
294 | runwindow->progress->show(); | 349 | runwindow->progress->hide(); |
295 | else | 350 | // else |
296 | runwindow->progress->show(); | 351 | // runwindow->progress->show(); |
297 | } | 352 | } |
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index 8718f49..2692017 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -1,48 +1,55 @@ | |||
1 | #ifndef PMIPKG_H | 1 | #ifndef PMIPKG_H |
2 | #define PMIPKG_H | 2 | #define PMIPKG_H |
3 | 3 | ||
4 | 4 | ||
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | #include <qlist.h> | ||
6 | #include <qstring.h> | 7 | #include <qstring.h> |
7 | #include <qwidget.h> | 8 | #include <qwidget.h> |
8 | #include "pksettings.h" | 9 | #include "pksettings.h" |
9 | #include "runwindow.h" | 10 | #include "runwindow.h" |
10 | #include "packagelist.h" | 11 | #include "packagelist.h" |
11 | #include "debug.h" | 12 | #include "debug.h" |
12 | 13 | ||
13 | 14 | //#define NEWLIST | |
14 | 15 | class Package; | |
15 | class PmIpkg : public QObject | 16 | class PmIpkg : public QObject |
16 | { | 17 | { |
17 | Q_OBJECT | 18 | Q_OBJECT |
18 | public: | 19 | public: |
19 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); | 20 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); |
20 | ~PmIpkg(); | 21 | ~PmIpkg(); |
21 | 22 | ||
22 | void commit( PackageList ); | 23 | void commit( PackageList ); |
23 | void update(); | 24 | void update(); |
24 | PackageList* getPackageList(); | 25 | PackageList* getPackageList(); |
25 | void showButtons(bool b=true); | 26 | void showButtons(bool b=true); |
26 | void show( bool buttons=true ); | 27 | void show( bool buttons=true ); |
27 | 28 | ||
28 | private: | 29 | private: |
29 | PackageManagerSettings* settings; | 30 | PackageManagerSettings* settings; |
30 | RunWindow *runwindow; | 31 | RunWindow *runwindow; |
32 | #ifndef NEWLIST | ||
31 | QStringList to_remove; | 33 | QStringList to_remove; |
32 | QStringList to_install; | 34 | QStringList to_install; |
35 | #endif | ||
36 | #ifdef NEWLIST | ||
37 | QList<Package> to_remove; | ||
38 | QList<Package> to_install; | ||
39 | #endif | ||
33 | bool runwindowopen; | 40 | bool runwindowopen; |
34 | 41 | ||
35 | void makeLinks(QString); | 42 | void makeLinks(QString); |
36 | void processLinkDir( QString, QString ); | 43 | void processLinkDir( QString, QString ); |
37 | 44 | ||
38 | int runIpkg(const QString& args); | 45 | int runIpkg(const QString& args); |
39 | void out( QString ); | 46 | void out( QString ); |
40 | 47 | ||
41 | public slots: | 48 | public slots: |
42 | void doIt(); | 49 | void doIt(); |
43 | void install(); | 50 | void install(); |
44 | void remove(); | 51 | void remove(); |
45 | void linkDestination( const QString, const QByteArray ); | 52 | void linkDestination( const QString, const QByteArray ); |
46 | }; | 53 | }; |
47 | 54 | ||
48 | #endif | 55 | #endif |
diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h index d4b1072..5df522b 100644 --- a/noncore/unsupported/oipkg/settings.h +++ b/noncore/unsupported/oipkg/settings.h | |||
@@ -1,62 +1,65 @@ | |||
1 | #ifndef PACKAGEMANAGERSETTINGS_H | 1 | #ifndef PACKAGEMANAGERSETTINGS_H |
2 | #define PACKAGEMANAGERSETTINGS_H | 2 | #define PACKAGEMANAGERSETTINGS_H |
3 | 3 | ||
4 | #include "pksettingsbase.h" | 4 | #include "pksettingsbase.h" |
5 | #include <qintdict.h> | 5 | #include <qintdict.h> |
6 | 6 | ||
7 | 7 | ||
8 | class PackageManagerSettings : private PackageManagerSettingsBase | 8 | class PackageManagerSettings : public PackageManagerSettingsBase |
9 | //class PackageManagerSettings : private PackageManagerSettingsBase | ||
9 | { | 10 | { |
10 | // Q_OBJECT | 11 | // Q_OBJECT |
11 | public: | 12 | public: |
12 | PackageManagerSettings( QWidget* , const char* , WFlags ); | 13 | PackageManagerSettings( QWidget* , const char* , WFlags ); |
13 | ~PackageManagerSettings(); | 14 | ~PackageManagerSettings(); |
14 | 15 | ||
15 | bool showDialog( int ) ; | 16 | bool showDialog( int ) ; |
16 | QString getDestinationUrl(); | 17 | QString getDestinationUrl(); |
17 | QString getDestinationName(); | 18 | QString getDestinationName(); |
18 | QString getLinkDestinationName(); | 19 | QString getLinkDestinationName(); |
19 | bool createLinks(); | 20 | bool createLinks(); |
20 | QStringList getActiveServers(); | 21 | QStringList getActiveServers(); |
21 | QStringList getDestinationUrls(); | 22 | QStringList getDestinationUrls(); |
23 | /** No descriptions */ | ||
24 | QComboBox getActiveDestinationCombo(); | ||
22 | 25 | ||
23 | private: | 26 | private: |
24 | QIntDict<QString> serverurlDic; | 27 | QIntDict<QString> serverurlDic; |
25 | QIntDict<QString> destinationurlDic; | 28 | QIntDict<QString> destinationurlDic; |
26 | int ipkg_old; | 29 | int ipkg_old; |
27 | int editedserver; | 30 | int editedserver; |
28 | int editeddestination; | 31 | int editeddestination; |
29 | int currentSetting; | 32 | int currentSetting; |
30 | int installationSettingsCount; | 33 | int installationSettingsCount; |
31 | bool changed; | 34 | bool changed; |
32 | 35 | ||
33 | bool readIpkgConfig(const QString&); | 36 | bool readIpkgConfig(const QString&); |
34 | void writeIpkgConfig(const QString&); | 37 | void writeIpkgConfig(const QString&); |
35 | void writeSettings(); | 38 | void writeSettings(); |
36 | void readSettings(); | 39 | void readSettings(); |
37 | 40 | ||
38 | public slots: | 41 | public slots: |
39 | void writeInstallationSettings(); | 42 | void writeInstallationSettings(); |
40 | void readInstallationSettings(); | 43 | void readInstallationSettings(); |
41 | void writeCurrentInstallationSetting(); | 44 | void writeCurrentInstallationSetting(); |
42 | void readInstallationSetting(int); | 45 | void readInstallationSetting(int); |
43 | void installationSettingSetName(const QString &); | 46 | void installationSettingSetName(const QString &); |
44 | 47 | ||
45 | void newServer(); | 48 | void newServer(); |
46 | void editServer(int); | 49 | void editServer(int); |
47 | void removeDestination(); | 50 | void removeDestination(); |
48 | void newDestination(); | 51 | void newDestination(); |
49 | void editDestination(int); | 52 | void editDestination(int); |
50 | void linkEnabled(bool); | 53 | void linkEnabled(bool); |
51 | void removeServer(); | 54 | void removeServer(); |
52 | void serverNameChanged(const QString&); | 55 | void serverNameChanged(const QString&); |
53 | void serverUrlChanged(const QString&); | 56 | void serverUrlChanged(const QString&); |
54 | void destNameChanged(const QString&); | 57 | void destNameChanged(const QString&); |
55 | void destUrlChanged(const QString&); | 58 | void destUrlChanged(const QString&); |
56 | void installationSettingChange(int); | 59 | void installationSettingChange(int); |
57 | void newInstallationSetting(); | 60 | void newInstallationSetting(); |
58 | void removeInstallationSetting(); | 61 | void removeInstallationSetting(); |
59 | void renameInstallationSetting(); | 62 | void renameInstallationSetting(); |
60 | }; | 63 | }; |
61 | 64 | ||
62 | #endif | 65 | #endif |