author | tille <tille> | 2002-05-12 14:06:06 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-12 14:06:06 (UTC) |
commit | f388350086510b261c496c232da7302f4ec81cc3 (patch) (unidiff) | |
tree | 472aad42f650028bfd7fae66be6a19f37e2a26e0 | |
parent | c1f023c19bbee54a3a0575bd6035b133592edcfc (diff) | |
download | opie-f388350086510b261c496c232da7302f4ec81cc3.zip opie-f388350086510b261c496c232da7302f4ec81cc3.tar.gz opie-f388350086510b261c496c232da7302f4ec81cc3.tar.bz2 |
fixed filename for remote files
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 24 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.h | 3 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 4 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.cpp | 5 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistremote.cpp | 2 |
6 files changed, 8 insertions, 32 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 1c56aae..9c4c752 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,112 +1,108 @@ | |||
1 | // adadpted form qpe/qipkg | 1 | // adadpted form qpe/qipkg |
2 | 2 | ||
3 | 3 | ||
4 | #include "mainwindow.h" | 4 | #include "mainwindow.h" |
5 | 5 | ||
6 | #include <qpe/qpemenubar.h> | 6 | #include <qpe/qpemenubar.h> |
7 | #include <qpe/qpemessagebox.h> | 7 | #include <qpe/qpemessagebox.h> |
8 | #include <qpe/resource.h> | 8 | #include <qpe/resource.h> |
9 | #include <qpe/config.h> | 9 | #include <qpe/config.h> |
10 | #include <qpe/qpetoolbar.h> | 10 | #include <qpe/qpetoolbar.h> |
11 | #include <qpe/qcopenvelope_qws.h> | 11 | #include <qpe/qcopenvelope_qws.h> |
12 | #include <qaction.h> | 12 | #include <qaction.h> |
13 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
14 | #include <qpopupmenu.h> | 14 | #include <qpopupmenu.h> |
15 | #include <qtoolbutton.h> | 15 | #include <qtoolbutton.h> |
16 | #include <qstring.h> | 16 | #include <qstring.h> |
17 | #include <qlabel.h> | 17 | #include <qlabel.h> |
18 | #include <qfile.h> | 18 | #include <qfile.h> |
19 | #include <qlistview.h> | 19 | #include <qlistview.h> |
20 | #include <qtextview.h> | 20 | #include <qtextview.h> |
21 | #include <qcheckbox.h> | 21 | #include <qcheckbox.h> |
22 | #include <qlineedit.h> | 22 | #include <qlineedit.h> |
23 | #include <qtabwidget.h> | 23 | #include <qtabwidget.h> |
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qmessagebox.h> | 25 | #include <qmessagebox.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | 28 | ||
29 | #include "pksettingsbase.h" | 29 | #include "pksettingsbase.h" |
30 | #include "utils.h" | 30 | #include "utils.h" |
31 | #include "packagelistitem.h" | 31 | #include "packagelistitem.h" |
32 | 32 | ||
33 | 33 | ||
34 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | 34 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : |
35 | QMainWindow( parent, name, f ) | 35 | QMainWindow( parent, name, f ) |
36 | { | 36 | { |
37 | setCaption( tr("Package Manager") ); | 37 | setCaption( tr("Package Manager") ); |
38 | settings = new PackageManagerSettings(this,0,TRUE); | 38 | settings = new PackageManagerSettings(this,0,TRUE); |
39 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); | 39 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); |
40 | setCentralWidget( listViewPackages ); | 40 | setCentralWidget( listViewPackages ); |
41 | listViewPackages->addList( tr("feeds"), &packageListServers ); | 41 | listViewPackages->addList( tr("feeds"), &packageListServers ); |
42 | listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); | 42 | listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); |
43 | listViewPackages->addList( tr("documents"), &packageListDocLnk ); | 43 | listViewPackages->addList( tr("documents"), &packageListDocLnk ); |
44 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); | ||
45 | //wait = new QMessageBox(this); | ||
46 | // wait->setText(tr("Please wait")); | ||
47 | ipkg = new PmIpkg( settings, this ); | 44 | ipkg = new PmIpkg( settings, this ); |
48 | // settings->setIpkg( ipkg ); | ||
49 | packageListServers.setSettings( settings ); | 45 | packageListServers.setSettings( settings ); |
50 | packageListSearch.setSettings( settings ); | 46 | packageListSearch.setSettings( settings ); |
51 | packageListDocLnk.setSettings( settings ); | 47 | packageListDocLnk.setSettings( settings ); |
52 | pvDebug(9,"packageListServers.update"); | 48 | pvDebug(9,"packageListServers.update"); |
53 | packageListServers.update(); | 49 | packageListServers.update(); |
54 | pvDebug(9,"packageListDocLnk.update"); | 50 | pvDebug(9,"packageListDocLnk.update"); |
55 | packageListDocLnk.update(); | 51 | packageListDocLnk.update(); |
56 | pvDebug(9,"makeMenu"); | 52 | pvDebug(9,"makeMenu"); |
57 | makeMenu(); | 53 | makeMenu(); |
58 | makeChannel(); | 54 | makeChannel(); |
59 | //opie is hardcoded default ;) | 55 | //opie is hardcoded default ;) |
60 | //pvDebug(9,"section->setCurrentItem"); | 56 | //pvDebug(9,"section->setCurrentItem"); |
61 | // for (int i=0;i<section->count();i++) | 57 | // for (int i=0;i<section->count();i++) |
62 | // if (section->text(i)=="opie") | 58 | // if (section->text(i)=="opie") |
63 | // section->setCurrentItem(i); | 59 | // section->setCurrentItem(i); |
64 | // sectionChanged(); | 60 | // sectionChanged(); |
65 | 61 | ||
66 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); | 62 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); |
67 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); | 63 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); |
68 | 64 | ||
69 | connect( settings->removeLinksButton, SIGNAL( clicked()), | 65 | connect( settings->removeLinksButton, SIGNAL( clicked()), |
70 | SLOT(removeLinks()) ); | 66 | SLOT(removeLinks()) ); |
71 | connect( settings->createLinksButton, SIGNAL( clicked()), | 67 | connect( settings->createLinksButton, SIGNAL( clicked()), |
72 | SLOT(createLinks()) ); | 68 | SLOT(createLinks()) ); |
73 | 69 | ||
74 | pvDebug(9,"displayList"); | 70 | pvDebug(9,"displayList"); |
75 | displayList(); | 71 | displayList(); |
76 | } | 72 | } |
77 | 73 | ||
78 | void MainWindow::makeMenu() | 74 | void MainWindow::makeMenu() |
79 | { | 75 | { |
80 | 76 | ||
81 | QPEToolBar *toolBar = new QPEToolBar( this ); | 77 | QPEToolBar *toolBar = new QPEToolBar( this ); |
82 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 78 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
83 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 79 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
84 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 80 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
85 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 81 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
86 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 82 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
87 | 83 | ||
88 | setToolBarsMovable( false ); | 84 | setToolBarsMovable( false ); |
89 | toolBar->setHorizontalStretchable( true ); | 85 | toolBar->setHorizontalStretchable( true ); |
90 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 86 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
91 | menuBar->insertItem( tr( "View" ), viewMenu ); | 87 | menuBar->insertItem( tr( "View" ), viewMenu ); |
92 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 88 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
93 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); | 89 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); |
94 | 90 | ||
95 | QLabel *spacer; | 91 | QLabel *spacer; |
96 | // spacer = new QLabel( "", toolBar ); | 92 | // spacer = new QLabel( "", toolBar ); |
97 | // spacer->setBackgroundColor( toolBar->backgroundColor() ); | 93 | // spacer->setBackgroundColor( toolBar->backgroundColor() ); |
98 | // toolBar->setStretchableWidget( spacer ); | 94 | // toolBar->setStretchableWidget( spacer ); |
99 | 95 | ||
100 | 96 | ||
101 | runAction = new QAction( tr( "Apply" ), | 97 | runAction = new QAction( tr( "Apply" ), |
102 | Resource::loadPixmap( "oipkg/install" ), | 98 | Resource::loadPixmap( "oipkg/install" ), |
103 | QString::null, 0, this, 0 ); | 99 | QString::null, 0, this, 0 ); |
104 | connect( runAction, SIGNAL( activated() ), | 100 | connect( runAction, SIGNAL( activated() ), |
105 | this, SLOT( runIpkg() ) ); | 101 | this, SLOT( runIpkg() ) ); |
106 | runAction->addTo( toolBar ); | 102 | runAction->addTo( toolBar ); |
107 | runAction->addTo( srvMenu ); | 103 | runAction->addTo( srvMenu ); |
108 | 104 | ||
109 | srvMenu->insertSeparator (); | 105 | srvMenu->insertSeparator (); |
110 | 106 | ||
111 | updateAction = new QAction( tr( "Update" ), | 107 | updateAction = new QAction( tr( "Update" ), |
112 | Resource::loadIconSet( "oipkg/update" ), | 108 | Resource::loadIconSet( "oipkg/update" ), |
@@ -208,273 +204,253 @@ void MainWindow::makeMenu() | |||
208 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); | 204 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); |
209 | label = new QLabel( tr("Destination: "), destBar ); | 205 | label = new QLabel( tr("Destination: "), destBar ); |
210 | label->setBackgroundColor( destBar->backgroundColor() ); | 206 | label->setBackgroundColor( destBar->backgroundColor() ); |
211 | destBar->setHorizontalStretchable( TRUE ); | 207 | destBar->setHorizontalStretchable( TRUE ); |
212 | destination = new QComboBox( false, destBar ); | 208 | destination = new QComboBox( false, destBar ); |
213 | destination->insertStringList( settings->getDestinationNames() ); | 209 | destination->insertStringList( settings->getDestinationNames() ); |
214 | setComboName(destination,settings->getDestinationName()); | 210 | setComboName(destination,settings->getDestinationName()); |
215 | connect( destination, SIGNAL(activated(int)), | 211 | connect( destination, SIGNAL(activated(int)), |
216 | settings, SLOT(activeDestinationChange(int)) ); | 212 | settings, SLOT(activeDestinationChange(int)) ); |
217 | spacer = new QLabel( " ", destBar ); | 213 | spacer = new QLabel( " ", destBar ); |
218 | spacer->setBackgroundColor( destBar->backgroundColor() ); | 214 | spacer->setBackgroundColor( destBar->backgroundColor() ); |
219 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); | 215 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); |
220 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); | 216 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); |
221 | CheckBoxLink->setChecked( settings->createLinks() ); | 217 | CheckBoxLink->setChecked( settings->createLinks() ); |
222 | connect( CheckBoxLink, SIGNAL(toggled(bool)), | 218 | connect( CheckBoxLink, SIGNAL(toggled(bool)), |
223 | settings, SLOT(linkEnabled(bool)) ); | 219 | settings, SLOT(linkEnabled(bool)) ); |
224 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); | 220 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); |
225 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); | 221 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); |
226 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 222 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
227 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); | 223 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); |
228 | a->addTo( destBar ); | 224 | a->addTo( destBar ); |
229 | destBar->setStretchableWidget( CheckBoxLink ); | 225 | destBar->setStretchableWidget( CheckBoxLink ); |
230 | destAction->setToggleAction( true ); | 226 | destAction->setToggleAction( true ); |
231 | // destAction->addTo( viewMenu ); | 227 | // destAction->addTo( viewMenu ); |
232 | 228 | ||
233 | // configure the menus | 229 | // configure the menus |
234 | Config cfg( "oipkg", Config::User ); | 230 | Config cfg( "oipkg", Config::User ); |
235 | cfg.setGroup( "gui" ); | 231 | cfg.setGroup( "gui" ); |
236 | 232 | ||
237 | findShow( cfg.readBoolEntry( "findBar", true ) ); | 233 | findShow( cfg.readBoolEntry( "findBar", true ) ); |
238 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); | 234 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); |
239 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); | 235 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); |
240 | destShow( cfg.readBoolEntry( "destBar", false ) ); | 236 | destShow( cfg.readBoolEntry( "destBar", false ) ); |
241 | } | 237 | } |
242 | 238 | ||
243 | MainWindow::~MainWindow() | 239 | MainWindow::~MainWindow() |
244 | { | 240 | { |
245 | Config cfg( "oipkg", Config::User ); | 241 | Config cfg( "oipkg", Config::User ); |
246 | cfg.setGroup( "gui" ); | 242 | cfg.setGroup( "gui" ); |
247 | cfg.writeEntry( "findBar", !findBar->isHidden() ); | 243 | cfg.writeEntry( "findBar", !findBar->isHidden() ); |
248 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); | 244 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); |
249 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); | 245 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); |
250 | cfg.writeEntry( "destBar", !destBar->isHidden() ); | 246 | cfg.writeEntry( "destBar", !destBar->isHidden() ); |
251 | 247 | ||
252 | } | 248 | } |
253 | 249 | ||
254 | void MainWindow::runIpkg() | 250 | void MainWindow::runIpkg() |
255 | { | 251 | { |
256 | packageListServers.allPackages(); | 252 | packageListServers.allPackages(); |
257 | ipkg->loadList( &packageListSearch ); | 253 | ipkg->loadList( &packageListSearch ); |
258 | ipkg->loadList( &packageListDocLnk ); | 254 | ipkg->loadList( &packageListDocLnk ); |
259 | ipkg->loadList( &packageListServers ); | 255 | ipkg->loadList( &packageListServers ); |
260 | ipkg->commit(); | 256 | ipkg->commit(); |
261 | ipkg->clearLists(); | 257 | ipkg->clearLists(); |
262 | // ##### If we looked in the list of files, we could send out accurate | 258 | // ##### If we looked in the list of files, we could send out accurate |
263 | // ##### messages. But we don't bother yet, and just do an "all". | 259 | // ##### messages. But we don't bother yet, and just do an "all". |
264 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 260 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
265 | QString lf = QString::null; | 261 | QString lf = QString::null; |
266 | e << lf; | 262 | e << lf; |
267 | displayList(); | 263 | displayList(); |
268 | } | 264 | } |
269 | 265 | ||
270 | void MainWindow::updateList() | 266 | void MainWindow::updateList() |
271 | { | 267 | { |
272 | //wait->show(); | ||
273 | QTimer *t = new QTimer( this ); | ||
274 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); | ||
275 | t->start( 0, false ); | ||
276 | packageListServers.clear(); | 268 | packageListServers.clear(); |
277 | packageListSearch.clear(); | 269 | packageListSearch.clear(); |
278 | packageListDocLnk.clear(); | 270 | packageListDocLnk.clear(); |
279 | ipkg->update(); | 271 | ipkg->update(); |
280 | packageListServers.update(); | 272 | packageListServers.update(); |
281 | packageListSearch.update(); | 273 | packageListSearch.update(); |
282 | packageListDocLnk.update(); | 274 | packageListDocLnk.update(); |
283 | t->stop(); | ||
284 | // wait->hide(); | ||
285 | } | 275 | } |
286 | 276 | ||
287 | void MainWindow::filterList() | 277 | void MainWindow::filterList() |
288 | { | 278 | { |
289 | //wait->show(); | ||
290 | QString f = ""; | 279 | QString f = ""; |
291 | if ( findAction->isOn() ) f = findEdit->text(); | 280 | if ( findAction->isOn() ) f = findEdit->text(); |
292 | packageListServers.filterPackages( f ); | 281 | packageListServers.filterPackages( f ); |
293 | //wait->hide(); | ||
294 | } | 282 | } |
295 | 283 | ||
296 | void MainWindow::displayList() | 284 | void MainWindow::displayList() |
297 | { | 285 | { |
298 | //wait->hide(); | ||
299 | filterList(); | 286 | filterList(); |
300 | listViewPackages->display(); | 287 | listViewPackages->display(); |
301 | } | 288 | } |
302 | 289 | ||
303 | void MainWindow::sectionChanged() | 290 | void MainWindow::sectionChanged() |
304 | { | 291 | { |
305 | disconnect( section, SIGNAL( activated(int) ), | 292 | disconnect( section, SIGNAL( activated(int) ), |
306 | this, SLOT( sectionChanged() ) ); | 293 | this, SLOT( sectionChanged() ) ); |
307 | disconnect( subsection, SIGNAL(activated(int) ), | 294 | disconnect( subsection, SIGNAL(activated(int) ), |
308 | this, SLOT( subSectionChanged() ) ); | 295 | this, SLOT( subSectionChanged() ) ); |
309 | subsection->clear(); | 296 | subsection->clear(); |
310 | packageListServers.setSection( section->currentText() ); | 297 | packageListServers.setSection( section->currentText() ); |
311 | setSubSections(); | 298 | setSubSections(); |
312 | connect( section, SIGNAL( activated(int) ), | 299 | connect( section, SIGNAL( activated(int) ), |
313 | this, SLOT( sectionChanged() ) ); | 300 | this, SLOT( sectionChanged() ) ); |
314 | connect( subsection, SIGNAL(activated(int) ), | 301 | connect( subsection, SIGNAL(activated(int) ), |
315 | this, SLOT( subSectionChanged() ) ); | 302 | this, SLOT( subSectionChanged() ) ); |
316 | displayList(); | 303 | displayList(); |
317 | } | 304 | } |
318 | 305 | ||
319 | void MainWindow::subSectionChanged() | 306 | void MainWindow::subSectionChanged() |
320 | { | 307 | { |
321 | disconnect( section, SIGNAL( activated(int) ), | 308 | disconnect( section, SIGNAL( activated(int) ), |
322 | this, SLOT( sectionChanged() ) ); | 309 | this, SLOT( sectionChanged() ) ); |
323 | disconnect( subsection, SIGNAL(activated(int) ), | 310 | disconnect( subsection, SIGNAL(activated(int) ), |
324 | this, SLOT( subSectionChanged() ) ); | 311 | this, SLOT( subSectionChanged() ) ); |
325 | packageListServers.setSubSection( subsection->currentText() ); | 312 | packageListServers.setSubSection( subsection->currentText() ); |
326 | connect( section, SIGNAL( activated(int) ), | 313 | connect( section, SIGNAL( activated(int) ), |
327 | this, SLOT( sectionChanged() ) ); | 314 | this, SLOT( sectionChanged() ) ); |
328 | connect( subsection, SIGNAL(activated(int) ), | 315 | connect( subsection, SIGNAL(activated(int) ), |
329 | this, SLOT( subSectionChanged() ) ); | 316 | this, SLOT( subSectionChanged() ) ); |
330 | displayList(); | 317 | displayList(); |
331 | } | 318 | } |
332 | 319 | ||
333 | void MainWindow::setSections() | 320 | void MainWindow::setSections() |
334 | { | 321 | { |
335 | section->clear(); | 322 | section->clear(); |
336 | section->insertStringList( packageListServers.getSections() ); | 323 | section->insertStringList( packageListServers.getSections() ); |
337 | } | 324 | } |
338 | 325 | ||
339 | void MainWindow::setSubSections() | 326 | void MainWindow::setSubSections() |
340 | { | 327 | { |
341 | subsection->clear(); | 328 | subsection->clear(); |
342 | subsection->insertStringList( packageListServers.getSubSections() ); | 329 | subsection->insertStringList( packageListServers.getSubSections() ); |
343 | } | 330 | } |
344 | 331 | ||
345 | 332 | ||
346 | void MainWindow::showSettings() | 333 | void MainWindow::showSettings() |
347 | { | 334 | { |
348 | if ( settings->showDialog( 0 ) ) | 335 | if ( settings->showDialog( 0 ) ) |
349 | updateList(); | 336 | updateList(); |
350 | } | 337 | } |
351 | void MainWindow::showSettingsSrv() | 338 | void MainWindow::showSettingsSrv() |
352 | { | 339 | { |
353 | if ( settings->showDialog( 1 ) ) | 340 | if ( settings->showDialog( 1 ) ) |
354 | updateList(); | 341 | updateList(); |
355 | } | 342 | } |
356 | void MainWindow::showSettingsDst() | 343 | void MainWindow::showSettingsDst() |
357 | { | 344 | { |
358 | if ( settings->showDialog( 2 ) ) | 345 | if ( settings->showDialog( 2 ) ) |
359 | updateList(); | 346 | updateList(); |
360 | } | 347 | } |
361 | 348 | ||
362 | void MainWindow::sectionShow(bool b) | 349 | void MainWindow::sectionShow(bool b) |
363 | { | 350 | { |
364 | if (b) sectionBar->show(); | 351 | if (b) sectionBar->show(); |
365 | else sectionBar->hide(); | 352 | else sectionBar->hide(); |
366 | sectionAction->setOn( b ); | 353 | sectionAction->setOn( b ); |
367 | } | 354 | } |
368 | 355 | ||
369 | void MainWindow::sectionClose() | 356 | void MainWindow::sectionClose() |
370 | { | 357 | { |
371 | sectionAction->setOn( false ); | 358 | sectionAction->setOn( false ); |
372 | } | 359 | } |
373 | 360 | ||
374 | void MainWindow::findShow(bool b) | 361 | void MainWindow::findShow(bool b) |
375 | { | 362 | { |
376 | if (b) findBar->show(); | 363 | if (b) findBar->show(); |
377 | else findBar->hide(); | 364 | else findBar->hide(); |
378 | findAction->setOn( b ); | 365 | findAction->setOn( b ); |
379 | } | 366 | } |
380 | 367 | ||
381 | void MainWindow::findClose() | 368 | void MainWindow::findClose() |
382 | { | 369 | { |
383 | findAction->setOn( false ); | 370 | findAction->setOn( false ); |
384 | } | 371 | } |
385 | 372 | ||
386 | void MainWindow::searchShow(bool b) | 373 | void MainWindow::searchShow(bool b) |
387 | { | 374 | { |
388 | if (b) searchBar->show(); | 375 | if (b) searchBar->show(); |
389 | else searchBar->hide(); | 376 | else searchBar->hide(); |
390 | searchAction->setOn( b ); | 377 | searchAction->setOn( b ); |
391 | } | 378 | } |
392 | 379 | ||
393 | void MainWindow::searchClose() | 380 | void MainWindow::searchClose() |
394 | { | 381 | { |
395 | searchAction->setOn( false ); | 382 | searchAction->setOn( false ); |
396 | } | 383 | } |
397 | 384 | ||
398 | 385 | ||
399 | void MainWindow::destShow(bool b) | 386 | void MainWindow::destShow(bool b) |
400 | { | 387 | { |
401 | if (b) destBar->show(); | 388 | if (b) destBar->show(); |
402 | else destBar->hide(); | 389 | else destBar->hide(); |
403 | destAction->setOn( b ); | 390 | destAction->setOn( b ); |
404 | } | 391 | } |
405 | 392 | ||
406 | void MainWindow::destClose() | 393 | void MainWindow::destClose() |
407 | { | 394 | { |
408 | destAction->setOn( false ); | 395 | destAction->setOn( false ); |
409 | } | 396 | } |
410 | 397 | ||
411 | void MainWindow::rotateUpdateIcon() | ||
412 | { | ||
413 | pvDebug(2, "MainWindow::rotateUpdateIcon"); | ||
414 | if ( updateIcon ) | ||
415 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); | ||
416 | else | ||
417 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); | ||
418 | updateIcon = !updateIcon; | ||
419 | } | ||
420 | |||
421 | |||
422 | void MainWindow::setDocument(const QString &fileName) | 398 | void MainWindow::setDocument(const QString &fileName) |
423 | { | 399 | { |
424 | if ( !QFile::exists( fileName ) ) return; | 400 | if ( !QFile::exists( fileName ) ) return; |
425 | ipkg->installFile( fileName ); | 401 | ipkg->installFile( fileName ); |
426 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 402 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
427 | QString lf = QString::null; | 403 | QString lf = QString::null; |
428 | e << lf; | 404 | e << lf; |
429 | exit; | 405 | exit; |
430 | } | 406 | } |
431 | 407 | ||
432 | 408 | ||
433 | void MainWindow::makeChannel() | 409 | void MainWindow::makeChannel() |
434 | { | 410 | { |
435 | channel = new QCopChannel( "QPE/Application/oipkg", this ); | 411 | channel = new QCopChannel( "QPE/Application/oipkg", this ); |
436 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 412 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
437 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 413 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
438 | } | 414 | } |
439 | 415 | ||
440 | 416 | ||
441 | 417 | ||
442 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) | 418 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) |
443 | { | 419 | { |
444 | pvDebug(3, "QCop "+msg+" "+QCString(arg)); | 420 | pvDebug(3, "QCop "+msg+" "+QCString(arg)); |
445 | if ( msg == "installFile(QString)" ) | 421 | if ( msg == "installFile(QString)" ) |
446 | { | 422 | { |
447 | ipkg->installFile( QString(arg) ); | 423 | ipkg->installFile( QString(arg) ); |
448 | }else if( msg == "removeFile(QString)" ) | 424 | }else if( msg == "removeFile(QString)" ) |
449 | { | 425 | { |
450 | ipkg->removeFile( QString(arg) ); | 426 | ipkg->removeFile( QString(arg) ); |
451 | }else if( msg == "createLinks(QString)" ) | 427 | }else if( msg == "createLinks(QString)" ) |
452 | { | 428 | { |
453 | ipkg->createLinks( QString(arg) ); | 429 | ipkg->createLinks( QString(arg) ); |
454 | }else if( msg == "removeLinks(QString)" ) | 430 | }else if( msg == "removeLinks(QString)" ) |
455 | { | 431 | { |
456 | ipkg->removeLinks( QString(arg) ); | 432 | ipkg->removeLinks( QString(arg) ); |
457 | }else{ | 433 | }else{ |
458 | pvDebug(2,"Huh what do ya want") | 434 | pvDebug(2,"Huh what do ya want") |
459 | } | 435 | } |
460 | } | 436 | } |
461 | 437 | ||
462 | 438 | ||
463 | void MainWindow::createLinks() | 439 | void MainWindow::createLinks() |
464 | { | 440 | { |
465 | pvDebug(2,"creating links..."); | 441 | pvDebug(2,"creating links..."); |
466 | ipkg->createLinks( settings->destinationurl->text() ); | 442 | ipkg->createLinks( settings->destinationurl->text() ); |
467 | } | 443 | } |
468 | 444 | ||
469 | void MainWindow::removeLinks() | 445 | void MainWindow::removeLinks() |
470 | { | 446 | { |
471 | pvDebug(2,"removing links..."); | 447 | pvDebug(2,"removing links..."); |
472 | ipkg->removeLinks( settings->destinationurl->text() ); | 448 | ipkg->removeLinks( settings->destinationurl->text() ); |
473 | } | 449 | } |
474 | 450 | ||
475 | void MainWindow::remotePackageQuery() | 451 | void MainWindow::remotePackageQuery() |
476 | { | 452 | { |
477 | packageListSearch.query( searchEdit->text() ); | 453 | packageListSearch.query( searchEdit->text() ); |
478 | packageListSearch.update(); | 454 | packageListSearch.update(); |
479 | displayList(); | 455 | displayList(); |
480 | } | 456 | } |
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index ce3e761..4a5e8bf 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h | |||
@@ -28,70 +28,67 @@ class MainWindow : public QMainWindow | |||
28 | 28 | ||
29 | 29 | ||
30 | public: | 30 | public: |
31 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 31 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
32 | ~MainWindow(); | 32 | ~MainWindow(); |
33 | void makeChannel(); | 33 | void makeChannel(); |
34 | 34 | ||
35 | QCopChannel *channel; | 35 | QCopChannel *channel; |
36 | 36 | ||
37 | protected slots: | 37 | protected slots: |
38 | void runIpkg(); | 38 | void runIpkg(); |
39 | void updateList(); | 39 | void updateList(); |
40 | void displayList(); | 40 | void displayList(); |
41 | void subSectionChanged(); | 41 | void subSectionChanged(); |
42 | void sectionChanged(); | 42 | void sectionChanged(); |
43 | void showSettings(); | 43 | void showSettings(); |
44 | void showSettingsSrv(); | 44 | void showSettingsSrv(); |
45 | void showSettingsDst(); | 45 | void showSettingsDst(); |
46 | 46 | ||
47 | public slots: | 47 | public slots: |
48 | void sectionClose(); | 48 | void sectionClose(); |
49 | void sectionShow(bool); | 49 | void sectionShow(bool); |
50 | void findClose(); | 50 | void findClose(); |
51 | void findShow(bool); | 51 | void findShow(bool); |
52 | void searchClose(); | 52 | void searchClose(); |
53 | void searchShow(bool); | 53 | void searchShow(bool); |
54 | void destClose(); | 54 | void destClose(); |
55 | void destShow(bool); | 55 | void destShow(bool); |
56 | void filterList(); | 56 | void filterList(); |
57 | void createLinks(); | 57 | void createLinks(); |
58 | void removeLinks(); | 58 | void removeLinks(); |
59 | void receive (const QCString &, const QByteArray &); | 59 | void receive (const QCString &, const QByteArray &); |
60 | void setDocument (const QString &); | 60 | void setDocument (const QString &); |
61 | void remotePackageQuery(); | 61 | void remotePackageQuery(); |
62 | 62 | ||
63 | private: | 63 | private: |
64 | void makeMenu(); | 64 | void makeMenu(); |
65 | void setSections(); | 65 | void setSections(); |
66 | void setSubSections(); | 66 | void setSubSections(); |
67 | bool updateIcon; | 67 | bool updateIcon; |
68 | 68 | ||
69 | PmIpkg* ipkg; | 69 | PmIpkg* ipkg; |
70 | PackageManagerSettings *settings; | 70 | PackageManagerSettings *settings; |
71 | PackageListLocal packageListServers; | 71 | PackageListLocal packageListServers; |
72 | PackageListRemote packageListSearch; | 72 | PackageListRemote packageListSearch; |
73 | PackageListDocLnk packageListDocLnk; | 73 | PackageListDocLnk packageListDocLnk; |
74 | PackageListView *listViewPackages; | 74 | PackageListView *listViewPackages; |
75 | QAction *runAction; | 75 | QAction *runAction; |
76 | QAction *updateAction; | 76 | QAction *updateAction; |
77 | QAction *findAction; | 77 | QAction *findAction; |
78 | QPEToolBar *findBar; | 78 | QPEToolBar *findBar; |
79 | QLineEdit *findEdit; | 79 | QLineEdit *findEdit; |
80 | QAction *searchAction; | 80 | QAction *searchAction; |
81 | QAction *searchCommit; | 81 | QAction *searchCommit; |
82 | QPEToolBar *searchBar; | 82 | QPEToolBar *searchBar; |
83 | QLineEdit *searchEdit; | 83 | QLineEdit *searchEdit; |
84 | QAction *sectionAction; | 84 | QAction *sectionAction; |
85 | QPEToolBar *sectionBar; | 85 | QPEToolBar *sectionBar; |
86 | QComboBox *section; | 86 | QComboBox *section; |
87 | QComboBox *subsection; | 87 | QComboBox *subsection; |
88 | QAction *destAction; | 88 | QAction *destAction; |
89 | QPEToolBar *destBar; | 89 | QPEToolBar *destBar; |
90 | QComboBox *destination; | 90 | QComboBox *destination; |
91 | QCheckBox* CheckBoxLink; | 91 | QCheckBox* CheckBoxLink; |
92 | // QMessageBox *wait; | ||
93 | private slots: | ||
94 | void rotateUpdateIcon(); | ||
95 | }; | 92 | }; |
96 | 93 | ||
97 | #endif | 94 | #endif |
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 4542e42..8c5f0ea 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -1,116 +1,117 @@ | |||
1 | #include "package.h" | 1 | #include "package.h" |
2 | 2 | ||
3 | #include <qpe/process.h> | 3 | #include <qpe/process.h> |
4 | #include <qpe/stringutil.h> | 4 | #include <qpe/stringutil.h> |
5 | #include <qfile.h> | 5 | #include <qfile.h> |
6 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #include <unistd.h> | 8 | #include <unistd.h> |
9 | 9 | ||
10 | #include "debug.h" | 10 | #include "debug.h" |
11 | 11 | ||
12 | //Package::~Package() | 12 | //Package::~Package() |
13 | //{ | 13 | //{ |
14 | //} | 14 | //} |
15 | 15 | ||
16 | Package::Package( PackageManagerSettings *s ) | 16 | Package::Package( PackageManagerSettings *s ) |
17 | { | 17 | { |
18 | init(s); | 18 | init(s); |
19 | } | 19 | } |
20 | 20 | ||
21 | void Package::init( PackageManagerSettings *s ) | 21 | void Package::init( PackageManagerSettings *s ) |
22 | { | 22 | { |
23 | settings = s; | 23 | settings = s; |
24 | _size = ""; | 24 | _size = ""; |
25 | _section = ""; | 25 | _section = ""; |
26 | _subsection = ""; | 26 | _subsection = ""; |
27 | _shortDesc = ""; | 27 | _shortDesc = ""; |
28 | _desc = ""; | 28 | _desc = ""; |
29 | _name = ""; | 29 | _name = ""; |
30 | _toProcess = false; | 30 | _toProcess = false; |
31 | _useFileName = false; | 31 | _useFileName = false; |
32 | _old = false; | 32 | _old = false; |
33 | _status = ""; | 33 | _status = ""; |
34 | _dest = settings->getDestinationName(); | 34 | _dest = settings->getDestinationName(); |
35 | _link = settings->createLinks(); | 35 | _link = settings->createLinks(); |
36 | _versions=0; | 36 | _versions=0; |
37 | _version=""; | 37 | _version=""; |
38 | } | 38 | } |
39 | 39 | ||
40 | Package::Package( QStringList pack, PackageManagerSettings *s ) | 40 | Package::Package( QStringList pack, PackageManagerSettings *s ) |
41 | { | 41 | { |
42 | init(s); | 42 | init(s); |
43 | parsePackage( pack ); | 43 | parsePackage( pack ); |
44 | } | 44 | } |
45 | 45 | ||
46 | Package::Package( QString n, PackageManagerSettings *s ) | 46 | Package::Package( QString n, PackageManagerSettings *s ) |
47 | { | 47 | { |
48 | init(s); | 48 | init(s); |
49 | if ( !QFile::exists( n ) ) | 49 | if ( !QFile::exists( n ) ) |
50 | { | 50 | { |
51 | _name = QString( n ); | 51 | _name = QString( n ); |
52 | }else{ | 52 | }else{ |
53 | pvDebug(2,"remote file: "+n); | ||
53 | parseIpkgFile( n ); | 54 | parseIpkgFile( n ); |
54 | _useFileName = true; | 55 | _useFileName = true; |
55 | _fileName = QString( n ); | 56 | _fileName = QString( n ); |
56 | } | 57 | } |
57 | } | 58 | } |
58 | 59 | ||
59 | Package::Package( Package *pi ) | 60 | Package::Package( Package *pi ) |
60 | { | 61 | { |
61 | init(pi->settings); | 62 | init(pi->settings); |
62 | copyValues( pi ); | 63 | copyValues( pi ); |
63 | } | 64 | } |
64 | 65 | ||
65 | 66 | ||
66 | void Package::setValue( QString n, QString t ) | 67 | void Package::setValue( QString n, QString t ) |
67 | { | 68 | { |
68 | if ( n == "Package" ) | 69 | if ( n == "Package" ) |
69 | { | 70 | { |
70 | _name = QString( t ); | 71 | _name = QString( t ); |
71 | }else if ( n == "Installed-Size" ) | 72 | }else if ( n == "Installed-Size" ) |
72 | { | 73 | { |
73 | _size = t; | 74 | _size = t; |
74 | // }else if ( n == "Priority") | 75 | // }else if ( n == "Priority") |
75 | // { | 76 | // { |
76 | 77 | ||
77 | }else if ( n == "Section") | 78 | }else if ( n == "Section") |
78 | { | 79 | { |
79 | setSection( t ); | 80 | setSection( t ); |
80 | // }else if ( n == "Maintainer") | 81 | // }else if ( n == "Maintainer") |
81 | // { | 82 | // { |
82 | // | 83 | // |
83 | // }else if ( n == "Architecture") | 84 | // }else if ( n == "Architecture") |
84 | // { | 85 | // { |
85 | 86 | ||
86 | }else if ( n == "Version") | 87 | }else if ( n == "Version") |
87 | { | 88 | { |
88 | _version = t; | 89 | _version = t; |
89 | // }else if ( n == "Pre-Depends") | 90 | // }else if ( n == "Pre-Depends") |
90 | // { | 91 | // { |
91 | // | 92 | // |
92 | // }else if ( n == "Depends") | 93 | // }else if ( n == "Depends") |
93 | // { | 94 | // { |
94 | 95 | ||
95 | }else if ( n == "Filename") | 96 | }else if ( n == "Filename") |
96 | { | 97 | { |
97 | _fileName = t; | 98 | _fileName = t; |
98 | // }else if ( n == "Size") | 99 | // }else if ( n == "Size") |
99 | // { | 100 | // { |
100 | // | 101 | // |
101 | //}else if ( n == "MD5Sum") | 102 | //}else if ( n == "MD5Sum") |
102 | //{ | 103 | //{ |
103 | 104 | ||
104 | }else if ( n == "Description") | 105 | }else if ( n == "Description") |
105 | { | 106 | { |
106 | setDesc( t ); | 107 | setDesc( t ); |
107 | }else if ( n == "Status") | 108 | }else if ( n == "Status") |
108 | { | 109 | { |
109 | if ( installed() ) return; | 110 | if ( installed() ) return; |
110 | _status = t; | 111 | _status = t; |
111 | // }else if ( n == "Essential") | 112 | // }else if ( n == "Essential") |
112 | // { | 113 | // { |
113 | 114 | ||
114 | }else{ | 115 | }else{ |
115 | _values.insert(n,new QString(t)); | 116 | _values.insert(n,new QString(t)); |
116 | } | 117 | } |
@@ -281,129 +282,130 @@ void Package::parsePackage( QStringList pack ) | |||
281 | QString value = line.mid(sep+2).simplifyWhiteSpace(); | 282 | QString value = line.mid(sep+2).simplifyWhiteSpace(); |
282 | setValue( tag, value ); | 283 | setValue( tag, value ); |
283 | }else{ | 284 | }else{ |
284 | } | 285 | } |
285 | } | 286 | } |
286 | return; | 287 | return; |
287 | } | 288 | } |
288 | 289 | ||
289 | QString Package::details() | 290 | QString Package::details() |
290 | { | 291 | { |
291 | QString status; | 292 | QString status; |
292 | Process ipkg_status(QStringList() << "ipkg" << "info" << name() ); | 293 | Process ipkg_status(QStringList() << "ipkg" << "info" << name() ); |
293 | QString description; | 294 | QString description; |
294 | if ( ipkg_status.exec("",status) ) | 295 | if ( ipkg_status.exec("",status) ) |
295 | { | 296 | { |
296 | QStringList lines = QStringList::split('\n',status,TRUE); | 297 | QStringList lines = QStringList::split('\n',status,TRUE); |
297 | for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) { | 298 | for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) { |
298 | QString line = *it; | 299 | QString line = *it; |
299 | if ( line == " ." ) | 300 | if ( line == " ." ) |
300 | { | 301 | { |
301 | description.append("<p>"); | 302 | description.append("<p>"); |
302 | } else | 303 | } else |
303 | if ( line[0] == ' ' || line[0] == '\t' ) | 304 | if ( line[0] == ' ' || line[0] == '\t' ) |
304 | { | 305 | { |
305 | // continuation | 306 | // continuation |
306 | description.append(" "); | 307 | description.append(" "); |
307 | description.append(Qtopia::escapeString(line)); | 308 | description.append(Qtopia::escapeString(line)); |
308 | } else { | 309 | } else { |
309 | int sep = line.find(QRegExp(":[\t ]+")); | 310 | int sep = line.find(QRegExp(":[\t ]+")); |
310 | if ( sep >= 0 ) | 311 | if ( sep >= 0 ) |
311 | { | 312 | { |
312 | QString tag = line.left(sep); | 313 | QString tag = line.left(sep); |
313 | description.append("<br>"); | 314 | description.append("<br>"); |
314 | description.append("<b>"); | 315 | description.append("<b>"); |
315 | description.append(Qtopia::escapeString(tag)); | 316 | description.append(Qtopia::escapeString(tag)); |
316 | description.append(":</b> "); | 317 | description.append(":</b> "); |
317 | description.append(Qtopia::escapeString(line.mid(sep+2))); | 318 | description.append(Qtopia::escapeString(line.mid(sep+2))); |
318 | } else { | 319 | } else { |
319 | description.append(" "); | 320 | description.append(" "); |
320 | description.append(Qtopia::escapeString(line)); | 321 | description.append(Qtopia::escapeString(line)); |
321 | } | 322 | } |
322 | } | 323 | } |
323 | } | 324 | } |
324 | } | 325 | } |
325 | return description; | 326 | return description; |
326 | } | 327 | } |
327 | 328 | ||
328 | void Package::processed() | 329 | void Package::processed() |
329 | { | 330 | { |
330 | _toProcess = false; | 331 | _toProcess = false; |
331 | //hack, but we're not writing status anyway... | 332 | //hack, but we're not writing status anyway... |
332 | if ( installed() ) _status = "install"; | 333 | if ( installed() ) _status = "install"; |
333 | else _status = "installed"; | 334 | else _status = "installed"; |
334 | } | 335 | } |
335 | 336 | ||
336 | QString Package::dest() | 337 | QString Package::dest() |
337 | { | 338 | { |
338 | if ( installed()||(!installed() && _toProcess) ) | 339 | if ( installed()||(!installed() && _toProcess) ) |
339 | return _dest!=""?_dest:settings->getDestinationName(); | 340 | return _dest!=""?_dest:settings->getDestinationName(); |
340 | else return ""; | 341 | else return ""; |
341 | } | 342 | } |
342 | 343 | ||
343 | void Package::setDest( QString d ) | 344 | void Package::setDest( QString d ) |
344 | { | 345 | { |
345 | _dest = d; | 346 | if ( d == "remote") _useFileName = true; |
347 | else _dest = d; | ||
346 | } | 348 | } |
347 | 349 | ||
348 | void Package::setOn() | 350 | void Package::setOn() |
349 | { | 351 | { |
350 | _toProcess = true; | 352 | _toProcess = true; |
351 | } | 353 | } |
352 | 354 | ||
353 | bool Package::link() | 355 | bool Package::link() |
354 | { | 356 | { |
355 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; | 357 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; |
356 | return _link; | 358 | return _link; |
357 | } | 359 | } |
358 | 360 | ||
359 | void Package::setLink(bool b) | 361 | void Package::setLink(bool b) |
360 | { | 362 | { |
361 | _link = b; | 363 | _link = b; |
362 | } | 364 | } |
363 | 365 | ||
364 | void Package::parseIpkgFile( QString file) | 366 | void Package::parseIpkgFile( QString file) |
365 | { | 367 | { |
366 | system("tar xzf "+file+" -C /tmp"); | 368 | system("tar xzf "+file+" -C /tmp"); |
367 | system("tar xzf /tmp/control.tar.gz -C /tmp"); | 369 | system("tar xzf /tmp/control.tar.gz -C /tmp"); |
368 | QFile f("/tmp/control"); | 370 | QFile f("/tmp/control"); |
369 | if ( f.open(IO_ReadOnly) ) | 371 | if ( f.open(IO_ReadOnly) ) |
370 | { | 372 | { |
371 | QTextStream t( &f ); | 373 | QTextStream t( &f ); |
372 | QStringList pack; | 374 | QStringList pack; |
373 | while ( !t.eof() ) | 375 | while ( !t.eof() ) |
374 | { | 376 | { |
375 | pack << t.readLine(); | 377 | pack << t.readLine(); |
376 | } | 378 | } |
377 | f.close(); | 379 | f.close(); |
378 | parsePackage( pack ); | 380 | parsePackage( pack ); |
379 | } | 381 | } |
380 | 382 | ||
381 | } | 383 | } |
382 | 384 | ||
383 | //QString Package::getPackageName() | 385 | //QString Package::getPackageName() |
384 | //{ | 386 | //{ |
385 | //if ( _packageName.isEmpty() ) return _name; | 387 | //if ( _packageName.isEmpty() ) return _name; |
386 | //else return _packageName; | 388 | //else return _packageName; |
387 | //} | 389 | //} |
388 | 390 | ||
389 | void Package::instalFromFile(bool iff) | 391 | void Package::instalFromFile(bool iff) |
390 | { | 392 | { |
391 | _useFileName = iff; | 393 | _useFileName = iff; |
392 | } | 394 | } |
393 | 395 | ||
394 | void Package::setName(QString n) | 396 | void Package::setName(QString n) |
395 | { | 397 | { |
396 | _displayName = n; | 398 | _displayName = n; |
397 | } | 399 | } |
398 | 400 | ||
399 | QDict<QString>* Package::getFields() | 401 | QDict<QString>* Package::getFields() |
400 | { | 402 | { |
401 | return &_values; | 403 | return &_values; |
402 | } | 404 | } |
403 | 405 | ||
404 | QString Package::status() | 406 | QString Package::status() |
405 | { | 407 | { |
406 | return _status; | 408 | return _status; |
407 | } | 409 | } |
408 | 410 | ||
409 | bool Package::isOld() | 411 | bool Package::isOld() |
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index 8f835b7..1b572e0 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp | |||
@@ -114,108 +114,108 @@ Package* PackageList::next() | |||
114 | } | 114 | } |
115 | 115 | ||
116 | QStringList PackageList::getSections() | 116 | QStringList PackageList::getSections() |
117 | { | 117 | { |
118 | sections.sort(); | 118 | sections.sort(); |
119 | return sections; | 119 | return sections; |
120 | } | 120 | } |
121 | 121 | ||
122 | QStringList PackageList::getSubSections() | 122 | QStringList PackageList::getSubSections() |
123 | { | 123 | { |
124 | QStringList ss; | 124 | QStringList ss; |
125 | if ( !subSections[aktSection] ) return ss; | 125 | if ( !subSections[aktSection] ) return ss; |
126 | ss = *subSections[aktSection]; | 126 | ss = *subSections[aktSection]; |
127 | ss.sort(); | 127 | ss.sort(); |
128 | return ss; | 128 | return ss; |
129 | } | 129 | } |
130 | 130 | ||
131 | void PackageList::setSection( QString sec ) | 131 | void PackageList::setSection( QString sec ) |
132 | { | 132 | { |
133 | aktSection = sec; | 133 | aktSection = sec; |
134 | } | 134 | } |
135 | 135 | ||
136 | void PackageList::setSubSection( QString ssec ) | 136 | void PackageList::setSubSection( QString ssec ) |
137 | { | 137 | { |
138 | aktSubSection = ssec; | 138 | aktSubSection = ssec; |
139 | } | 139 | } |
140 | 140 | ||
141 | void PackageList::updateSections( Package* pack ) | 141 | void PackageList::updateSections( Package* pack ) |
142 | { | 142 | { |
143 | QString s = pack->section(); | 143 | QString s = pack->section(); |
144 | if ( s.isEmpty() || s == "") return; | 144 | if ( s.isEmpty() || s == "") return; |
145 | if ( sections.contains(s) ) return; | 145 | if ( sections.contains(s) ) return; |
146 | sections += s; | 146 | sections += s; |
147 | QString ss = pack->subSection(); | 147 | QString ss = pack->subSection(); |
148 | if ( ss.isEmpty() || ss == "" ) return; | 148 | if ( ss.isEmpty() || ss == "" ) return; |
149 | if ( !subSections[s] ) { | 149 | if ( !subSections[s] ) { |
150 | subSections.insert( s, new QStringList() ); | 150 | subSections.insert( s, new QStringList() ); |
151 | QStringList *subsecs = subSections[s]; | 151 | QStringList *subsecs = subSections[s]; |
152 | *subsecs += "All"; | 152 | *subsecs += "All"; |
153 | } | 153 | } |
154 | QStringList *subsecs = subSections[s]; | 154 | QStringList *subsecs = subSections[s]; |
155 | *subsecs += ss; | 155 | *subsecs += ss; |
156 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); | 156 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); |
157 | subsecs = subSections["All"]; | 157 | subsecs = subSections["All"]; |
158 | *subsecs += ss; | 158 | *subsecs += ss; |
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | void PackageList::readFileEntries( QString filename, QString dest ) | 162 | void PackageList::readFileEntries( QString filename, QString dest ) |
163 | { | 163 | { |
164 | pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); | 164 | pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); |
165 | QStringList packEntry; | 165 | QStringList packEntry; |
166 | QFile f( filename ); | 166 | QFile f( filename ); |
167 | if ( !f.open(IO_ReadOnly) ) return; | 167 | if ( !f.open(IO_ReadOnly) ) return; |
168 | QTextStream *statusStream = new QTextStream( &f ); | 168 | QTextStream *statusStream = new QTextStream( &f ); |
169 | while ( !statusStream ->eof() ) | 169 | while ( !statusStream ->eof() ) |
170 | { | 170 | { |
171 | QString line = statusStream->readLine(); | 171 | QString line = statusStream->readLine(); |
172 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) | 172 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) |
173 | { | 173 | { |
174 | //end of package | 174 | //end of package |
175 | if ( ! packEntry.isEmpty() ) | 175 | if ( ! packEntry.isEmpty() ) |
176 | { | 176 | { |
177 | Package *p = new Package( packEntry, settings ); | 177 | Package *p = new Package( packEntry, settings ); |
178 | p->setDest( dest ); | ||
179 | if ( p ) | 178 | if ( p ) |
180 | { | 179 | { |
180 | p->setDest( dest ); | ||
181 | insertPackage( p ); | 181 | insertPackage( p ); |
182 | packEntry.clear(); | 182 | packEntry.clear(); |
183 | } | 183 | } |
184 | } | 184 | } |
185 | }else{ | 185 | }else{ |
186 | packEntry << line; | 186 | packEntry << line; |
187 | }; | 187 | }; |
188 | } | 188 | } |
189 | delete statusStream; | 189 | delete statusStream; |
190 | return; | 190 | return; |
191 | } | 191 | } |
192 | 192 | ||
193 | void PackageList::setSettings( PackageManagerSettings *s ) | 193 | void PackageList::setSettings( PackageManagerSettings *s ) |
194 | { | 194 | { |
195 | settings = s; | 195 | settings = s; |
196 | } | 196 | } |
197 | 197 | ||
198 | Package* PackageList::getByName( QString n ) | 198 | Package* PackageList::getByName( QString n ) |
199 | { | 199 | { |
200 | origPackageList[n]; | 200 | origPackageList[n]; |
201 | } | 201 | } |
202 | 202 | ||
203 | void PackageList::clear() | 203 | void PackageList::clear() |
204 | { | 204 | { |
205 | origPackageList.clear(); | 205 | origPackageList.clear(); |
206 | packageList.clear(); | 206 | packageList.clear(); |
207 | } | 207 | } |
208 | 208 | ||
209 | void PackageList::allPackages() | 209 | void PackageList::allPackages() |
210 | { | 210 | { |
211 | packageList.clear(); | 211 | packageList.clear(); |
212 | QDictIterator<Package> filterIter( origPackageList ); | 212 | QDictIterator<Package> filterIter( origPackageList ); |
213 | filterIter.toFirst(); | 213 | filterIter.toFirst(); |
214 | Package *pack= filterIter.current() ; | 214 | Package *pack= filterIter.current() ; |
215 | while ( pack ) | 215 | while ( pack ) |
216 | { | 216 | { |
217 | packageList.insert( pack->name(), pack ); | 217 | packageList.insert( pack->name(), pack ); |
218 | ++filterIter; | 218 | ++filterIter; |
219 | pack = filterIter.current(); | 219 | pack = filterIter.current(); |
220 | } | 220 | } |
221 | } | 221 | } |
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index c743a49..55047d5 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp | |||
@@ -1,105 +1,106 @@ | |||
1 | #include "packagelistitem.h" | 1 | #include "packagelistitem.h" |
2 | 2 | ||
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | #include <qobject.h> | 4 | #include <qobject.h> |
5 | 5 | ||
6 | #include "debug.h" | 6 | #include "debug.h" |
7 | 7 | ||
8 | static QPixmap *pm_uninstalled=0; | 8 | static QPixmap *pm_uninstalled=0; |
9 | static QPixmap *pm_uninstalled_old=0; | 9 | static QPixmap *pm_uninstalled_old=0; |
10 | static QPixmap *pm_installed=0; | 10 | static QPixmap *pm_installed=0; |
11 | static QPixmap *pm_installed_old=0; | 11 | static QPixmap *pm_installed_old=0; |
12 | static QPixmap *pm_uninstall=0; | 12 | static QPixmap *pm_uninstall=0; |
13 | static QPixmap *pm_install=0; | 13 | static QPixmap *pm_install=0; |
14 | static QPixmap *pm_uninstalled_old_installed_new=0; | 14 | static QPixmap *pm_uninstalled_old_installed_new=0; |
15 | static QPixmap *pm_uninstalled_installed_old=0; | 15 | static QPixmap *pm_uninstalled_installed_old=0; |
16 | 16 | ||
17 | PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) | 17 | PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) |
18 | :QCheckListItem(lv,pi->name(),CheckBox) | 18 | :QCheckListItem(lv,pi->name(),CheckBox) |
19 | { | 19 | { |
20 | init(pi,s); | 20 | init(pi,s); |
21 | } | 21 | } |
22 | 22 | ||
23 | PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) | 23 | PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) |
24 | :QCheckListItem(lvi,pi->name(),CheckBox) | 24 | :QCheckListItem(lvi,pi->name(),CheckBox) |
25 | { | 25 | { |
26 | init(pi,s); | 26 | init(pi,s); |
27 | } | 27 | } |
28 | 28 | ||
29 | void PackageListItem::init( Package *pi, PackageManagerSettings *s) | 29 | void PackageListItem::init( Package *pi, PackageManagerSettings *s) |
30 | { | 30 | { |
31 | package = pi; | 31 | package = pi; |
32 | settings = s; | 32 | settings = s; |
33 | setExpandable( true ); | 33 | setExpandable( true ); |
34 | QCheckListItem *item; | 34 | QCheckListItem *item; |
35 | nameItem = new QCheckListItem( this, "" ); | 35 | nameItem = new QCheckListItem( this, "" ); |
36 | item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); | 36 | item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); |
37 | item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); | ||
37 | destItem = new QCheckListItem( this, "" ); | 38 | destItem = new QCheckListItem( this, "" ); |
38 | linkItem = new QCheckListItem( this, "" ); | 39 | linkItem = new QCheckListItem( this, "" ); |
39 | statusItem = new QCheckListItem( this, "" ); | 40 | statusItem = new QCheckListItem( this, "" ); |
40 | QCheckListItem *otherItem = new QCheckListItem( this, QObject::tr("other") ); | 41 | QCheckListItem *otherItem = new QCheckListItem( this, QObject::tr("other") ); |
41 | item = new QCheckListItem( otherItem, QObject::tr("Description: ")+pi->desc() ); | 42 | item = new QCheckListItem( otherItem, QObject::tr("Install Name: ")+pi->installName() ); |
42 | QDict<QString> *fields = pi->getFields(); | 43 | QDict<QString> *fields = pi->getFields(); |
43 | QDictIterator<QString> it( *fields ); | 44 | QDictIterator<QString> it( *fields ); |
44 | while ( it.current() ) { | 45 | while ( it.current() ) { |
45 | item = new QCheckListItem( otherItem, QString(it.currentKey()+": "+*it.current()) ); | 46 | item = new QCheckListItem( otherItem, QString(it.currentKey()+": "+*it.current()) ); |
46 | ++it; | 47 | ++it; |
47 | } | 48 | } |
48 | displayDetails(); | 49 | displayDetails(); |
49 | 50 | ||
50 | if (!pm_uninstalled) | 51 | if (!pm_uninstalled) |
51 | { | 52 | { |
52 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); | 53 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); |
53 | pm_uninstalled_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOld")); | 54 | pm_uninstalled_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOld")); |
54 | pm_uninstalled_old_installed_new = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOldinstalledNew")); | 55 | pm_uninstalled_old_installed_new = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOldinstalledNew")); |
55 | pm_uninstalled_installed_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledInstalledOld")); | 56 | pm_uninstalled_installed_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledInstalledOld")); |
56 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); | 57 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); |
57 | pm_installed_old = new QPixmap(Resource::loadPixmap("oipkg/installedOld")); | 58 | pm_installed_old = new QPixmap(Resource::loadPixmap("oipkg/installedOld")); |
58 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); | 59 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); |
59 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); | 60 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); |
60 | } | 61 | } |
61 | } | 62 | } |
62 | 63 | ||
63 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, | 64 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, |
64 | int column, int width, int alignment ) | 65 | int column, int width, int alignment ) |
65 | { | 66 | { |
66 | if ( !p ) | 67 | if ( !p ) |
67 | return; | 68 | return; |
68 | 69 | ||
69 | p->fillRect( 0, 0, width, height(), | 70 | p->fillRect( 0, 0, width, height(), |
70 | isSelected()? cg.highlight() : cg.base() ); | 71 | isSelected()? cg.highlight() : cg.base() ); |
71 | 72 | ||
72 | if ( column != 0 ) { | 73 | if ( column != 0 ) { |
73 | // The rest is text | 74 | // The rest is text |
74 | QListViewItem::paintCell( p, cg, column, width, alignment ); | 75 | QListViewItem::paintCell( p, cg, column, width, alignment ); |
75 | return; | 76 | return; |
76 | } | 77 | } |
77 | 78 | ||
78 | QListView *lv = listView(); | 79 | QListView *lv = listView(); |
79 | if ( !lv ) | 80 | if ( !lv ) |
80 | return; | 81 | return; |
81 | int marg = lv->itemMargin(); | 82 | int marg = lv->itemMargin(); |
82 | int r = marg; | 83 | int r = marg; |
83 | 84 | ||
84 | QPixmap pm = statePixmap(); | 85 | QPixmap pm = statePixmap(); |
85 | p->drawPixmap(marg,(height()-pm.height())/2,pm); | 86 | p->drawPixmap(marg,(height()-pm.height())/2,pm); |
86 | r += pm.width()+1; | 87 | r += pm.width()+1; |
87 | 88 | ||
88 | p->translate( r, 0 ); | 89 | p->translate( r, 0 ); |
89 | QListViewItem::paintCell( p, cg, column, width - r, alignment ); | 90 | QListViewItem::paintCell( p, cg, column, width - r, alignment ); |
90 | } | 91 | } |
91 | 92 | ||
92 | 93 | ||
93 | void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, | 94 | void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, |
94 | const QRect & r ) | 95 | const QRect & r ) |
95 | { | 96 | { |
96 | // Skip QCheckListItem | 97 | // Skip QCheckListItem |
97 | // (makes you wonder what we're getting from QCheckListItem) | 98 | // (makes you wonder what we're getting from QCheckListItem) |
98 | QListViewItem::paintFocus(p,cg,r); | 99 | QListViewItem::paintFocus(p,cg,r); |
99 | } | 100 | } |
100 | 101 | ||
101 | QPixmap PackageListItem::statePixmap() const | 102 | QPixmap PackageListItem::statePixmap() const |
102 | { | 103 | { |
103 | bool installed = package->installed(); | 104 | bool installed = package->installed(); |
104 | bool old = package->isOld(); | 105 | bool old = package->isOld(); |
105 | bool versions = package->hasVersions(); | 106 | bool versions = package->hasVersions(); |
diff --git a/noncore/unsupported/oipkg/packagelistremote.cpp b/noncore/unsupported/oipkg/packagelistremote.cpp index e37f256..bb29e80 100644 --- a/noncore/unsupported/oipkg/packagelistremote.cpp +++ b/noncore/unsupported/oipkg/packagelistremote.cpp | |||
@@ -1,49 +1,49 @@ | |||
1 | 1 | ||
2 | #include "packagelistremote.h" | 2 | #include "packagelistremote.h" |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <stdlib.h> | 5 | #include <stdlib.h> |
6 | #include <unistd.h> | 6 | #include <unistd.h> |
7 | 7 | ||
8 | PackageListRemote::PackageListRemote(PackageManagerSettings* s) | 8 | PackageListRemote::PackageListRemote(PackageManagerSettings* s) |
9 | : PackageList(s) | 9 | : PackageList(s) |
10 | { | 10 | { |
11 | PackageListRemote(); | 11 | PackageListRemote(); |
12 | } | 12 | } |
13 | 13 | ||
14 | PackageListRemote::PackageListRemote() | 14 | PackageListRemote::PackageListRemote() |
15 | : PackageList() | 15 | : PackageList() |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | PackageListRemote::~PackageListRemote() | 19 | PackageListRemote::~PackageListRemote() |
20 | { | 20 | { |
21 | } | 21 | } |
22 | 22 | ||
23 | void PackageListRemote::query(QString s) | 23 | void PackageListRemote::query(QString s) |
24 | { | 24 | { |
25 | pvDebug(4,"set query "+s); | 25 | pvDebug(4,"set query "+s); |
26 | searchString = s; | 26 | searchString = s; |
27 | } | 27 | } |
28 | 28 | ||
29 | void PackageListRemote::update() | 29 | void PackageListRemote::update() |
30 | { | 30 | { |
31 | pvDebug(2,"PackageListRemote::update"); | 31 | pvDebug(2,"PackageListRemote::update"); |
32 | if (searchString.isEmpty()) return; | 32 | if (searchString.isEmpty()) return; |
33 | int r=0; | 33 | int r=0; |
34 | QString cmd = "wget"; | 34 | QString cmd = "wget"; |
35 | QString redirect = "/tmp/oipkg.query"; | 35 | QString redirect = "/tmp/oipkg.query"; |
36 | 36 | ||
37 | // use file for output | 37 | // use file for output |
38 | cmd += " --output-document="+redirect; | 38 | cmd += " --output-document="+redirect; |
39 | //http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package§ion= | 39 | //http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package§ion= |
40 | QString server="http://ipkgfind.handhelds.org/"; | 40 | QString server="http://ipkgfind.handhelds.org/"; |
41 | cmd += " \""+server+"/packages.phtml"; | 41 | cmd += " \""+server+"/packages.phtml"; |
42 | cmd += "?format=pda&searchtype=package§ion="; | 42 | cmd += "?format=pda&searchtype=package§ion="; |
43 | cmd += "&query="+searchString; | 43 | cmd += "&query="+searchString; |
44 | cmd += "\""; | 44 | cmd += "\""; |
45 | 45 | ||
46 | pvDebug(4,"search :"+cmd); | 46 | pvDebug(4,"search :"+cmd); |
47 | r = system(cmd.latin1()); | 47 | r = system(cmd.latin1()); |
48 | readFileEntries( redirect ); | 48 | readFileEntries( redirect, "remote" ); |
49 | } | 49 | } |