summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/installdialog.cpp17
-rw-r--r--noncore/unsupported/oipkg/installdialog.h19
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp12
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h12
-rw-r--r--noncore/unsupported/oipkg/package.cpp9
-rw-r--r--noncore/unsupported/oipkg/package.h9
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp9
-rw-r--r--noncore/unsupported/oipkg/packagelist.h9
-rw-r--r--noncore/unsupported/oipkg/packagelistdoclnk.cpp10
-rw-r--r--noncore/unsupported/oipkg/packagelistdoclnk.h9
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.cpp9
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.h9
-rw-r--r--noncore/unsupported/oipkg/packagelistlocal.cpp9
-rw-r--r--noncore/unsupported/oipkg/packagelistlocal.h9
-rw-r--r--noncore/unsupported/oipkg/packagelistremote.cpp9
-rw-r--r--noncore/unsupported/oipkg/packagelistremote.h9
-rw-r--r--noncore/unsupported/oipkg/packagelistview.cpp9
-rw-r--r--noncore/unsupported/oipkg/packagelistview.h9
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp9
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h9
-rw-r--r--noncore/unsupported/oipkg/settings.cpp9
-rw-r--r--noncore/unsupported/oipkg/settings.h10
22 files changed, 197 insertions, 27 deletions
diff --git a/noncore/unsupported/oipkg/installdialog.cpp b/noncore/unsupported/oipkg/installdialog.cpp
index bb50103..c676e84 100644
--- a/noncore/unsupported/oipkg/installdialog.cpp
+++ b/noncore/unsupported/oipkg/installdialog.cpp
@@ -1,107 +1,108 @@
1/**************************************************************************** 1/***************************************************************************
2** Form implementation generated from reading ui file 'installdialog.ui' 2 * *
3** 3 * This program is free software; you can redistribute it and/or modify *
4** Created: Thu May 2 22:19:02 2002 4 * it under the terms of the GNU General Public License as published by *
5** by: The User Interface Compiler (uic) 5 * the Free Software Foundation; either version 2 of the License, or *
6** 6 * (at your option) any later version. *
7** WARNING! All changes made in this file will be lost! 7 * *
8****************************************************************************/ 8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
9#include "installdialog.h" 10#include "installdialog.h"
10 11
11#include <qcheckbox.h> 12#include <qcheckbox.h>
12#include <qgroupbox.h> 13#include <qgroupbox.h>
13#include <qheader.h> 14#include <qheader.h>
14#include <qlistview.h> 15#include <qlistview.h>
15#include <qpushbutton.h> 16#include <qpushbutton.h>
16#include <qlayout.h> 17#include <qlayout.h>
17#include <qvariant.h> 18#include <qvariant.h>
18#include <qtooltip.h> 19#include <qtooltip.h>
19#include <qwhatsthis.h> 20#include <qwhatsthis.h>
20 21
21 22
22InstallDialog::InstallDialog( PackageManagerSettings* s, QWidget* parent, const char* name, bool modal, WFlags fl ) 23InstallDialog::InstallDialog( PackageManagerSettings* s, QWidget* parent, const char* name, bool modal, WFlags fl )
23 : QDialog( parent, name, modal, fl ) 24 : QDialog( parent, name, modal, fl )
24{ 25{
25 settings = s; 26 settings = s;
26 if ( !name ) 27 if ( !name )
27 setName( "InstallDialog" ); 28 setName( "InstallDialog" );
28 resize( 223, 269 ); 29 resize( 223, 269 );
29 setCaption( tr( "Install" ) ); 30 setCaption( tr( "Install" ) );
30 InstallDialogLayout = new QGridLayout( this ); 31 InstallDialogLayout = new QGridLayout( this );
31 InstallDialogLayout->setSpacing( 2 ); 32 InstallDialogLayout->setSpacing( 2 );
32 InstallDialogLayout->setMargin( 2 ); 33 InstallDialogLayout->setMargin( 2 );
33 34
34 ListViewPackages = new PackageListView( this,"listViewPackages",settings ); 35 ListViewPackages = new PackageListView( this,"listViewPackages",settings );
35 36
36 InstallDialogLayout->addWidget( ListViewPackages, 0, 0 ); 37 InstallDialogLayout->addWidget( ListViewPackages, 0, 0 );
37 38
38 GroupBoxOptions = new QGroupBox( this, "GroupBoxOptions" ); 39 GroupBoxOptions = new QGroupBox( this, "GroupBoxOptions" );
39 GroupBoxOptions->setTitle( tr( "Ipkg options" ) ); 40 GroupBoxOptions->setTitle( tr( "Ipkg options" ) );
40 GroupBoxOptions->setColumnLayout(0, Qt::Vertical ); 41 GroupBoxOptions->setColumnLayout(0, Qt::Vertical );
41 GroupBoxOptions->layout()->setSpacing( 0 ); 42 GroupBoxOptions->layout()->setSpacing( 0 );
42 GroupBoxOptions->layout()->setMargin( 0 ); 43 GroupBoxOptions->layout()->setMargin( 0 );
43 GroupBoxOptionsLayout = new QGridLayout( GroupBoxOptions->layout() ); 44 GroupBoxOptionsLayout = new QGridLayout( GroupBoxOptions->layout() );
44 GroupBoxOptionsLayout->setAlignment( Qt::AlignTop ); 45 GroupBoxOptionsLayout->setAlignment( Qt::AlignTop );
45 GroupBoxOptionsLayout->setSpacing( 2 ); 46 GroupBoxOptionsLayout->setSpacing( 2 );
46 GroupBoxOptionsLayout->setMargin( 2 ); 47 GroupBoxOptionsLayout->setMargin( 2 );
47 48
48 _force_depends = new QCheckBox( GroupBoxOptions, "_force_depends" ); 49 _force_depends = new QCheckBox( GroupBoxOptions, "_force_depends" );
49 QFont _force_depends_font( _force_depends->font() ); 50 QFont _force_depends_font( _force_depends->font() );
50 _force_depends_font.setPointSize( 8 ); 51 _force_depends_font.setPointSize( 8 );
51 _force_depends->setFont( _force_depends_font ); 52 _force_depends->setFont( _force_depends_font );
52 _force_depends->setText( tr( "-force-depends" ) ); 53 _force_depends->setText( tr( "-force-depends" ) );
53 //_force_depends->setChecked( true ); 54 //_force_depends->setChecked( true );
54 55
55 GroupBoxOptionsLayout->addWidget( _force_depends, 0, 0 ); 56 GroupBoxOptionsLayout->addWidget( _force_depends, 0, 0 );
56 57
57 _force_reinstall = new QCheckBox( GroupBoxOptions, "_force_reinstall" ); 58 _force_reinstall = new QCheckBox( GroupBoxOptions, "_force_reinstall" );
58 QFont _force_reinstall_font( _force_reinstall->font() ); 59 QFont _force_reinstall_font( _force_reinstall->font() );
59 _force_reinstall_font.setPointSize( 8 ); 60 _force_reinstall_font.setPointSize( 8 );
60 _force_reinstall->setFont( _force_reinstall_font ); 61 _force_reinstall->setFont( _force_reinstall_font );
61 _force_reinstall->setText( tr( "-force-reinstall" ) ); 62 _force_reinstall->setText( tr( "-force-reinstall" ) );
62 63
63 GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 ); 64 GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 );
64 65
65 _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" ); 66 _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" );
66 QFont _force_remove_font( _force_remove->font() ); 67 QFont _force_remove_font( _force_remove->font() );
67 _force_remove_font.setPointSize( 8 ); 68 _force_remove_font.setPointSize( 8 );
68 _force_remove->setFont( _force_remove_font ); 69 _force_remove->setFont( _force_remove_font );
69 _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); 70 _force_remove->setText( tr( "-force-removal-of-essential-packages" ) );
70 71
71 GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 ); 72 GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 );
72 73
73 InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 ); 74 InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 );
74 toRemoveItem = new QCheckListItem( ListViewPackages, tr("To remove") ); 75 toRemoveItem = new QCheckListItem( ListViewPackages, tr("To remove") );
75 toInstallItem = new QCheckListItem( ListViewPackages, tr("To install") ); 76 toInstallItem = new QCheckListItem( ListViewPackages, tr("To install") );
76 77
77} 78}
78 79
79/* 80/*
80 * Destroys the object and frees any allocated resources 81 * Destroys the object and frees any allocated resources
81 */ 82 */
82InstallDialog::~InstallDialog() 83InstallDialog::~InstallDialog()
83{ 84{
84 // no need to delete child widgets, Qt does it all for us 85 // no need to delete child widgets, Qt does it all for us
85} 86}
86 87
87/* 88/*
88 * Main event handler. Reimplemented to handle application 89 * Main event handler. Reimplemented to handle application
89 * font changes 90 * font changes
90 */ 91 */
91bool InstallDialog::event( QEvent* ev ) 92bool InstallDialog::event( QEvent* ev )
92{ 93{
93 bool ret = QDialog::event( ev ); 94 bool ret = QDialog::event( ev );
94 if ( ev->type() == QEvent::ApplicationFontChange ) { 95 if ( ev->type() == QEvent::ApplicationFontChange ) {
95 QFont _force_depends_font( _force_depends->font() ); 96 QFont _force_depends_font( _force_depends->font() );
96 _force_depends_font.setPointSize( 8 ); 97 _force_depends_font.setPointSize( 8 );
97 _force_depends->setFont( _force_depends_font ); 98 _force_depends->setFont( _force_depends_font );
98 QFont _force_reinstall_font( _force_reinstall->font() ); 99 QFont _force_reinstall_font( _force_reinstall->font() );
99 _force_reinstall_font.setPointSize( 8 ); 100 _force_reinstall_font.setPointSize( 8 );
100 _force_reinstall->setFont( _force_reinstall_font ); 101 _force_reinstall->setFont( _force_reinstall_font );
101 QFont _force_remove_font( _force_remove->font() ); 102 QFont _force_remove_font( _force_remove->font() );
102 _force_remove_font.setPointSize( 8 ); 103 _force_remove_font.setPointSize( 8 );
103 _force_remove->setFont( _force_remove_font ); 104 _force_remove->setFont( _force_remove_font );
104 } 105 }
105 return ret; 106 return ret;
106} 107}
107 108
diff --git a/noncore/unsupported/oipkg/installdialog.h b/noncore/unsupported/oipkg/installdialog.h
index 5af2c35..828c8df 100644
--- a/noncore/unsupported/oipkg/installdialog.h
+++ b/noncore/unsupported/oipkg/installdialog.h
@@ -1,47 +1,50 @@
1/**************************************************************************** 1/***************************************************************************
2** Form interface generated from reading ui file 'installdialog.ui' 2 * *
3** 3 * This program is free software; you can redistribute it and/or modify *
4** Created: Thu May 2 22:19:01 2002 4 * it under the terms of the GNU General Public License as published by *
5** by: The User Interface Compiler (uic) 5 * the Free Software Foundation; either version 2 of the License, or *
6** 6 * (at your option) any later version. *
7** WARNING! All changes made in this file will be lost! 7 * *
8****************************************************************************/ 8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
10
11
9#ifndef INSTALLDIALOG_H 12#ifndef INSTALLDIALOG_H
10#define INSTALLDIALOG_H 13#define INSTALLDIALOG_H
11 14
12#include "pksettings.h" 15#include "pksettings.h"
13#include "packagelistview.h" 16#include "packagelistview.h"
14#include <qvariant.h> 17#include <qvariant.h>
15#include <qdialog.h> 18#include <qdialog.h>
16class QVBoxLayout; 19class QVBoxLayout;
17class QHBoxLayout; 20class QHBoxLayout;
18class QGridLayout; 21class QGridLayout;
19class QCheckBox; 22class QCheckBox;
20class QGroupBox; 23class QGroupBox;
21class QListView; 24class QListView;
22class QListViewItem; 25class QListViewItem;
23 26
24class InstallDialog : public QDialog 27class InstallDialog : public QDialog
25{ 28{
26 Q_OBJECT 29 Q_OBJECT
27 30
28public: InstallDialog( PackageManagerSettings* s, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 31public: InstallDialog( PackageManagerSettings* s, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
29 ~InstallDialog(); 32 ~InstallDialog();
30 33
31 PackageListView* ListViewPackages; 34 PackageListView* ListViewPackages;
32 QGroupBox* GroupBoxOptions; 35 QGroupBox* GroupBoxOptions;
33 QCheckBox* _force_depends; 36 QCheckBox* _force_depends;
34 QCheckBox* _force_reinstall; 37 QCheckBox* _force_reinstall;
35 QCheckBox* _force_remove; 38 QCheckBox* _force_remove;
36 QCheckListItem *toRemoveItem; 39 QCheckListItem *toRemoveItem;
37 QCheckListItem *toInstallItem; 40 QCheckListItem *toInstallItem;
38 41
39protected: 42protected:
40 QGridLayout* InstallDialogLayout; 43 QGridLayout* InstallDialogLayout;
41 QGridLayout* GroupBoxOptionsLayout; 44 QGridLayout* GroupBoxOptionsLayout;
42 bool event( QEvent* ); 45 bool event( QEvent* );
43private: 46private:
44 PackageManagerSettings* settings; 47 PackageManagerSettings* settings;
45}; 48};
46 49
47#endif // INSTALLDIALOG_H 50#endif // INSTALLDIALOG_H
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 8778b85..084900d 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -1,497 +1,507 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// Copyright (C) 2000 Trolltech AS.
1// adadpted form qpe/qipkg 10// adadpted form qpe/qipkg
11// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
2 12
3 13
4#include "mainwindow.h" 14#include "mainwindow.h"
5 15
6#include <qpe/qpemenubar.h> 16#include <qpe/qpemenubar.h>
7#include <qpe/qpemessagebox.h> 17#include <qpe/qpemessagebox.h>
8#include <qpe/resource.h> 18#include <qpe/resource.h>
9#include <qpe/config.h> 19#include <qpe/config.h>
10#include <qpe/qpetoolbar.h> 20#include <qpe/qpetoolbar.h>
11#include <qpe/qcopenvelope_qws.h> 21#include <qpe/qcopenvelope_qws.h>
12#include <qaction.h> 22#include <qaction.h>
13#include <qmessagebox.h> 23#include <qmessagebox.h>
14#include <qpopupmenu.h> 24#include <qpopupmenu.h>
15#include <qtoolbutton.h> 25#include <qtoolbutton.h>
16#include <qstring.h> 26#include <qstring.h>
17#include <qlabel.h> 27#include <qlabel.h>
18#include <qfile.h> 28#include <qfile.h>
19#include <qlistview.h> 29#include <qlistview.h>
20#include <qtextview.h> 30#include <qtextview.h>
21#include <qcheckbox.h> 31#include <qcheckbox.h>
22#include <qlineedit.h> 32#include <qlineedit.h>
23#include <qtabwidget.h> 33#include <qtabwidget.h>
24#include <qcombobox.h> 34#include <qcombobox.h>
25#include <qmessagebox.h> 35#include <qmessagebox.h>
26#include <qpushbutton.h> 36#include <qpushbutton.h>
27#include <qlayout.h> 37#include <qlayout.h>
28 38
29#include "pksettingsbase.h" 39#include "pksettingsbase.h"
30#include "utils.h" 40#include "utils.h"
31#include "packagelistitem.h" 41#include "packagelistitem.h"
32 42
33 43
34MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : 44MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
35 QMainWindow( parent, name, f ) 45 QMainWindow( parent, name, f )
36// packageListServers( QObject(parent), name ), 46// packageListServers( QObject(parent), name ),
37// packageListSearch( parent, name ), 47// packageListSearch( parent, name ),
38// packageListDocLnk( parent, name ) 48// packageListDocLnk( parent, name )
39 { 49 {
40 setCaption( tr("Package Manager") ); 50 setCaption( tr("Package Manager") );
41 settings = new PackageManagerSettings(this,0,TRUE); 51 settings = new PackageManagerSettings(this,0,TRUE);
42 listViewPackages = new PackageListView( this,"listViewPackages",settings ); 52 listViewPackages = new PackageListView( this,"listViewPackages",settings );
43 setCentralWidget( listViewPackages ); 53 setCentralWidget( listViewPackages );
44 listViewPackages->addList( tr("feeds"), &packageListServers ); 54 listViewPackages->addList( tr("feeds"), &packageListServers );
45 listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); 55 listViewPackages->addList( tr("ipkgfind"), &packageListSearch );
46listViewPackages->addList( tr("documents"), &packageListDocLnk ); 56 listViewPackages->addList( tr("documents"), &packageListDocLnk );
47 ipkg = new PmIpkg( settings, this ); 57 ipkg = new PmIpkg( settings, this );
48 packageListServers.setSettings( settings ); 58 packageListServers.setSettings( settings );
49 packageListSearch.setSettings( settings ); 59 packageListSearch.setSettings( settings );
50 packageListDocLnk.setSettings( settings ); 60 packageListDocLnk.setSettings( settings );
51 pvDebug(9,"packageListServers.update"); 61 pvDebug(9,"packageListServers.update");
52 packageListServers.update(); 62 packageListServers.update();
53 pvDebug(9,"packageListDocLnk.update"); 63 pvDebug(9,"packageListDocLnk.update");
54 pvDebug(0,"no UPDATE of DocLnk"); 64 pvDebug(0,"no UPDATE of DocLnk");
55 packageListDocLnk.update(); 65 packageListDocLnk.update();
56 pvDebug(9,"makeMenu"); 66 pvDebug(9,"makeMenu");
57 makeMenu(); 67 makeMenu();
58 makeChannel(); 68 makeChannel();
59 //opie is hardcoded default ;) 69 //opie is hardcoded default ;)
60 //pvDebug(9,"section->setCurrentItem"); 70 //pvDebug(9,"section->setCurrentItem");
61// for (int i=0;i<section->count();i++) 71// for (int i=0;i<section->count();i++)
62 // if (section->text(i)=="opie") 72 // if (section->text(i)=="opie")
63 // section->setCurrentItem(i); 73 // section->setCurrentItem(i);
64// sectionChanged(); 74// sectionChanged();
65 75
66 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); 76 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
67 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); 77 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
68 78
69 connect( settings->removeLinksButton, SIGNAL( clicked()), 79 connect( settings->removeLinksButton, SIGNAL( clicked()),
70 SLOT(removeLinks()) ); 80 SLOT(removeLinks()) );
71 connect( settings->createLinksButton, SIGNAL( clicked()), 81 connect( settings->createLinksButton, SIGNAL( clicked()),
72 SLOT(createLinks()) ); 82 SLOT(createLinks()) );
73 83
74 pvDebug(9,"displayList"); 84 pvDebug(9,"displayList");
75 displayList(); 85 displayList();
76} 86}
77 87
78void MainWindow::makeMenu() 88void MainWindow::makeMenu()
79{ 89{
80 90
81 QPEToolBar *toolBar = new QPEToolBar( this ); 91 QPEToolBar *toolBar = new QPEToolBar( this );
82 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 92 QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
83 QPopupMenu *srvMenu = new QPopupMenu( menuBar ); 93 QPopupMenu *srvMenu = new QPopupMenu( menuBar );
84 QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 94 QPopupMenu *viewMenu = new QPopupMenu( menuBar );
85 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 95 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
86 QPopupMenu *helpMenu = new QPopupMenu( menuBar ); 96 QPopupMenu *helpMenu = new QPopupMenu( menuBar );
87 97
88 setToolBarsMovable( false ); 98 setToolBarsMovable( false );
89 toolBar->setHorizontalStretchable( true ); 99 toolBar->setHorizontalStretchable( true );
90 menuBar->insertItem( tr( "Package" ), srvMenu ); 100 menuBar->insertItem( tr( "Package" ), srvMenu );
91 menuBar->insertItem( tr( "View" ), viewMenu ); 101 menuBar->insertItem( tr( "View" ), viewMenu );
92 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 102 menuBar->insertItem( tr( "Settings" ), cfgMenu );
93 menuBar->insertItem( tr( "Help" ), helpMenu ); 103 menuBar->insertItem( tr( "Help" ), helpMenu );
94 104
95 QLabel *spacer; 105 QLabel *spacer;
96// spacer = new QLabel( "", toolBar ); 106// spacer = new QLabel( "", toolBar );
97// spacer->setBackgroundColor( toolBar->backgroundColor() ); 107// spacer->setBackgroundColor( toolBar->backgroundColor() );
98// toolBar->setStretchableWidget( spacer ); 108// toolBar->setStretchableWidget( spacer );
99 109
100 110
101 runAction = new QAction( tr( "Apply" ), 111 runAction = new QAction( tr( "Apply" ),
102 Resource::loadPixmap( "oipkg/install" ), 112 Resource::loadPixmap( "oipkg/install" ),
103 QString::null, 0, this, 0 ); 113 QString::null, 0, this, 0 );
104 connect( runAction, SIGNAL( activated() ), 114 connect( runAction, SIGNAL( activated() ),
105 this, SLOT( runIpkg() ) ); 115 this, SLOT( runIpkg() ) );
106 runAction->addTo( toolBar ); 116 runAction->addTo( toolBar );
107 runAction->addTo( srvMenu ); 117 runAction->addTo( srvMenu );
108 118
109 srvMenu->insertSeparator(); 119 srvMenu->insertSeparator();
110 120
111 updateAction = new QAction( tr( "Update" ), 121 updateAction = new QAction( tr( "Update" ),
112 Resource::loadIconSet( "oipkg/update" ), 122 Resource::loadIconSet( "oipkg/update" ),
113 QString::null, 0, this, 0 ); 123 QString::null, 0, this, 0 );
114 connect( updateAction, SIGNAL( activated() ), 124 connect( updateAction, SIGNAL( activated() ),
115 this , SLOT( updateList() ) ); 125 this , SLOT( updateList() ) );
116 updateAction->addTo( toolBar ); 126 updateAction->addTo( toolBar );
117 updateAction->addTo( srvMenu ); 127 updateAction->addTo( srvMenu );
118 128
119 QAction *cfgact; 129 QAction *cfgact;
120 130
121 cfgact = new QAction( tr( "Setups" ), 131 cfgact = new QAction( tr( "Setups" ),
122 QString::null, 0, this, 0 ); 132 QString::null, 0, this, 0 );
123 connect( cfgact, SIGNAL( activated() ), 133 connect( cfgact, SIGNAL( activated() ),
124 SLOT( showSettings() ) ); 134 SLOT( showSettings() ) );
125 cfgact->addTo( cfgMenu ); 135 cfgact->addTo( cfgMenu );
126 136
127 cfgact = new QAction( tr( "Servers" ), 137 cfgact = new QAction( tr( "Servers" ),
128 QString::null, 0, this, 0 ); 138 QString::null, 0, this, 0 );
129 connect( cfgact, SIGNAL( activated() ), 139 connect( cfgact, SIGNAL( activated() ),
130 SLOT( showSettingsSrv() ) ); 140 SLOT( showSettingsSrv() ) );
131 cfgact->addTo( cfgMenu ); 141 cfgact->addTo( cfgMenu );
132 cfgact = new QAction( tr( "Destinations" ), 142 cfgact = new QAction( tr( "Destinations" ),
133 QString::null, 0, this, 0 ); 143 QString::null, 0, this, 0 );
134 connect( cfgact, SIGNAL( activated() ), 144 connect( cfgact, SIGNAL( activated() ),
135 SLOT( showSettingsDst() ) ); 145 SLOT( showSettingsDst() ) );
136 cfgact->addTo( cfgMenu ); 146 cfgact->addTo( cfgMenu );
137 147
138 QAction *a; 148 QAction *a;
139 149
140 // SECTIONS 150 // SECTIONS
141 sectionBar = new QPEToolBar( this ); 151 sectionBar = new QPEToolBar( this );
142 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); 152 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE );
143 sectionBar->setHorizontalStretchable( true ); 153 sectionBar->setHorizontalStretchable( true );
144 QLabel *label = new QLabel( tr("Section: "), sectionBar ); 154 QLabel *label = new QLabel( tr("Section: "), sectionBar );
145 label->setBackgroundColor( sectionBar->backgroundColor() ); 155 label->setBackgroundColor( sectionBar->backgroundColor() );
146 section = new QComboBox( false, sectionBar ); 156 section = new QComboBox( false, sectionBar );
147 label = new QLabel( " / ", sectionBar ); 157 label = new QLabel( " / ", sectionBar );
148 label->setBackgroundColor( sectionBar->backgroundColor() ); 158 label->setBackgroundColor( sectionBar->backgroundColor() );
149 subsection = new QComboBox( false, sectionBar ); 159 subsection = new QComboBox( false, sectionBar );
150 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 160 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
151 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); 161 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
152 a->addTo( sectionBar ); 162 a->addTo( sectionBar );
153 setSections(); 163 setSections();
154 setSubSections(); 164 setSubSections();
155 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); 165 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
156 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); 166 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
157 sectionAction->setToggleAction( true ); 167 sectionAction->setToggleAction( true );
158 sectionAction->addTo( viewMenu ); 168 sectionAction->addTo( viewMenu );
159 sectionBar->setStretchableWidget( section ); 169 sectionBar->setStretchableWidget( section );
160 170
161 //FIND 171 //FIND
162 findBar = new QPEToolBar(this); 172 findBar = new QPEToolBar(this);
163 addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); 173 addToolBar( findBar, "Filter", QMainWindow::Top, TRUE );
164 label = new QLabel( tr("Filter: "), findBar ); 174 label = new QLabel( tr("Filter: "), findBar );
165 label->setBackgroundColor( findBar->backgroundColor() ); 175 label->setBackgroundColor( findBar->backgroundColor() );
166 findBar->setHorizontalStretchable( TRUE ); 176 findBar->setHorizontalStretchable( TRUE );
167 findEdit = new QLineEdit( findBar, "findEdit" ); 177 findEdit = new QLineEdit( findBar, "findEdit" );
168 findBar->setStretchableWidget( findEdit ); 178 findBar->setStretchableWidget( findEdit );
169 connect( findEdit, SIGNAL( textChanged( const QString & ) ), 179 connect( findEdit, SIGNAL( textChanged( const QString & ) ),
170 this, SLOT( displayList() ) ); 180 this, SLOT( displayList() ) );
171 a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 181 a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
172 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); 182 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) );
173 a->addTo( findBar ); 183 a->addTo( findBar );
174 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 184 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
175 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 185 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
176 a->addTo( findBar ); 186 a->addTo( findBar );
177 findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); 187 findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 );
178 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); 188 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
179 findAction->setToggleAction( true ); 189 findAction->setToggleAction( true );
180 findAction->addTo( viewMenu ); 190 findAction->addTo( viewMenu );
181 191
182 //SEARCH 192 //SEARCH
183 searchBar = new QPEToolBar(this); 193 searchBar = new QPEToolBar(this);
184 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 194 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
185 label = new QLabel( tr("ipkgfind: "), searchBar ); 195 label = new QLabel( tr("ipkgfind: "), searchBar );
186 label->setBackgroundColor( searchBar->backgroundColor() ); 196 label->setBackgroundColor( searchBar->backgroundColor() );
187 searchBar->setHorizontalStretchable( TRUE ); 197 searchBar->setHorizontalStretchable( TRUE );
188 searchEdit = new QLineEdit( searchBar, "seachEdit" ); 198 searchEdit = new QLineEdit( searchBar, "seachEdit" );
189 searchBar->setStretchableWidget( searchEdit ); 199 searchBar->setStretchableWidget( searchEdit );
190// connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 200// connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
191// this, SLOT( displayList() ) ); 201// this, SLOT( displayList() ) );
192 a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 202 a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
193 connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); 203 connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) );
194 a->addTo( searchBar ); 204 a->addTo( searchBar );
195 searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 205 searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
196 connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); 206 connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) );
197 searchCommit->addTo( searchBar ); 207 searchCommit->addTo( searchBar );
198 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 208 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
199 connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); 209 connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) );
200 a->addTo( searchBar ); 210 a->addTo( searchBar );
201 searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); 211 searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 );
202 connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); 212 connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) );
203 searchAction->setToggleAction( true ); 213 searchAction->setToggleAction( true );
204 searchAction->addTo( viewMenu ); 214 searchAction->addTo( viewMenu );
205 215
206 //DEST 216 //DEST
207 destBar = new QPEToolBar(this); 217 destBar = new QPEToolBar(this);
208 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); 218 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE );
209 label = new QLabel( tr("Destination: "), destBar ); 219 label = new QLabel( tr("Destination: "), destBar );
210 label->setBackgroundColor( destBar->backgroundColor() ); 220 label->setBackgroundColor( destBar->backgroundColor() );
211 destBar->setHorizontalStretchable( TRUE ); 221 destBar->setHorizontalStretchable( TRUE );
212 destination = new QComboBox( false, destBar ); 222 destination = new QComboBox( false, destBar );
213 destination->insertStringList( settings->getDestinationNames() ); 223 destination->insertStringList( settings->getDestinationNames() );
214 setComboName(destination,settings->getDestinationName()); 224 setComboName(destination,settings->getDestinationName());
215 connect( destination, SIGNAL(activated(int)), 225 connect( destination, SIGNAL(activated(int)),
216 settings, SLOT(activeDestinationChange(int)) ); 226 settings, SLOT(activeDestinationChange(int)) );
217 spacer = new QLabel( " ", destBar ); 227 spacer = new QLabel( " ", destBar );
218 spacer->setBackgroundColor( destBar->backgroundColor() ); 228 spacer->setBackgroundColor( destBar->backgroundColor() );
219 CheckBoxLink = new QCheckBox( tr("Link"), destBar); 229 CheckBoxLink = new QCheckBox( tr("Link"), destBar);
220 CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); 230 CheckBoxLink->setBackgroundColor( destBar->backgroundColor() );
221 CheckBoxLink->setChecked( settings->createLinks() ); 231 CheckBoxLink->setChecked( settings->createLinks() );
222 connect( CheckBoxLink, SIGNAL(toggled(bool)), 232 connect( CheckBoxLink, SIGNAL(toggled(bool)),
223 settings, SLOT(linkEnabled(bool)) ); 233 settings, SLOT(linkEnabled(bool)) );
224 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); 234 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 );
225 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); 235 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) );
226 a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 236 a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
227 connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); 237 connect( a, SIGNAL( activated() ), SLOT( destClose() ) );
228 a->addTo( destBar ); 238 a->addTo( destBar );
229 destBar->setStretchableWidget( CheckBoxLink ); 239 destBar->setStretchableWidget( CheckBoxLink );
230 destAction->setToggleAction( true ); 240 destAction->setToggleAction( true );
231 // destAction->addTo( viewMenu ); 241 // destAction->addTo( viewMenu );
232 242
233// helpMenu 243// helpMenu
234 helpMenu->insertSeparator(); 244 helpMenu->insertSeparator();
235 a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 ); 245 a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 );
236 a->addTo( helpMenu ); 246 a->addTo( helpMenu );
237 helpMenu->insertSeparator(); 247 helpMenu->insertSeparator();
238 a = new QAction( tr( "Install" ), 248 a = new QAction( tr( "Install" ),
239 Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 ); 249 Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 );
240 a->addTo( helpMenu ); 250 a->addTo( helpMenu );
241 a = new QAction( tr( "Remove" ), 251 a = new QAction( tr( "Remove" ),
242 Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 ); 252 Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 );
243 a->addTo( helpMenu ); 253 a->addTo( helpMenu );
244 helpMenu->insertSeparator(); 254 helpMenu->insertSeparator();
245 a = new QAction( tr( "Package Status" ), QString::null, 0, this, 0 ); 255 a = new QAction( tr( "Package Status" ), QString::null, 0, this, 0 );
246 a->addTo( helpMenu ); 256 a->addTo( helpMenu );
247 helpMenu->insertSeparator(); 257 helpMenu->insertSeparator();
248 a = new QAction( tr( "New version, installed" ), 258 a = new QAction( tr( "New version, installed" ),
249 Resource::loadPixmap( "oipkg/installed" ), QString::null, 0, this, 0 ); 259 Resource::loadPixmap( "oipkg/installed" ), QString::null, 0, this, 0 );
250 a->addTo( helpMenu ); 260 a->addTo( helpMenu );
251 a = new QAction( tr( "New version, not installed" ), 261 a = new QAction( tr( "New version, not installed" ),
252 Resource::loadPixmap( "oipkg/uninstalled" ), QString::null, 0, this, 0 ); 262 Resource::loadPixmap( "oipkg/uninstalled" ), QString::null, 0, this, 0 );
253 a->addTo( helpMenu ); 263 a->addTo( helpMenu );
254 a = new QAction( tr( "Old version, installed" ), 264 a = new QAction( tr( "Old version, installed" ),
255 Resource::loadPixmap( "oipkg/installedOld" ), QString::null, 0, this, 0 ); 265 Resource::loadPixmap( "oipkg/installedOld" ), QString::null, 0, this, 0 );
256 a->addTo( helpMenu ); 266 a->addTo( helpMenu );
257 a = new QAction( tr( "Old version, not installed" ), 267 a = new QAction( tr( "Old version, not installed" ),
258 Resource::loadPixmap( "oipkg/uninstalledOld" ), QString::null, 0, this, 0 ); 268 Resource::loadPixmap( "oipkg/uninstalledOld" ), QString::null, 0, this, 0 );
259 a->addTo( helpMenu ); 269 a->addTo( helpMenu );
260 a = new QAction( tr( "Old version, new version installed" ), 270 a = new QAction( tr( "Old version, new version installed" ),
261 Resource::loadPixmap( "oipkg/uninstalledOldinstalledNew" ), QString::null, 0, this, 0 ); 271 Resource::loadPixmap( "oipkg/uninstalledOldinstalledNew" ), QString::null, 0, this, 0 );
262 a->addTo( helpMenu ); 272 a->addTo( helpMenu );
263 a = new QAction( tr( "New version, old version installed" ), 273 a = new QAction( tr( "New version, old version installed" ),
264 Resource::loadPixmap( "oipkg/uninstalledInstalledOld" ), QString::null, 0, this, 0 ); 274 Resource::loadPixmap( "oipkg/uninstalledInstalledOld" ), QString::null, 0, this, 0 );
265 a->addTo( helpMenu ); 275 a->addTo( helpMenu );
266 //a = new QAction( tr( "" ), 276 //a = new QAction( tr( "" ),
267 // Resource::loadPixmap( "oipkg/" ), QString::null, 0, this, 0 ); 277 // Resource::loadPixmap( "oipkg/" ), QString::null, 0, this, 0 );
268 // a->addTo( helpMenu ); 278 // a->addTo( helpMenu );
269 279
270 // configure the menus 280 // configure the menus
271 Config cfg( "oipkg", Config::User ); 281 Config cfg( "oipkg", Config::User );
272 cfg.setGroup( "gui" ); 282 cfg.setGroup( "gui" );
273 283
274 findShow( cfg.readBoolEntry( "findBar", true ) ); 284 findShow( cfg.readBoolEntry( "findBar", true ) );
275 searchShow( cfg.readBoolEntry( "searchBar", true ) ); 285 searchShow( cfg.readBoolEntry( "searchBar", true ) );
276 sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); 286 sectionShow( cfg.readBoolEntry( "sectionBar", true ) );
277 destShow( cfg.readBoolEntry( "destBar", false ) ); 287 destShow( cfg.readBoolEntry( "destBar", false ) );
278} 288}
279 289
280MainWindow::~MainWindow() 290MainWindow::~MainWindow()
281{ 291{
282 Config cfg( "oipkg", Config::User ); 292 Config cfg( "oipkg", Config::User );
283 cfg.setGroup( "gui" ); 293 cfg.setGroup( "gui" );
284 cfg.writeEntry( "findBar", !findBar->isHidden() ); 294 cfg.writeEntry( "findBar", !findBar->isHidden() );
285 cfg.writeEntry( "searchBar", !searchBar->isHidden() ); 295 cfg.writeEntry( "searchBar", !searchBar->isHidden() );
286 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); 296 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
287 cfg.writeEntry( "destBar", !destBar->isHidden() ); 297 cfg.writeEntry( "destBar", !destBar->isHidden() );
288 298
289} 299}
290 300
291void MainWindow::runIpkg() 301void MainWindow::runIpkg()
292{ 302{
293 packageListServers.allPackages(); 303 packageListServers.allPackages();
294 ipkg->loadList( &packageListSearch ); 304 ipkg->loadList( &packageListSearch );
295 ipkg->loadList( &packageListDocLnk ); 305 ipkg->loadList( &packageListDocLnk );
296 ipkg->loadList( &packageListServers ); 306 ipkg->loadList( &packageListServers );
297 ipkg->commit(); 307 ipkg->commit();
298 ipkg->clearLists(); 308 ipkg->clearLists();
299 // ##### If we looked in the list of files, we could send out accurate 309 // ##### If we looked in the list of files, we could send out accurate
300 // ##### messages. But we don't bother yet, and just do an "all". 310 // ##### messages. But we don't bother yet, and just do an "all".
301 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 311 QCopEnvelope e("QPE/System", "linkChanged(QString)");
302 QString lf = QString::null; 312 QString lf = QString::null;
303 e << lf; 313 e << lf;
304 displayList(); 314 displayList();
305} 315}
306 316
307void MainWindow::updateList() 317void MainWindow::updateList()
308{ 318{
309 packageListServers.clear(); 319 packageListServers.clear();
310 packageListSearch.clear(); 320 packageListSearch.clear();
311 321
312 packageListDocLnk.clear(); 322 packageListDocLnk.clear();
313 ipkg->update(); 323 ipkg->update();
314 packageListServers.update(); 324 packageListServers.update();
315 packageListSearch.update(); 325 packageListSearch.update();
316 packageListDocLnk.update(); 326 packageListDocLnk.update();
317} 327}
318 328
319void MainWindow::filterList() 329void MainWindow::filterList()
320{ 330{
321 QString f = ""; 331 QString f = "";
322 if ( findAction->isOn() ) f = findEdit->text(); 332 if ( findAction->isOn() ) f = findEdit->text();
323 packageListServers.filterPackages( f ); 333 packageListServers.filterPackages( f );
324} 334}
325 335
326void MainWindow::displayList() 336void MainWindow::displayList()
327{ 337{
328 filterList(); 338 filterList();
329 listViewPackages->display(); 339 listViewPackages->display();
330} 340}
331 341
332void MainWindow::sectionChanged() 342void MainWindow::sectionChanged()
333{ 343{
334 disconnect( section, SIGNAL( activated(int) ), 344 disconnect( section, SIGNAL( activated(int) ),
335 this, SLOT( sectionChanged() ) ); 345 this, SLOT( sectionChanged() ) );
336 disconnect( subsection, SIGNAL(activated(int) ), 346 disconnect( subsection, SIGNAL(activated(int) ),
337 this, SLOT( subSectionChanged() ) ); 347 this, SLOT( subSectionChanged() ) );
338 subsection->clear(); 348 subsection->clear();
339 packageListServers.setSection( section->currentText() ); 349 packageListServers.setSection( section->currentText() );
340 setSubSections(); 350 setSubSections();
341 connect( section, SIGNAL( activated(int) ), 351 connect( section, SIGNAL( activated(int) ),
342 this, SLOT( sectionChanged() ) ); 352 this, SLOT( sectionChanged() ) );
343 connect( subsection, SIGNAL(activated(int) ), 353 connect( subsection, SIGNAL(activated(int) ),
344 this, SLOT( subSectionChanged() ) ); 354 this, SLOT( subSectionChanged() ) );
345 displayList(); 355 displayList();
346} 356}
347 357
348void MainWindow::subSectionChanged() 358void MainWindow::subSectionChanged()
349{ 359{
350 disconnect( section, SIGNAL( activated(int) ), 360 disconnect( section, SIGNAL( activated(int) ),
351 this, SLOT( sectionChanged() ) ); 361 this, SLOT( sectionChanged() ) );
352 disconnect( subsection, SIGNAL(activated(int) ), 362 disconnect( subsection, SIGNAL(activated(int) ),
353 this, SLOT( subSectionChanged() ) ); 363 this, SLOT( subSectionChanged() ) );
354 packageListServers.setSubSection( subsection->currentText() ); 364 packageListServers.setSubSection( subsection->currentText() );
355 connect( section, SIGNAL( activated(int) ), 365 connect( section, SIGNAL( activated(int) ),
356 this, SLOT( sectionChanged() ) ); 366 this, SLOT( sectionChanged() ) );
357 connect( subsection, SIGNAL(activated(int) ), 367 connect( subsection, SIGNAL(activated(int) ),
358 this, SLOT( subSectionChanged() ) ); 368 this, SLOT( subSectionChanged() ) );
359 displayList(); 369 displayList();
360} 370}
361 371
362void MainWindow::setSections() 372void MainWindow::setSections()
363{ 373{
364 section->clear(); 374 section->clear();
365 section->insertStringList( packageListServers.getSections() ); 375 section->insertStringList( packageListServers.getSections() );
366} 376}
367 377
368void MainWindow::setSubSections() 378void MainWindow::setSubSections()
369{ 379{
370 subsection->clear(); 380 subsection->clear();
371 subsection->insertStringList( packageListServers.getSubSections() ); 381 subsection->insertStringList( packageListServers.getSubSections() );
372} 382}
373 383
374 384
375void MainWindow::showSettings() 385void MainWindow::showSettings()
376{ 386{
377 if ( settings->showDialog( 0 ) ) 387 if ( settings->showDialog( 0 ) )
378 updateList(); 388 updateList();
379} 389}
380void MainWindow::showSettingsSrv() 390void MainWindow::showSettingsSrv()
381{ 391{
382 if ( settings->showDialog( 1 ) ) 392 if ( settings->showDialog( 1 ) )
383 updateList(); 393 updateList();
384} 394}
385void MainWindow::showSettingsDst() 395void MainWindow::showSettingsDst()
386{ 396{
387 if ( settings->showDialog( 2 ) ) 397 if ( settings->showDialog( 2 ) )
388 updateList(); 398 updateList();
389} 399}
390 400
391void MainWindow::sectionShow(bool b) 401void MainWindow::sectionShow(bool b)
392{ 402{
393 if (b) sectionBar->show(); 403 if (b) sectionBar->show();
394 else sectionBar->hide(); 404 else sectionBar->hide();
395 sectionAction->setOn( b ); 405 sectionAction->setOn( b );
396} 406}
397 407
398void MainWindow::sectionClose() 408void MainWindow::sectionClose()
399{ 409{
400 sectionAction->setOn( false ); 410 sectionAction->setOn( false );
401} 411}
402 412
403void MainWindow::findShow(bool b) 413void MainWindow::findShow(bool b)
404{ 414{
405 if (b) findBar->show(); 415 if (b) findBar->show();
406 else findBar->hide(); 416 else findBar->hide();
407 findAction->setOn( b ); 417 findAction->setOn( b );
408} 418}
409 419
410void MainWindow::findClose() 420void MainWindow::findClose()
411{ 421{
412 findAction->setOn( false ); 422 findAction->setOn( false );
413} 423}
414 424
415void MainWindow::searchShow(bool b) 425void MainWindow::searchShow(bool b)
416{ 426{
417 if (b) searchBar->show(); 427 if (b) searchBar->show();
418 else searchBar->hide(); 428 else searchBar->hide();
419 searchAction->setOn( b ); 429 searchAction->setOn( b );
420} 430}
421 431
422void MainWindow::searchClose() 432void MainWindow::searchClose()
423{ 433{
424 searchAction->setOn( false ); 434 searchAction->setOn( false );
425} 435}
426 436
427 437
428void MainWindow::destShow(bool b) 438void MainWindow::destShow(bool b)
429{ 439{
430 if (b) destBar->show(); 440 if (b) destBar->show();
431 else destBar->hide(); 441 else destBar->hide();
432 destAction->setOn( b ); 442 destAction->setOn( b );
433} 443}
434 444
435void MainWindow::destClose() 445void MainWindow::destClose()
436{ 446{
437 destAction->setOn( false ); 447 destAction->setOn( false );
438} 448}
439 449
440void MainWindow::setDocument(const QString &fileName) 450void MainWindow::setDocument(const QString &fileName)
441{ 451{
442 if ( !QFile::exists( fileName ) ) return; 452 if ( !QFile::exists( fileName ) ) return;
443 ipkg->installFile( fileName ); 453 ipkg->installFile( fileName );
444 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 454 QCopEnvelope e("QPE/System", "linkChanged(QString)");
445 QString lf = QString::null; 455 QString lf = QString::null;
446 e << lf; 456 e << lf;
447} 457}
448 458
449 459
450void MainWindow::makeChannel() 460void MainWindow::makeChannel()
451 { 461 {
452 channel = new QCopChannel( "QPE/Application/oipkg", this ); 462 channel = new QCopChannel( "QPE/Application/oipkg", this );
453 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 463 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
454 this, SLOT(receive(const QCString&, const QByteArray&)) ); 464 this, SLOT(receive(const QCString&, const QByteArray&)) );
455} 465}
456 466
457 467
458 468
459void MainWindow::receive(const QCString &msg, const QByteArray &arg) 469void MainWindow::receive(const QCString &msg, const QByteArray &arg)
460{ 470{
461 pvDebug(3, "QCop "+msg+" "+QCString(arg)); 471 pvDebug(3, "QCop "+msg+" "+QCString(arg));
462 if ( msg == "installFile(QString)" ) 472 if ( msg == "installFile(QString)" )
463 { 473 {
464 ipkg->installFile( QString(arg) ); 474 ipkg->installFile( QString(arg) );
465 }else if( msg == "removeFile(QString)" ) 475 }else if( msg == "removeFile(QString)" )
466 { 476 {
467 ipkg->removeFile( QString(arg) ); 477 ipkg->removeFile( QString(arg) );
468 }else if( msg == "createLinks(QString)" ) 478 }else if( msg == "createLinks(QString)" )
469 { 479 {
470 ipkg->createLinks( QString(arg) ); 480 ipkg->createLinks( QString(arg) );
471 }else if( msg == "removeLinks(QString)" ) 481 }else if( msg == "removeLinks(QString)" )
472 { 482 {
473 ipkg->removeLinks( QString(arg) ); 483 ipkg->removeLinks( QString(arg) );
474 }else{ 484 }else{
475 pvDebug(2,"Huh what do ya want") 485 pvDebug(2,"Huh what do ya want")
476 } 486 }
477} 487}
478 488
479 489
480void MainWindow::createLinks() 490void MainWindow::createLinks()
481{ 491{
482 pvDebug(2,"creating links..."); 492 pvDebug(2,"creating links...");
483 ipkg->createLinks( settings->destinationurl->text() ); 493 ipkg->createLinks( settings->destinationurl->text() );
484} 494}
485 495
486void MainWindow::removeLinks() 496void MainWindow::removeLinks()
487{ 497{
488 pvDebug(2,"removing links..."); 498 pvDebug(2,"removing links...");
489 ipkg->removeLinks( settings->destinationurl->text() ); 499 ipkg->removeLinks( settings->destinationurl->text() );
490} 500}
491 501
492void MainWindow::remotePackageQuery() 502void MainWindow::remotePackageQuery()
493{ 503{
494 packageListSearch.query( searchEdit->text() ); 504 packageListSearch.query( searchEdit->text() );
495 packageListSearch.update(); 505 packageListSearch.update();
496 displayList(); 506 displayList();
497} 507}
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h
index 4a5e8bf..090ddd3 100644
--- a/noncore/unsupported/oipkg/mainwindow.h
+++ b/noncore/unsupported/oipkg/mainwindow.h
@@ -1,94 +1,106 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// Copyright (C) 2000 Trolltech AS.
10// adadpted form qpe/qipkg
11// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
12
1#ifndef MAINWINDOW_H 13#ifndef MAINWINDOW_H
2#define MAINWINDOW_H 14#define MAINWINDOW_H
3 15
4#include <qmainwindow.h> 16#include <qmainwindow.h>
5#include <qaction.h> 17#include <qaction.h>
6#include <qtimer.h> 18#include <qtimer.h>
7#include <qpopupmenu.h> 19#include <qpopupmenu.h>
8 20
9#include "packagelist.h" 21#include "packagelist.h"
10#include "packagelistremote.h" 22#include "packagelistremote.h"
11#include "packagelistlocal.h" 23#include "packagelistlocal.h"
12#include "packagelistdoclnk.h" 24#include "packagelistdoclnk.h"
13#include "pmipkg.h" 25#include "pmipkg.h"
14#include "pksettings.h" 26#include "pksettings.h"
15#include "packagelistview.h" 27#include "packagelistview.h"
16 28
17class QComboBox; 29class QComboBox;
18class QPEToolBar; 30class QPEToolBar;
19class QLineEdit; 31class QLineEdit;
20class PackageListItem; 32class PackageListItem;
21class QCopChannel; 33class QCopChannel;
22class QMessageBox; 34class QMessageBox;
23class QCheckBox; 35class QCheckBox;
24 36
25class MainWindow : public QMainWindow 37class MainWindow : public QMainWindow
26{ 38{
27 Q_OBJECT 39 Q_OBJECT
28 40
29 41
30public: 42public:
31 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 43 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
32 ~MainWindow(); 44 ~MainWindow();
33 void makeChannel(); 45 void makeChannel();
34 46
35 QCopChannel *channel; 47 QCopChannel *channel;
36 48
37protected slots: 49protected slots:
38 void runIpkg(); 50 void runIpkg();
39 void updateList(); 51 void updateList();
40 void displayList(); 52 void displayList();
41 void subSectionChanged(); 53 void subSectionChanged();
42 void sectionChanged(); 54 void sectionChanged();
43 void showSettings(); 55 void showSettings();
44 void showSettingsSrv(); 56 void showSettingsSrv();
45 void showSettingsDst(); 57 void showSettingsDst();
46 58
47public slots: 59public slots:
48 void sectionClose(); 60 void sectionClose();
49 void sectionShow(bool); 61 void sectionShow(bool);
50 void findClose(); 62 void findClose();
51 void findShow(bool); 63 void findShow(bool);
52 void searchClose(); 64 void searchClose();
53 void searchShow(bool); 65 void searchShow(bool);
54 void destClose(); 66 void destClose();
55 void destShow(bool); 67 void destShow(bool);
56 void filterList(); 68 void filterList();
57 void createLinks(); 69 void createLinks();
58 void removeLinks(); 70 void removeLinks();
59 void receive (const QCString &, const QByteArray &); 71 void receive (const QCString &, const QByteArray &);
60 void setDocument (const QString &); 72 void setDocument (const QString &);
61 void remotePackageQuery(); 73 void remotePackageQuery();
62 74
63private: 75private:
64 void makeMenu(); 76 void makeMenu();
65 void setSections(); 77 void setSections();
66 void setSubSections(); 78 void setSubSections();
67 bool updateIcon; 79 bool updateIcon;
68 80
69 PmIpkg* ipkg; 81 PmIpkg* ipkg;
70 PackageManagerSettings *settings; 82 PackageManagerSettings *settings;
71 PackageListLocal packageListServers; 83 PackageListLocal packageListServers;
72 PackageListRemote packageListSearch; 84 PackageListRemote packageListSearch;
73 PackageListDocLnk packageListDocLnk; 85 PackageListDocLnk packageListDocLnk;
74 PackageListView *listViewPackages; 86 PackageListView *listViewPackages;
75 QAction *runAction; 87 QAction *runAction;
76 QAction *updateAction; 88 QAction *updateAction;
77 QAction *findAction; 89 QAction *findAction;
78 QPEToolBar *findBar; 90 QPEToolBar *findBar;
79 QLineEdit *findEdit; 91 QLineEdit *findEdit;
80 QAction *searchAction; 92 QAction *searchAction;
81 QAction *searchCommit; 93 QAction *searchCommit;
82 QPEToolBar *searchBar; 94 QPEToolBar *searchBar;
83 QLineEdit *searchEdit; 95 QLineEdit *searchEdit;
84 QAction *sectionAction; 96 QAction *sectionAction;
85 QPEToolBar *sectionBar; 97 QPEToolBar *sectionBar;
86 QComboBox *section; 98 QComboBox *section;
87 QComboBox *subsection; 99 QComboBox *subsection;
88 QAction *destAction; 100 QAction *destAction;
89 QPEToolBar *destBar; 101 QPEToolBar *destBar;
90 QComboBox *destination; 102 QComboBox *destination;
91 QCheckBox* CheckBoxLink; 103 QCheckBox* CheckBoxLink;
92}; 104};
93 105
94#endif 106#endif
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 0cd93bf..7aaa240 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -1,463 +1,472 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1#include "package.h" 10#include "package.h"
2 11
3#include <qpe/process.h> 12#include <qpe/process.h>
4#include <qpe/stringutil.h> 13#include <qpe/stringutil.h>
5#include <qfile.h> 14#include <qfile.h>
6#include <qtextstream.h> 15#include <qtextstream.h>
7#include <stdlib.h> 16#include <stdlib.h>
8#include <unistd.h> 17#include <unistd.h>
9 18
10#include "debug.h" 19#include "debug.h"
11 20
12Package::Package( QObject *parent, const char *name ) 21Package::Package( QObject *parent, const char *name )
13 : QObject(parent,name) 22 : QObject(parent,name)
14{ 23{
15 24
16} 25}
17 26
18Package::~Package() 27Package::~Package()
19{ 28{
20} 29}
21 30
22Package::Package( PackageManagerSettings *s, QObject *parent, const char *name ) 31Package::Package( PackageManagerSettings *s, QObject *parent, const char *name )
23 : QObject(parent,name) 32 : QObject(parent,name)
24{ 33{
25 Package(parent,name); 34 Package(parent,name);
26 init(s); 35 init(s);
27} 36}
28 37
29void Package::init( PackageManagerSettings *s ) 38void Package::init( PackageManagerSettings *s )
30{ 39{
31 settings = s; 40 settings = s;
32 _size = ""; 41 _size = "";
33 _section = ""; 42 _section = "";
34 _subsection = ""; 43 _subsection = "";
35 _shortDesc = ""; 44 _shortDesc = "";
36 _desc = ""; 45 _desc = "";
37 _name = ""; 46 _name = "";
38 _toProcess = false; 47 _toProcess = false;
39 _useFileName = false; 48 _useFileName = false;
40 _old = false; 49 _old = false;
41 _status = ""; 50 _status = "";
42 _dest = settings->getDestinationName(); 51 _dest = settings->getDestinationName();
43 _link = settings->createLinks(); 52 _link = settings->createLinks();
44 _versions=0; 53 _versions=0;
45 _version=""; 54 _version="";
46} 55}
47 56
48Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) 57Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name )
49 : QObject(parent,name) 58 : QObject(parent,name)
50 { 59 {
51 init(s); 60 init(s);
52 parsePackage( pack ); 61 parsePackage( pack );
53} 62}
54 63
55Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) 64Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const char *name )
56 : QObject(parent,name) 65 : QObject(parent,name)
57 { 66 {
58 init(s); 67 init(s);
59 if ( !QFile::exists( n ) ) 68 if ( !QFile::exists( n ) )
60 { 69 {
61 _name = QString( n ); 70 _name = QString( n );
62 }else{ 71 }else{
63 pvDebug(4,"remote file: "+n); 72 pvDebug(4,"remote file: "+n);
64 parseIpkgFile( n ); 73 parseIpkgFile( n );
65 _useFileName = true; 74 _useFileName = true;
66 _fileName = QString( n ); 75 _fileName = QString( n );
67 } 76 }
68} 77}
69 78
70Package::Package( Package *pi, QObject *parent, const char *name ) 79Package::Package( Package *pi, QObject *parent, const char *name )
71 : QObject(parent,name) 80 : QObject(parent,name)
72{ 81{
73 init(pi->settings); 82 init(pi->settings);
74 copyValues( pi ); 83 copyValues( pi );
75} 84}
76 85
77 86
78void Package::setValue( QString n, QString t ) 87void Package::setValue( QString n, QString t )
79{ 88{
80 if ( n == "Package" ) 89 if ( n == "Package" )
81 { 90 {
82 _name = QString( t ); 91 _name = QString( t );
83 }else if ( n == "Installed-Size" ) 92 }else if ( n == "Installed-Size" )
84 { 93 {
85 _size = t; 94 _size = t;
86// }else if ( n == "Priority") 95// }else if ( n == "Priority")
87// { 96// {
88 97
89 }else if ( n == "Section") 98 }else if ( n == "Section")
90 { 99 {
91 setSection( t ); 100 setSection( t );
92// }else if ( n == "Maintainer") 101// }else if ( n == "Maintainer")
93// { 102// {
94// 103//
95// }else if ( n == "Architecture") 104// }else if ( n == "Architecture")
96// { 105// {
97 106
98 }else if ( n == "Version") 107 }else if ( n == "Version")
99 { 108 {
100 _version = t; 109 _version = t;
101// }else if ( n == "Pre-Depends") 110// }else if ( n == "Pre-Depends")
102// { 111// {
103// 112//
104// }else if ( n == "Depends") 113// }else if ( n == "Depends")
105// { 114// {
106 115
107 }else if ( n == "Filename") 116 }else if ( n == "Filename")
108 { 117 {
109 _fileName = t; 118 _fileName = t;
110// }else if ( n == "Size") 119// }else if ( n == "Size")
111 // { 120 // {
112 // 121 //
113 //}else if ( n == "MD5Sum") 122 //}else if ( n == "MD5Sum")
114 //{ 123 //{
115 124
116 }else if ( n == "Description") 125 }else if ( n == "Description")
117 { 126 {
118 setDesc( t ); 127 setDesc( t );
119 }else if ( n == "Status") 128 }else if ( n == "Status")
120 { 129 {
121 if ( installed() ) return; 130 if ( installed() ) return;
122 _status = t; 131 _status = t;
123// }else if ( n == "Essential") 132// }else if ( n == "Essential")
124// { 133// {
125 134
126 }else{ 135 }else{
127 _values.insert(n,new QString(t)); 136 _values.insert(n,new QString(t));
128 } 137 }
129} 138}
130 139
131QString Package::name() 140QString Package::name()
132{ 141{
133 if (_displayName.isEmpty() ) return _name; 142 if (_displayName.isEmpty() ) return _name;
134 else return _displayName; 143 else return _displayName;
135} 144}
136 145
137 146
138QString Package::installName() 147QString Package::installName()
139{ 148{
140 if (_useFileName) return _fileName; 149 if (_useFileName) return _fileName;
141 else return _name; 150 else return _name;
142} 151}
143 152
144QString Package::packageName() 153QString Package::packageName()
145{ 154{
146 QString pn = installName(); 155 QString pn = installName();
147 pn = pn.right(pn.length()-pn.findRev("/")); 156 pn = pn.right(pn.length()-pn.findRev("/"));
148 pn = pn.left(pn.find("_")); 157 pn = pn.left(pn.find("_"));
149 return pn; 158 return pn;
150} 159}
151 160
152bool Package::installed() 161bool Package::installed()
153{ 162{
154 if (_status.contains("installed")) 163 if (_status.contains("installed"))
155 { 164 {
156 if (_status.contains("not-installed")) 165 if (_status.contains("not-installed"))
157 { 166 {
158 _toProcess = true; 167 _toProcess = true;
159 return false; 168 return false;
160 } 169 }
161 else return true; 170 else return true;
162 } 171 }
163 else 172 else
164 if (_versions) 173 if (_versions)
165 { 174 {
166 QDictIterator<Package> other( *_versions ); 175 QDictIterator<Package> other( *_versions );
167 while ( other.current() ) 176 while ( other.current() )
168 { 177 {
169 if (other.current()->status().contains("installed") 178 if (other.current()->status().contains("installed")
170 && other.current()->version() == version()) 179 && other.current()->version() == version())
171 return true; 180 return true;
172 ++other; 181 ++other;
173 } 182 }
174 } 183 }
175 return false; 184 return false;
176} 185}
177 186
178bool Package::otherInstalled() 187bool Package::otherInstalled()
179{ 188{
180 if (_versions) 189 if (_versions)
181 { 190 {
182 QDictIterator<Package> other( *_versions ); 191 QDictIterator<Package> other( *_versions );
183 while ( other.current() ) 192 while ( other.current() )
184 { 193 {
185 if (other.current()->installed()) return true; 194 if (other.current()->installed()) return true;
186 ++other; 195 ++other;
187 } 196 }
188 } 197 }
189 return false; 198 return false;
190} 199}
191 200
192void Package::setDesc( QString s ) 201void Package::setDesc( QString s )
193{ 202{
194 _desc = s; 203 _desc = s;
195 _shortDesc = s.left( s.find("\n") ); 204 _shortDesc = s.left( s.find("\n") );
196} 205}
197 206
198QString Package::desc() 207QString Package::desc()
199{ 208{
200 return _desc; 209 return _desc;
201} 210}
202 211
203QString Package::shortDesc() 212QString Package::shortDesc()
204{ 213{
205 return _shortDesc; 214 return _shortDesc;
206} 215}
207 216
208QString Package::size() 217QString Package::size()
209{ 218{
210 return _size; 219 return _size;
211} 220}
212 221
213 222
214QString Package::version() 223QString Package::version()
215{ 224{
216 return _version; 225 return _version;
217} 226}
218 227
219QString Package::sizeUnits() 228QString Package::sizeUnits()
220{ 229{
221 int i = _size.toInt(); 230 int i = _size.toInt();
222 int c = 0; 231 int c = 0;
223 QString ret; 232 QString ret;
224 QStringList unit; 233 QStringList unit;
225 unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;) 234 unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;)
226 while (i > 1) 235 while (i > 1)
227 { 236 {
228 ret=QString::number(i)+" "+unit[c]; 237 ret=QString::number(i)+" "+unit[c];
229 c++; 238 c++;
230 i /= 1024; 239 i /= 1024;
231 } 240 }
232 return ret; 241 return ret;
233} 242}
234 243
235bool Package::toProcess() 244bool Package::toProcess()
236{ 245{
237 return _toProcess; 246 return _toProcess;
238} 247}
239 248
240bool Package::toRemove() 249bool Package::toRemove()
241{ 250{
242 if ( _toProcess && installed() ) return true; 251 if ( _toProcess && installed() ) return true;
243 else return false; 252 else return false;
244} 253}
245 254
246bool Package::toInstall() 255bool Package::toInstall()
247{ 256{
248 if ( _toProcess && !installed() ) return true; 257 if ( _toProcess && !installed() ) return true;
249 else return false; 258 else return false;
250} 259}
251 260
252void Package::toggleProcess() 261void Package::toggleProcess()
253{ 262{
254 _toProcess = ! _toProcess; 263 _toProcess = ! _toProcess;
255} 264}
256 265
257 266
258 267
259void Package::copyValues( Package* pack ) 268void Package::copyValues( Package* pack )
260{ 269{
261 if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size ); 270 if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size );
262 if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section ); 271 if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section );
263 if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection ); 272 if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection );
264 if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc ); 273 if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc );
265 if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc ); 274 if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc );
266 if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name ); 275 if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name );
267 if (_dest.isEmpty() && !pack->_dest.isEmpty()) _dest= QString( pack->_dest ); 276 if (_dest.isEmpty() && !pack->_dest.isEmpty()) _dest= QString( pack->_dest );
268 if (_displayName.isEmpty()&& !pack->_displayName.isEmpty()) _displayName = QString( pack->_displayName ); 277 if (_displayName.isEmpty()&& !pack->_displayName.isEmpty()) _displayName = QString( pack->_displayName );
269 if (_fileName.isEmpty() && !pack->_fileName.isEmpty()) _fileName = QString( pack->_fileName ); 278 if (_fileName.isEmpty() && !pack->_fileName.isEmpty()) _fileName = QString( pack->_fileName );
270 if (_version.isEmpty() && !pack->_version.isEmpty()) _version = QString( pack->_version ); 279 if (_version.isEmpty() && !pack->_version.isEmpty()) _version = QString( pack->_version );
271 if (_values.isEmpty() && !pack->_values.isEmpty())_values = QDict<QString>( pack->_values ); 280 if (_values.isEmpty() && !pack->_values.isEmpty())_values = QDict<QString>( pack->_values );
272 if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); 281 if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status );
273} 282}
274 283
275QString Package::section() 284QString Package::section()
276{ 285{
277 return _section; 286 return _section;
278} 287}
279 288
280void Package::setSection( QString s) 289void Package::setSection( QString s)
281{ 290{
282 int i = s.find("/"); 291 int i = s.find("/");
283 if ( i > 0 ) 292 if ( i > 0 )
284 { 293 {
285 _section = s.left(i); 294 _section = s.left(i);
286 _subsection = s.mid(i+1); 295 _subsection = s.mid(i+1);
287 }else{ 296 }else{
288 _section = s; 297 _section = s;
289 _subsection = ""; 298 _subsection = "";
290 } 299 }
291} 300}
292 301
293QString Package::subSection() 302QString Package::subSection()
294{ 303{
295 return _subsection; 304 return _subsection;
296} 305}
297 306
298void Package::parsePackage( QStringList pack ) 307void Package::parsePackage( QStringList pack )
299{ 308{
300 if ( pack.isEmpty() ) return; 309 if ( pack.isEmpty() ) return;
301 int count = pack.count(); 310 int count = pack.count();
302 for( int i = 0; i < count; i++ ) 311 for( int i = 0; i < count; i++ )
303 { 312 {
304 QString line = pack[i]; 313 QString line = pack[i];
305 int sep = line.find( QRegExp(":[\t ]+") ); 314 int sep = line.find( QRegExp(":[\t ]+") );
306 if ( sep >= 0 ) 315 if ( sep >= 0 )
307 { 316 {
308 QString tag = line.left(sep); 317 QString tag = line.left(sep);
309 QString value = line.mid(sep+2).simplifyWhiteSpace(); 318 QString value = line.mid(sep+2).simplifyWhiteSpace();
310 setValue( tag, value ); 319 setValue( tag, value );
311 }else{ 320 }else{
312 } 321 }
313 } 322 }
314 return; 323 return;
315} 324}
316 325
317QString Package::details() 326QString Package::details()
318{ 327{
319 QString status; 328 QString status;
320 Process ipkg_status(QStringList() << "ipkg" << "info" << name() ); 329 Process ipkg_status(QStringList() << "ipkg" << "info" << name() );
321 QString description; 330 QString description;
322 if ( ipkg_status.exec("",status) ) 331 if ( ipkg_status.exec("",status) )
323 { 332 {
324 QStringList lines = QStringList::split('\n',status,TRUE); 333 QStringList lines = QStringList::split('\n',status,TRUE);
325 for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) { 334 for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) {
326 QString line = *it; 335 QString line = *it;
327 if ( line == " ." ) 336 if ( line == " ." )
328 { 337 {
329 description.append("<p>"); 338 description.append("<p>");
330 } else 339 } else
331 if ( line[0] == ' ' || line[0] == '\t' ) 340 if ( line[0] == ' ' || line[0] == '\t' )
332 { 341 {
333 // continuation 342 // continuation
334 description.append(" "); 343 description.append(" ");
335 description.append(Qtopia::escapeString(line)); 344 description.append(Qtopia::escapeString(line));
336 } else { 345 } else {
337 int sep = line.find(QRegExp(":[\t ]+")); 346 int sep = line.find(QRegExp(":[\t ]+"));
338 if ( sep >= 0 ) 347 if ( sep >= 0 )
339 { 348 {
340 QString tag = line.left(sep); 349 QString tag = line.left(sep);
341 description.append("<br>"); 350 description.append("<br>");
342 description.append("<b>"); 351 description.append("<b>");
343 description.append(Qtopia::escapeString(tag)); 352 description.append(Qtopia::escapeString(tag));
344 description.append(":</b> "); 353 description.append(":</b> ");
345 description.append(Qtopia::escapeString(line.mid(sep+2))); 354 description.append(Qtopia::escapeString(line.mid(sep+2)));
346 } else { 355 } else {
347 description.append(" "); 356 description.append(" ");
348 description.append(Qtopia::escapeString(line)); 357 description.append(Qtopia::escapeString(line));
349 } 358 }
350 } 359 }
351 } 360 }
352 } 361 }
353 return description; 362 return description;
354} 363}
355 364
356void Package::processed() 365void Package::processed()
357{ 366{
358 _toProcess = false; 367 _toProcess = false;
359 //hack, but we're not writing status anyway... 368 //hack, but we're not writing status anyway...
360 if ( installed() ) _status = "install"; 369 if ( installed() ) _status = "install";
361 else _status = "installed"; 370 else _status = "installed";
362} 371}
363 372
364QString Package::dest() 373QString Package::dest()
365{ 374{
366 if ( installed()||(!installed() && _toProcess) ) 375 if ( installed()||(!installed() && _toProcess) )
367 return _dest!=""?_dest:settings->getDestinationName(); 376 return _dest!=""?_dest:settings->getDestinationName();
368 else return ""; 377 else return "";
369} 378}
370 379
371void Package::setDest( QString d ) 380void Package::setDest( QString d )
372{ 381{
373 if ( d == "remote") _useFileName = true; 382 if ( d == "remote") _useFileName = true;
374 else _dest = d; 383 else _dest = d;
375} 384}
376 385
377void Package::setOn() 386void Package::setOn()
378{ 387{
379 _toProcess = true; 388 _toProcess = true;
380} 389}
381 390
382bool Package::link() 391bool Package::link()
383{ 392{
384 if ( _dest == "root" || (!installed() && !_toProcess) ) return false; 393 if ( _dest == "root" || (!installed() && !_toProcess) ) return false;
385 return _link; 394 return _link;
386} 395}
387 396
388void Package::setLink(bool b) 397void Package::setLink(bool b)
389{ 398{
390 _link = b; 399 _link = b;
391} 400}
392 401
393void Package::parseIpkgFile( QString file) 402void Package::parseIpkgFile( QString file)
394{ 403{
395 system("tar xzf "+file+" -C /tmp"); 404 system("tar xzf "+file+" -C /tmp");
396 system("tar xzf /tmp/control.tar.gz -C /tmp"); 405 system("tar xzf /tmp/control.tar.gz -C /tmp");
397 QFile f("/tmp/control"); 406 QFile f("/tmp/control");
398 if ( f.open(IO_ReadOnly) ) 407 if ( f.open(IO_ReadOnly) )
399 { 408 {
400 QTextStream t( &f ); 409 QTextStream t( &f );
401 QStringList pack; 410 QStringList pack;
402 while ( !t.eof() ) 411 while ( !t.eof() )
403 { 412 {
404 pack << t.readLine(); 413 pack << t.readLine();
405 } 414 }
406 f.close(); 415 f.close();
407 parsePackage( pack ); 416 parsePackage( pack );
408 } 417 }
409 418
410} 419}
411 420
412//QString Package::getPackageName() 421//QString Package::getPackageName()
413//{ 422//{
414 //if ( _packageName.isEmpty() ) return _name; 423 //if ( _packageName.isEmpty() ) return _name;
415 //else return _packageName; 424 //else return _packageName;
416//} 425//}
417 426
418void Package::instalFromFile(bool iff) 427void Package::instalFromFile(bool iff)
419{ 428{
420 _useFileName = iff; 429 _useFileName = iff;
421} 430}
422 431
423void Package::setName(QString n) 432void Package::setName(QString n)
424{ 433{
425 _displayName = n; 434 _displayName = n;
426} 435}
427 436
428QDict<QString>* Package::getFields() 437QDict<QString>* Package::getFields()
429{ 438{
430 return &_values; 439 return &_values;
431} 440}
432 441
433QString Package::status() 442QString Package::status()
434{ 443{
435 return _status; 444 return _status;
436} 445}
437 446
438bool Package::isOld() 447bool Package::isOld()
439{ 448{
440 if (!_versions) return false; 449 if (!_versions) return false;
441 QDictIterator<Package> other( *_versions ); 450 QDictIterator<Package> other( *_versions );
442 while ( other.current() ) { 451 while ( other.current() ) {
443 if (other.current()->version() > version() ) return true; 452 if (other.current()->version() > version() ) return true;
444 ++other; 453 ++other;
445 } 454 }
446 return false; 455 return false;
447} 456}
448 457
449bool Package::hasVersions() 458bool Package::hasVersions()
450{ 459{
451 if (!_versions) return false; 460 if (!_versions) return false;
452 else return true; 461 else return true;
453} 462}
454 463
455QDict<Package>* Package::getOtherVersions() 464QDict<Package>* Package::getOtherVersions()
456{ 465{
457 return _versions; 466 return _versions;
458} 467}
459 468
460void Package::setOtherVersions(QDict<Package> *v) 469void Package::setOtherVersions(QDict<Package> *v)
461{ 470{
462 _versions=v; 471 _versions=v;
463} 472}
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h
index 0f76ece..c147420 100644
--- a/noncore/unsupported/oipkg/package.h
+++ b/noncore/unsupported/oipkg/package.h
@@ -1,91 +1,100 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1#ifndef PK_ITEM_H 10#ifndef PK_ITEM_H
2#define PK_ITEM_H 11#define PK_ITEM_H
3 12
4#include <qstring.h> 13#include <qstring.h>
5#include <qlistview.h> 14#include <qlistview.h>
6#include <qpainter.h> 15#include <qpainter.h>
7#include <qpixmap.h> 16#include <qpixmap.h>
8#include <qdict.h> 17#include <qdict.h>
9#include <qobject.h> 18#include <qobject.h>
10 19
11#include "pksettings.h" 20#include "pksettings.h"
12 21
13class Package : public QObject 22class Package : public QObject
14{ 23{
15 Q_OBJECT 24 Q_OBJECT
16 public: 25 public:
17 Package(QObject *parent=0, const char *name=0); 26 Package(QObject *parent=0, const char *name=0);
18 Package(PackageManagerSettings *s, QObject *parent=0, const char *name=0); 27 Package(PackageManagerSettings *s, QObject *parent=0, const char *name=0);
19 ~Package(); 28 ~Package();
20 Package( QStringList, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); 29 Package( QStringList, PackageManagerSettings *s, QObject *parent=0, const char *name=0 );
21 Package( QString, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); 30 Package( QString, PackageManagerSettings *s, QObject *parent=0, const char *name=0 );
22 Package( Package*s, QObject *parent=0, const char *name=0 ); 31 Package( Package*s, QObject *parent=0, const char *name=0 );
23 32
24 void setValue( QString, QString ); 33 void setValue( QString, QString );
25 void copyValues( Package* ); 34 void copyValues( Package* );
26 35
27 QString name(); 36 QString name();
28 QString installName(); 37 QString installName();
29 QString packageName(); 38 QString packageName();
30 bool installed(); 39 bool installed();
31 bool otherInstalled(); 40 bool otherInstalled();
32 41
33 void setDesc( QString ); 42 void setDesc( QString );
34 QString shortDesc(); 43 QString shortDesc();
35 QString desc(); 44 QString desc();
36 QString size(); 45 QString size();
37 QString sizeUnits(); 46 QString sizeUnits();
38 QString version(); 47 QString version();
39 void setSection( QString ); 48 void setSection( QString );
40 QString section(); 49 QString section();
41 QString subSection(); 50 QString subSection();
42 QString details(); 51 QString details();
43 bool toProcess(); 52 bool toProcess();
44 bool toInstall(); 53 bool toInstall();
45 bool toRemove(); 54 bool toRemove();
46 void processed(); 55 void processed();
47 QString dest(); 56 QString dest();
48 void setDest( QString d ); 57 void setDest( QString d );
49 void setOn(); 58 void setOn();
50 bool link(); 59 bool link();
51 void setLink(bool); 60 void setLink(bool);
52 bool isOld(); 61 bool isOld();
53 bool hasVersions(); 62 bool hasVersions();
54 void parseIpkgFile( QString ); 63 void parseIpkgFile( QString );
55 void instalFromFile(bool iff=true); 64 void instalFromFile(bool iff=true);
56 void setName(QString); 65 void setName(QString);
57 QDict<QString>* getFields(); 66 QDict<QString>* getFields();
58 QString status(); 67 QString status();
59 68
60 QDict<Package>* getOtherVersions(); 69 QDict<Package>* getOtherVersions();
61 void setOtherVersions(QDict<Package>*); 70 void setOtherVersions(QDict<Package>*);
62 71
63public slots: 72public slots:
64 void toggleProcess(); 73 void toggleProcess();
65 74
66private: 75private:
67 PackageManagerSettings *settings; 76 PackageManagerSettings *settings;
68 QString _displayName; 77 QString _displayName;
69 QString _name; 78 QString _name;
70 QString _fileName; 79 QString _fileName;
71 bool _old; 80 bool _old;
72 bool _hasVersions; 81 bool _hasVersions;
73 bool _toProcess; 82 bool _toProcess;
74 bool _link; 83 bool _link;
75 QString _status; 84 QString _status;
76 QString _size; 85 QString _size;
77 QString _section; 86 QString _section;
78 QString _subsection; 87 QString _subsection;
79 QString _shortDesc; 88 QString _shortDesc;
80 QString _desc; 89 QString _desc;
81 QString _version; 90 QString _version;
82 QString _dest; 91 QString _dest;
83 QDict<QString> _values; 92 QDict<QString> _values;
84 QDict<Package> *_versions; 93 QDict<Package> *_versions;
85 bool _useFileName; 94 bool _useFileName;
86 void parsePackage( QStringList ); 95 void parsePackage( QStringList );
87 void init(PackageManagerSettings *); 96 void init(PackageManagerSettings *);
88}; 97};
89 98
90 99
91#endif 100#endif
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index e445570..f6c4c37 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -1,221 +1,230 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1#include "packagelist.h" 10#include "packagelist.h"
2 11
3#include <assert.h> 12#include <assert.h>
4#include <qfile.h> 13#include <qfile.h>
5#include <qfileinfo.h> 14#include <qfileinfo.h>
6#include <qtextstream.h> 15#include <qtextstream.h>
7 16
8#include "debug.h" 17#include "debug.h"
9 18
10static QDict<Package> *packageListAll; 19static QDict<Package> *packageListAll;
11static int packageListAllRefCount = 0; 20static int packageListAllRefCount = 0;
12 21
13PackageList::PackageList(QObject *parent, const char *name) 22PackageList::PackageList(QObject *parent, const char *name)
14 : QObject(parent,name), packageIter( packageList ) 23 : QObject(parent,name), packageIter( packageList )
15{ 24{
16 empty=true; 25 empty=true;
17 if (!packageListAll) packageListAll = new QDict<Package>(); 26 if (!packageListAll) packageListAll = new QDict<Package>();
18 packageListAllRefCount++; 27 packageListAllRefCount++;
19 sections << "All"; 28 sections << "All";
20 subSections.insert("All", new QStringList() ); 29 subSections.insert("All", new QStringList() );
21 QStringList *ss = subSections["All"]; 30 QStringList *ss = subSections["All"];
22 *ss << "All"; 31 *ss << "All";
23 aktSection = "All"; 32 aktSection = "All";
24 aktSubSection = "All"; 33 aktSubSection = "All";
25} 34}
26 35
27PackageList::PackageList( PackageManagerSettings* s, QObject *parent, const char *name) 36PackageList::PackageList( PackageManagerSettings* s, QObject *parent, const char *name)
28 : QObject(parent,name), packageIter( packageList ) 37 : QObject(parent,name), packageIter( packageList )
29{ 38{
30 settings = s; 39 settings = s;
31 PackageList(parent, name); 40 PackageList(parent, name);
32} 41}
33 42
34PackageList::~PackageList() 43PackageList::~PackageList()
35{ 44{
36 if (--packageListAllRefCount < 1 ) delete packageListAll; 45 if (--packageListAllRefCount < 1 ) delete packageListAll;
37} 46}
38 47
39/** Inserts a package into the list */ 48/** Inserts a package into the list */
40void PackageList::insertPackage( Package* pack ) 49void PackageList::insertPackage( Package* pack )
41{ 50{
42 if (!pack) return; 51 if (!pack) return;
43 Package* p = packageListAll->find( pack->name() ); 52 Package* p = packageListAll->find( pack->name() );
44 if ( p ) 53 if ( p )
45 { 54 {
46 if ( (p->version() == pack->version()) 55 if ( (p->version() == pack->version())
47 // && (p->dest() == pack->dest()) 56 // && (p->dest() == pack->dest())
48 ) 57 )
49 { 58 {
50 p->copyValues( pack ); 59 p->copyValues( pack );
51 delete pack; 60 delete pack;
52 pack = p; 61 pack = p;
53 } else { 62 } else {
54 QDict<Package> *packver = p->getOtherVersions(); 63 QDict<Package> *packver = p->getOtherVersions();
55 // p->setName( pack->name()+"["+p->version()+"]" ); 64 // p->setName( pack->name()+"["+p->version()+"]" );
56 if (!packver) 65 if (!packver)
57 { 66 {
58 packver = new QDict<Package>(); 67 packver = new QDict<Package>();
59 packver->insert( pack->name(), p ); 68 packver->insert( pack->name(), p );
60 p->setOtherVersions( packver ); 69 p->setOtherVersions( packver );
61 } 70 }
62 pack->setName( pack->name()+"["+pack->version()+"]" ); 71 pack->setName( pack->name()+"["+pack->version()+"]" );
63 pack->setOtherVersions( packver ); 72 pack->setOtherVersions( packver );
64 packver->insert( pack->name(), pack ); 73 packver->insert( pack->name(), pack );
65 packageListAll->insert( pack->name(), pack ); 74 packageListAll->insert( pack->name(), pack );
66 packageList.insert( pack->name(), pack ); 75 packageList.insert( pack->name(), pack );
67 origPackageList.insert( pack->name(), pack ); 76 origPackageList.insert( pack->name(), pack );
68 } 77 }
69 }else{ 78 }else{
70 packageListAll->insert( pack->name(), pack ); 79 packageListAll->insert( pack->name(), pack );
71 packageList.insert( pack->name(), pack ); 80 packageList.insert( pack->name(), pack );
72 origPackageList.insert( pack->name(), pack ); 81 origPackageList.insert( pack->name(), pack );
73 }; 82 };
74 empty=false; 83 empty=false;
75 updateSections( pack ); 84 updateSections( pack );
76} 85}
77 86
78void PackageList::filterPackages( QString f ) 87void PackageList::filterPackages( QString f )
79 { 88 {
80 packageList.clear(); 89 packageList.clear();
81 QDictIterator<Package> filterIter( origPackageList ); 90 QDictIterator<Package> filterIter( origPackageList );
82 filterIter.toFirst(); 91 filterIter.toFirst();
83 Package *pack= filterIter.current() ; 92 Package *pack= filterIter.current() ;
84 while ( pack ) 93 while ( pack )
85 { 94 {
86 if ( 95 if (
87 ((aktSection=="All")||(pack->section()==aktSection)) && 96 ((aktSection=="All")||(pack->section()==aktSection)) &&
88 ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) && 97 ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) &&
89 pack->name().contains( f ) 98 pack->name().contains( f )
90 ) 99 )
91 { 100 {
92 packageList.insert( pack->name(), pack ); 101 packageList.insert( pack->name(), pack );
93 } 102 }
94 ++filterIter; 103 ++filterIter;
95 pack = filterIter.current(); 104 pack = filterIter.current();
96 } 105 }
97} 106}
98 107
99Package* PackageList::find( QString n ) 108Package* PackageList::find( QString n )
100{ 109{
101 return packageList.find( n ); 110 return packageList.find( n );
102} 111}
103 112
104Package* PackageList::first() 113Package* PackageList::first()
105 { 114 {
106 packageIter.toFirst(); 115 packageIter.toFirst();
107 return packageIter.current(); 116 return packageIter.current();
108} 117}
109 118
110Package* PackageList::next() 119Package* PackageList::next()
111{ 120{
112 ++packageIter; 121 ++packageIter;
113 return packageIter.current(); 122 return packageIter.current();
114} 123}
115 124
116QStringList PackageList::getSections() 125QStringList PackageList::getSections()
117{ 126{
118 sections.sort(); 127 sections.sort();
119 return sections; 128 return sections;
120} 129}
121 130
122QStringList PackageList::getSubSections() 131QStringList PackageList::getSubSections()
123{ 132{
124 QStringList ss; 133 QStringList ss;
125 if ( !subSections[aktSection] ) return ss; 134 if ( !subSections[aktSection] ) return ss;
126 ss = *subSections[aktSection]; 135 ss = *subSections[aktSection];
127 ss.sort(); 136 ss.sort();
128 return ss; 137 return ss;
129} 138}
130 139
131void PackageList::setSection( QString sec ) 140void PackageList::setSection( QString sec )
132{ 141{
133 aktSection = sec; 142 aktSection = sec;
134} 143}
135 144
136void PackageList::setSubSection( QString ssec ) 145void PackageList::setSubSection( QString ssec )
137{ 146{
138 aktSubSection = ssec; 147 aktSubSection = ssec;
139} 148}
140 149
141void PackageList::updateSections( Package* pack ) 150void PackageList::updateSections( Package* pack )
142{ 151{
143 QString s = pack->section(); 152 QString s = pack->section();
144 if ( s.isEmpty() || s == "") return; 153 if ( s.isEmpty() || s == "") return;
145 if ( sections.contains(s) ) return; 154 if ( sections.contains(s) ) return;
146 sections += s; 155 sections += s;
147 QString ss = pack->subSection(); 156 QString ss = pack->subSection();
148 if ( ss.isEmpty() || ss == "" ) return; 157 if ( ss.isEmpty() || ss == "" ) return;
149 if ( !subSections[s] ) { 158 if ( !subSections[s] ) {
150 subSections.insert( s, new QStringList() ); 159 subSections.insert( s, new QStringList() );
151 QStringList *subsecs = subSections[s]; 160 QStringList *subsecs = subSections[s];
152 *subsecs += "All"; 161 *subsecs += "All";
153 } 162 }
154 QStringList *subsecs = subSections[s]; 163 QStringList *subsecs = subSections[s];
155 *subsecs += ss; 164 *subsecs += ss;
156 if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); 165 if ( !subSections["All"] ) subSections.insert( "All", new QStringList() );
157 subsecs = subSections["All"]; 166 subsecs = subSections["All"];
158 *subsecs += ss; 167 *subsecs += ss;
159} 168}
160 169
161 170
162void PackageList::readFileEntries( QString filename, QString dest ) 171void PackageList::readFileEntries( QString filename, QString dest )
163 { 172 {
164 pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); 173 pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest);
165 QStringList packEntry; 174 QStringList packEntry;
166 QFile f( filename ); 175 QFile f( filename );
167 if ( !f.open(IO_ReadOnly) ) return; 176 if ( !f.open(IO_ReadOnly) ) return;
168 QTextStream *statusStream = new QTextStream( &f ); 177 QTextStream *statusStream = new QTextStream( &f );
169 while ( !statusStream ->eof() ) 178 while ( !statusStream ->eof() )
170 { 179 {
171 QString line = statusStream->readLine(); 180 QString line = statusStream->readLine();
172 if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) 181 if ( line.find(QRegExp("[\n\t ]*")) || line == "" )
173 { 182 {
174 //end of package 183 //end of package
175 if ( ! packEntry.isEmpty() ) 184 if ( ! packEntry.isEmpty() )
176 { 185 {
177 Package *p = new Package( packEntry, settings ); 186 Package *p = new Package( packEntry, settings );
178 if ( p ) 187 if ( p )
179 { 188 {
180 p->setDest( dest ); 189 p->setDest( dest );
181 insertPackage( p ); 190 insertPackage( p );
182 packEntry.clear(); 191 packEntry.clear();
183 } 192 }
184 } 193 }
185 }else{ 194 }else{
186 packEntry << line; 195 packEntry << line;
187 }; 196 };
188 } 197 }
189 delete statusStream; 198 delete statusStream;
190 return; 199 return;
191} 200}
192 201
193void PackageList::setSettings( PackageManagerSettings *s ) 202void PackageList::setSettings( PackageManagerSettings *s )
194{ 203{
195 settings = s; 204 settings = s;
196} 205}
197 206
198Package* PackageList::getByName( QString n ) 207Package* PackageList::getByName( QString n )
199{ 208{
200 return origPackageList[n]; 209 return origPackageList[n];
201} 210}
202 211
203void PackageList::clear() 212void PackageList::clear()
204{ 213{
205 origPackageList.clear(); 214 origPackageList.clear();
206 packageList.clear(); 215 packageList.clear();
207} 216}
208 217
209void PackageList::allPackages() 218void PackageList::allPackages()
210{ 219{
211 packageList.clear(); 220 packageList.clear();
212 QDictIterator<Package> filterIter( origPackageList ); 221 QDictIterator<Package> filterIter( origPackageList );
213 filterIter.toFirst(); 222 filterIter.toFirst();
214 Package *pack= filterIter.current() ; 223 Package *pack= filterIter.current() ;
215 while ( pack ) 224 while ( pack )
216 { 225 {
217 packageList.insert( pack->name(), pack ); 226 packageList.insert( pack->name(), pack );
218 ++filterIter; 227 ++filterIter;
219 pack = filterIter.current(); 228 pack = filterIter.current();
220 } 229 }
221} 230}
diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h
index 46a00e9..0c13688 100644
--- a/noncore/unsupported/oipkg/packagelist.h
+++ b/noncore/unsupported/oipkg/packagelist.h
@@ -1,60 +1,69 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1#ifndef PACKAGELIST_H 10#ifndef PACKAGELIST_H
2#define PACKAGELIST_H 11#define PACKAGELIST_H
3 12
4#include <qdict.h> 13#include <qdict.h>
5#include "package.h" 14#include "package.h"
6#include "pksettings.h" 15#include "pksettings.h"
7#include "debug.h" 16#include "debug.h"
8 17
9class PackageList : public QObject 18class PackageList : public QObject
10{ 19{
11 Q_OBJECT 20 Q_OBJECT
12public: 21public:
13 //static QString all = QObject::tr("All"); 22 //static QString all = QObject::tr("All");
14 23
15 PackageList (QObject *parent=0, const char *name=0); 24 PackageList (QObject *parent=0, const char *name=0);
16 PackageList( PackageManagerSettings *s, QObject *parent=0, const char *name=0); 25 PackageList( PackageManagerSettings *s, QObject *parent=0, const char *name=0);
17 virtual ~PackageList(); 26 virtual ~PackageList();
18 void insertPackage( Package* ); 27 void insertPackage( Package* );
19 Package* find( QString ); 28 Package* find( QString );
20 Package* next(); 29 Package* next();
21 Package* first(); 30 Package* first();
22 31
23 QStringList getSections(); 32 QStringList getSections();
24 QStringList getSubSections(); 33 QStringList getSubSections();
25 void setSettings( PackageManagerSettings* ); 34 void setSettings( PackageManagerSettings* );
26 void filterPackages( QString ); 35 void filterPackages( QString );
27 Package* getByName( QString ); 36 Package* getByName( QString );
28 void clear(); 37 void clear();
29 void allPackages(); 38 void allPackages();
30 39
31 QDict<Package> *versions; 40 QDict<Package> *versions;
32 41
33public slots: 42public slots:
34 void setSection(QString); 43 void setSection(QString);
35 void setSubSection(QString); 44 void setSubSection(QString);
36 // virtual void update(); 45 // virtual void update();
37 46
38protected: 47protected:
39 int currentPackage; 48 int currentPackage;
40 int packageCount; 49 int packageCount;
41 50
42 PackageManagerSettings *settings; 51 PackageManagerSettings *settings;
43 QDict<Package> packageList; 52 QDict<Package> packageList;
44 QDict<Package> origPackageList; 53 QDict<Package> origPackageList;
45 QDictIterator<Package> packageIter; 54 QDictIterator<Package> packageIter;
46 55
47 bool empty; 56 bool empty;
48 QString aktSection; 57 QString aktSection;
49 QString aktSubSection; 58 QString aktSubSection;
50 QStringList sections; 59 QStringList sections;
51 QDict<QStringList> subSections; 60 QDict<QStringList> subSections;
52 QDict<bool> sectionsDict; 61 QDict<bool> sectionsDict;
53 62
54 63
55 void updateSections( Package* ); 64 void updateSections( Package* );
56 void readFileEntries( QString file, QString dest="" ); 65 void readFileEntries( QString file, QString dest="" );
57}; 66};
58 67
59 68
60#endif 69#endif
diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.cpp b/noncore/unsupported/oipkg/packagelistdoclnk.cpp
index deb8a6d..76e91ff 100644
--- a/noncore/unsupported/oipkg/packagelistdoclnk.cpp
+++ b/noncore/unsupported/oipkg/packagelistdoclnk.cpp
@@ -1,45 +1,53 @@
1 1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
2#include "packagelistdoclnk.h" 10#include "packagelistdoclnk.h"
3 11
4#include <qpe/applnk.h> 12#include <qpe/applnk.h>
5#include <qpe/config.h> 13#include <qpe/config.h>
6#include <qlist.h> 14#include <qlist.h>
7 15
8#include "package.h" 16#include "package.h"
9#include "pksettings.h" 17#include "pksettings.h"
10 18
11PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s, QObject *parent, const char *name) 19PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s, QObject *parent, const char *name)
12 : PackageList(s) 20 : PackageList(s)
13{ 21{
14 PackageListDocLnk(parent, name); 22 PackageListDocLnk(parent, name);
15} 23}
16 24
17PackageListDocLnk::PackageListDocLnk(QObject *parent, const char *name) 25PackageListDocLnk::PackageListDocLnk(QObject *parent, const char *name)
18 : PackageList(parent, name) 26 : PackageList(parent, name)
19{ 27{
20 Config cfg( "oipkg", Config::User ); 28 Config cfg( "oipkg", Config::User );
21 cfg.setGroup( "Common" ); 29 cfg.setGroup( "Common" );
22 docLnkDir = cfg.readEntry( "docLnkDir", "/root/" ); 30 docLnkDir = cfg.readEntry( "docLnkDir", "/root/" );
23 pvDebug(2,"opening DocLnkSet "+docLnkDir); 31 pvDebug(2,"opening DocLnkSet "+docLnkDir);
24 doclnkset = new DocLnkSet(docLnkDir,"application/ipkg"); 32 doclnkset = new DocLnkSet(docLnkDir,"application/ipkg");
25} 33}
26 34
27PackageListDocLnk::~PackageListDocLnk() 35PackageListDocLnk::~PackageListDocLnk()
28{ 36{
29 Config cfg( "oipkg", Config::User ); 37 Config cfg( "oipkg", Config::User );
30 cfg.setGroup( "Common" ); 38 cfg.setGroup( "Common" );
31 cfg.writeEntry( "docLnkDir", docLnkDir ); 39 cfg.writeEntry( "docLnkDir", docLnkDir );
32 delete doclnkset; 40 delete doclnkset;
33} 41}
34 42
35 43
36 44
37void PackageListDocLnk::update() 45void PackageListDocLnk::update()
38{ 46{
39 pvDebug(2,"PackageListDocLnk::update "); 47 pvDebug(2,"PackageListDocLnk::update ");
40 QList<DocLnk> packlist = doclnkset->children(); 48 QList<DocLnk> packlist = doclnkset->children();
41 for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() ) 49 for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() )
42 { 50 {
43 insertPackage( new Package(pack->file(), settings ) ); 51 insertPackage( new Package(pack->file(), settings ) );
44 } 52 }
45} 53}
diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.h b/noncore/unsupported/oipkg/packagelistdoclnk.h
index a63fb59..af06a45 100644
--- a/noncore/unsupported/oipkg/packagelistdoclnk.h
+++ b/noncore/unsupported/oipkg/packagelistdoclnk.h
@@ -1,23 +1,32 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1#ifndef PACKAGELISTDOCLNK_H 10#ifndef PACKAGELISTDOCLNK_H
2#define PACKAGELISTDOCLNK_H 11#define PACKAGELISTDOCLNK_H
3 12
4#include "packagelist.h" 13#include "packagelist.h"
5#include "debug.h" 14#include "debug.h"
6 15
7class DocLnkSet; 16class DocLnkSet;
8 17
9class PackageListDocLnk : public PackageList 18class PackageListDocLnk : public PackageList
10{ 19{
11public: 20public:
12 PackageListDocLnk(QObject *parent=0, const char *name=0); 21 PackageListDocLnk(QObject *parent=0, const char *name=0);
13 PackageListDocLnk( PackageManagerSettings *s, QObject *parent=0, const char *name=0); 22 PackageListDocLnk( PackageManagerSettings *s, QObject *parent=0, const char *name=0);
14 virtual ~PackageListDocLnk(); 23 virtual ~PackageListDocLnk();
15public slots: 24public slots:
16 void update(); 25 void update();
17private: 26private:
18 DocLnkSet *doclnkset; 27 DocLnkSet *doclnkset;
19 QString docLnkDir; 28 QString docLnkDir;
20}; 29};
21 30
22 31
23#endif 32#endif
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp
index 7c54441..b5e86f5 100644
--- a/noncore/unsupported/oipkg/packagelistitem.cpp
+++ b/noncore/unsupported/oipkg/packagelistitem.cpp
@@ -1,166 +1,175 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1#include "packagelistitem.h" 10#include "packagelistitem.h"
2 11
3#include <qpe/resource.h> 12#include <qpe/resource.h>
4#include <qobject.h> 13#include <qobject.h>
5 14
6#include "debug.h" 15#include "debug.h"
7 16
8static QPixmap *pm_uninstalled=0; 17static QPixmap *pm_uninstalled=0;
9static QPixmap *pm_uninstalled_old=0; 18static QPixmap *pm_uninstalled_old=0;
10static QPixmap *pm_installed=0; 19static QPixmap *pm_installed=0;
11static QPixmap *pm_installed_old=0; 20static QPixmap *pm_installed_old=0;
12static QPixmap *pm_uninstall=0; 21static QPixmap *pm_uninstall=0;
13static QPixmap *pm_install=0; 22static QPixmap *pm_install=0;
14static QPixmap *pm_uninstalled_old_installed_new=0; 23static QPixmap *pm_uninstalled_old_installed_new=0;
15static QPixmap *pm_uninstalled_installed_old=0; 24static QPixmap *pm_uninstalled_installed_old=0;
16 25
17PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) 26PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s)
18 :QCheckListItem(lv,pi->name(),CheckBox) 27 :QCheckListItem(lv,pi->name(),CheckBox)
19{ 28{
20 init(pi,s); 29 init(pi,s);
21} 30}
22 31
23PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) 32PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s)
24 :QCheckListItem(lvi,pi->name(),CheckBox) 33 :QCheckListItem(lvi,pi->name(),CheckBox)
25{ 34{
26 init(pi,s); 35 init(pi,s);
27} 36}
28 37
29void PackageListItem::init( Package *pi, PackageManagerSettings *s) 38void PackageListItem::init( Package *pi, PackageManagerSettings *s)
30{ 39{
31 package = pi; 40 package = pi;
32 settings = s; 41 settings = s;
33 setExpandable( true ); 42 setExpandable( true );
34 QCheckListItem *item; 43 QCheckListItem *item;
35 nameItem = new QCheckListItem( this, "" ); 44 nameItem = new QCheckListItem( this, "" );
36 item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); 45 item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() );
37 item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); 46 item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() );
38 destItem = new QCheckListItem( this, "" ); 47 destItem = new QCheckListItem( this, "" );
39 linkItem = new QCheckListItem( this, "" ); 48 linkItem = new QCheckListItem( this, "" );
40 statusItem = new QCheckListItem( this, "" ); 49 statusItem = new QCheckListItem( this, "" );
41 QCheckListItem *otherItem = new QCheckListItem( this, QObject::tr("other") ); 50 QCheckListItem *otherItem = new QCheckListItem( this, QObject::tr("other") );
42 item = new QCheckListItem( otherItem, QObject::tr("Install Name: ")+pi->installName() ); 51 item = new QCheckListItem( otherItem, QObject::tr("Install Name: ")+pi->installName() );
43 QDict<QString> *fields = pi->getFields(); 52 QDict<QString> *fields = pi->getFields();
44 QDictIterator<QString> it( *fields ); 53 QDictIterator<QString> it( *fields );
45 while ( it.current() ) { 54 while ( it.current() ) {
46 item = new QCheckListItem( otherItem, QString(it.currentKey()+": "+*it.current()) ); 55 item = new QCheckListItem( otherItem, QString(it.currentKey()+": "+*it.current()) );
47 ++it; 56 ++it;
48 } 57 }
49 displayDetails(); 58 displayDetails();
50 59
51 if (!pm_uninstalled) 60 if (!pm_uninstalled)
52 { 61 {
53 pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); 62 pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled"));
54 pm_uninstalled_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOld")); 63 pm_uninstalled_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOld"));
55 pm_uninstalled_old_installed_new = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOldinstalledNew")); 64 pm_uninstalled_old_installed_new = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOldinstalledNew"));
56 pm_uninstalled_installed_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledInstalledOld")); 65 pm_uninstalled_installed_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledInstalledOld"));
57 pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); 66 pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed"));
58 pm_installed_old = new QPixmap(Resource::loadPixmap("oipkg/installedOld")); 67 pm_installed_old = new QPixmap(Resource::loadPixmap("oipkg/installedOld"));
59 pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); 68 pm_install = new QPixmap(Resource::loadPixmap("oipkg/install"));
60 pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); 69 pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall"));
61 } 70 }
62} 71}
63 72
64void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, 73void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg,
65 int column, int width, int alignment ) 74 int column, int width, int alignment )
66{ 75{
67 if ( !p ) 76 if ( !p )
68 return; 77 return;
69 78
70 p->fillRect( 0, 0, width, height(), 79 p->fillRect( 0, 0, width, height(),
71 isSelected()? cg.highlight() : cg.base() ); 80 isSelected()? cg.highlight() : cg.base() );
72 81
73 if ( column != 0 ) { 82 if ( column != 0 ) {
74 // The rest is text 83 // The rest is text
75 QListViewItem::paintCell( p, cg, column, width, alignment ); 84 QListViewItem::paintCell( p, cg, column, width, alignment );
76 return; 85 return;
77 } 86 }
78 87
79 QListView *lv = listView(); 88 QListView *lv = listView();
80 if ( !lv ) 89 if ( !lv )
81 return; 90 return;
82 int marg = lv->itemMargin(); 91 int marg = lv->itemMargin();
83 int r = marg; 92 int r = marg;
84 93
85 QPixmap pm = statePixmap(); 94 QPixmap pm = statePixmap();
86 p->drawPixmap(marg,(height()-pm.height())/2,pm); 95 p->drawPixmap(marg,(height()-pm.height())/2,pm);
87 r += pm.width()+1; 96 r += pm.width()+1;
88 97
89 p->translate( r, 0 ); 98 p->translate( r, 0 );
90 QListViewItem::paintCell( p, cg, column, width - r, alignment ); 99 QListViewItem::paintCell( p, cg, column, width - r, alignment );
91} 100}
92 101
93 102
94void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, 103void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg,
95 const QRect & r ) 104 const QRect & r )
96{ 105{
97 // Skip QCheckListItem 106 // Skip QCheckListItem
98 // (makes you wonder what we're getting from QCheckListItem) 107 // (makes you wonder what we're getting from QCheckListItem)
99 QListViewItem::paintFocus(p,cg,r); 108 QListViewItem::paintFocus(p,cg,r);
100} 109}
101 110
102QPixmap PackageListItem::statePixmap() const 111QPixmap PackageListItem::statePixmap() const
103{ 112{
104 bool installed = package->installed(); 113 bool installed = package->installed();
105 bool old = package->isOld(); 114 bool old = package->isOld();
106 bool versions = package->hasVersions(); 115 bool versions = package->hasVersions();
107 bool verinstalled = package->otherInstalled(); 116 bool verinstalled = package->otherInstalled();
108 if ( !package->toProcess() ) { 117 if ( !package->toProcess() ) {
109 if ( !installed ) 118 if ( !installed )
110 if (old) 119 if (old)
111 { 120 {
112 if (verinstalled) return *pm_uninstalled_old_installed_new; 121 if (verinstalled) return *pm_uninstalled_old_installed_new;
113 else return *pm_uninstalled_old; 122 else return *pm_uninstalled_old;
114 } 123 }
115 else 124 else
116 { 125 {
117 if (verinstalled) return *pm_uninstalled_installed_old; 126 if (verinstalled) return *pm_uninstalled_installed_old;
118 else return *pm_uninstalled; 127 else return *pm_uninstalled;
119 } 128 }
120 else 129 else
121 if (old) return *pm_installed_old; 130 if (old) return *pm_installed_old;
122 else return *pm_installed; 131 else return *pm_installed;
123 } else { //toProcess() == true 132 } else { //toProcess() == true
124 if ( !installed ) 133 if ( !installed )
125 return *pm_install; 134 return *pm_install;
126 else 135 else
127 return *pm_uninstall; 136 return *pm_uninstall;
128 } 137 }
129} 138}
130 139
131QString PackageListItem::key( int column, bool ascending ) const 140QString PackageListItem::key( int column, bool ascending ) const
132{ 141{
133 if ( column == 2 ) { 142 if ( column == 2 ) {
134 QString t = text(2); 143 QString t = text(2);
135 double bytes=t.toDouble(); 144 double bytes=t.toDouble();
136 if ( t.contains('M') ) bytes*=1024*1024; 145 if ( t.contains('M') ) bytes*=1024*1024;
137 else if ( t.contains('K') || t.contains('k') ) bytes*=1024; 146 else if ( t.contains('K') || t.contains('k') ) bytes*=1024;
138 if ( !ascending ) bytes=999999999-bytes; 147 if ( !ascending ) bytes=999999999-bytes;
139 return QString().sprintf("%09d",(int)bytes); 148 return QString().sprintf("%09d",(int)bytes);
140 } else { 149 } else {
141 return QListViewItem::key(column,ascending); 150 return QListViewItem::key(column,ascending);
142 } 151 }
143} 152}
144 153
145void PackageListItem::setOn( bool b ) 154void PackageListItem::setOn( bool b )
146{ 155{
147 QCheckListItem::setOn( b ); 156 QCheckListItem::setOn( b );
148 package->toggleProcess(); 157 package->toggleProcess();
149 package->setLink( settings->createLinks() ); 158 package->setLink( settings->createLinks() );
150 displayDetails(); 159 displayDetails();
151} 160}
152 161
153void PackageListItem::displayDetails() 162void PackageListItem::displayDetails()
154{ 163{
155 QString sod; 164 QString sod;
156 sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); 165 sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits());
157 //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); 166 //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest());
158 sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); 167 sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest());
159 sod = sod.isEmpty()?QString(""):QString(" ("+sod+")"); 168 sod = sod.isEmpty()?QString(""):QString(" ("+sod+")");
160 setText(0, package->name()+sod ); 169 setText(0, package->name()+sod );
161 nameItem->setText( 0, QObject::tr("Name: ")+package->name()); 170 nameItem->setText( 0, QObject::tr("Name: ")+package->name());
162 linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No"))); 171 linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No")));
163 destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); 172 destItem->setText( 0, QObject::tr("Destination: ")+package->dest() );
164 statusItem->setText( 0, QObject::tr("Status: ")+package->status() ); 173 statusItem->setText( 0, QObject::tr("Status: ")+package->status() );
165 repaint(); 174 repaint();
166} 175}
diff --git a/noncore/unsupported/oipkg/packagelistitem.h b/noncore/unsupported/oipkg/packagelistitem.h
index 65e9711..dba44f7 100644
--- a/noncore/unsupported/oipkg/packagelistitem.h
+++ b/noncore/unsupported/oipkg/packagelistitem.h
@@ -1,41 +1,50 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1#ifndef PK_LISTITEM_H 10#ifndef PK_LISTITEM_H
2#define PK_LISTITEM_H 11#define PK_LISTITEM_H
3 12
4#include "package.h" 13#include "package.h"
5 14
6#include <qstring.h> 15#include <qstring.h>
7#include <qlistview.h> 16#include <qlistview.h>
8#include <qpainter.h> 17#include <qpainter.h>
9#include <qpixmap.h> 18#include <qpixmap.h>
10#include <qdict.h> 19#include <qdict.h>
11 20
12#include "pksettings.h" 21#include "pksettings.h"
13 22
14class PackageListItem 23class PackageListItem
15: public QCheckListItem 24: public QCheckListItem
16{ 25{
17public: 26public:
18 PackageListItem(QListViewItem*, Package*, PackageManagerSettings*); 27 PackageListItem(QListViewItem*, Package*, PackageManagerSettings*);
19 PackageListItem(QListView*, Package*, PackageManagerSettings*); 28 PackageListItem(QListView*, Package*, PackageManagerSettings*);
20 void paintCell( QPainter*, const QColorGroup&, int, int, int ); 29 void paintCell( QPainter*, const QColorGroup&, int, int, int );
21 void paintFocus( QPainter*, const QColorGroup&, const QRect& ); 30 void paintFocus( QPainter*, const QColorGroup&, const QRect& );
22 QPixmap statePixmap() const; 31 QPixmap statePixmap() const;
23 QString key( int, bool ) const; 32 QString key( int, bool ) const;
24 Package* getPackage() { return package; } ; 33 Package* getPackage() { return package; } ;
25 QString getName() { return package->name(); } ; 34 QString getName() { return package->name(); } ;
26 bool isInstalled(){ return package->installed(); }; 35 bool isInstalled(){ return package->installed(); };
27 virtual void setOn ( bool ); 36 virtual void setOn ( bool );
28 void displayDetails(); 37 void displayDetails();
29 38
30private: 39private:
31 void init(Package*, PackageManagerSettings*); 40 void init(Package*, PackageManagerSettings*);
32 QCheckListItem *nameItem; 41 QCheckListItem *nameItem;
33 QCheckListItem *destItem; 42 QCheckListItem *destItem;
34 QCheckListItem *linkItem; 43 QCheckListItem *linkItem;
35 QCheckListItem *statusItem; 44 QCheckListItem *statusItem;
36 PackageManagerSettings *settings; 45 PackageManagerSettings *settings;
37 Package *package; 46 Package *package;
38}; 47};
39 48
40 49
41#endif 50#endif
diff --git a/noncore/unsupported/oipkg/packagelistlocal.cpp b/noncore/unsupported/oipkg/packagelistlocal.cpp
index 6d931c8..b8a19253 100644
--- a/noncore/unsupported/oipkg/packagelistlocal.cpp
+++ b/noncore/unsupported/oipkg/packagelistlocal.cpp
@@ -1,66 +1,75 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1#include <qpe/config.h> 10#include <qpe/config.h>
2#include <qfile.h> 11#include <qfile.h>
3#include <qfileinfo.h> 12#include <qfileinfo.h>
4#include <qtextstream.h> 13#include <qtextstream.h>
5#include <qstringlist.h> 14#include <qstringlist.h>
6#include "packagelistlocal.h" 15#include "packagelistlocal.h"
7 16
8PackageListLocal::PackageListLocal() 17PackageListLocal::PackageListLocal()
9 : PackageList() 18 : PackageList()
10{ 19{
11 Config cfg( "oipkg", Config::User ); 20 Config cfg( "oipkg", Config::User );
12 cfg.setGroup( "Common" ); 21 cfg.setGroup( "Common" );
13 statusDir = cfg.readEntry( "statusDir", "" ); 22 statusDir = cfg.readEntry( "statusDir", "" );
14 listsDir = cfg.readEntry( "listsDir", "" ); 23 listsDir = cfg.readEntry( "listsDir", "" );
15 if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() ) 24 if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() )
16 { 25 {
17 statusDir="/usr/lib/ipkg/"; 26 statusDir="/usr/lib/ipkg/";
18 listsDir="/usr/lib/ipkg/lists/"; 27 listsDir="/usr/lib/ipkg/lists/";
19 cfg.writeEntry( "statusDir", statusDir ); 28 cfg.writeEntry( "statusDir", statusDir );
20 cfg.writeEntry( "listsDir", listsDir ); 29 cfg.writeEntry( "listsDir", listsDir );
21 } 30 }
22} 31}
23 32
24PackageListLocal::PackageListLocal(PackageManagerSettings* s) 33PackageListLocal::PackageListLocal(PackageManagerSettings* s)
25 : PackageList(s) 34 : PackageList(s)
26{ 35{
27 PackageListLocal(); 36 PackageListLocal();
28} 37}
29 38
30PackageListLocal::~PackageListLocal() 39PackageListLocal::~PackageListLocal()
31{ 40{
32} 41}
33 42
34void PackageListLocal::parseStatus() 43void PackageListLocal::parseStatus()
35{ 44{
36 QStringList dests = settings->getDestinationUrls(); 45 QStringList dests = settings->getDestinationUrls();
37 QStringList destnames = settings->getDestinationNames(); 46 QStringList destnames = settings->getDestinationNames();
38 QStringList::Iterator name = destnames.begin(); 47 QStringList::Iterator name = destnames.begin();
39 for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir ) 48 for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir )
40 { 49 {
41 pvDebug( 2,"Status: "+*dir+statusDir+"/status"); 50 pvDebug( 2,"Status: "+*dir+statusDir+"/status");
42 readFileEntries( *dir+statusDir+"/status", *name ); 51 readFileEntries( *dir+statusDir+"/status", *name );
43 ++name; 52 ++name;
44 }; 53 };
45} 54}
46 55
47void PackageListLocal::parseList() 56void PackageListLocal::parseList()
48{ 57{
49 QStringList srvs = settings->getActiveServers(); 58 QStringList srvs = settings->getActiveServers();
50 59
51 for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it ) 60 for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it )
52 { 61 {
53 pvDebug( 2, "List: "+listsDir+"/"+*it); 62 pvDebug( 2, "List: "+listsDir+"/"+*it);
54 readFileEntries( listsDir+"/"+*it ); 63 readFileEntries( listsDir+"/"+*it );
55 } 64 }
56} 65}
57 66
58 67
59void PackageListLocal::update() 68void PackageListLocal::update()
60{ 69{
61 pvDebug( 2, "parseStatus"); 70 pvDebug( 2, "parseStatus");
62 parseStatus(); 71 parseStatus();
63 pvDebug( 2, "parseList"); 72 pvDebug( 2, "parseList");
64 parseList(); 73 parseList();
65 pvDebug( 2, "finished parsing"); 74 pvDebug( 2, "finished parsing");
66} 75}
diff --git a/noncore/unsupported/oipkg/packagelistlocal.h b/noncore/unsupported/oipkg/packagelistlocal.h
index 887126b..69f871c 100644
--- a/noncore/unsupported/oipkg/packagelistlocal.h
+++ b/noncore/unsupported/oipkg/packagelistlocal.h
@@ -1,30 +1,39 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1#ifndef PACKAGELISTLOCAL_H 10#ifndef PACKAGELISTLOCAL_H
2#define PACKAGELISTLOCAL_H 11#define PACKAGELISTLOCAL_H
3 12
4#include "packagelist.h" 13#include "packagelist.h"
5 14
6 15
7#define HACK 16#define HACK
8#ifdef HACK 17#ifdef HACK
9 static QString listsDir="/usr/lib/ipkg/"; 18 static QString listsDir="/usr/lib/ipkg/";
10 static QString statusDir="/usr/lib/ipkg/"; 19 static QString statusDir="/usr/lib/ipkg/";
11#endif 20#endif
12 21
13class PackageListLocal : public PackageList { 22class PackageListLocal : public PackageList {
14public: 23public:
15 PackageListLocal(); 24 PackageListLocal();
16 PackageListLocal( PackageManagerSettings* ); 25 PackageListLocal( PackageManagerSettings* );
17 virtual ~PackageListLocal(); 26 virtual ~PackageListLocal();
18 27
19public slots: 28public slots:
20 void update(); 29 void update();
21private: 30private:
22#ifndef HACK 31#ifndef HACK
23 QString listsDir; 32 QString listsDir;
24 QString statusDir; 33 QString statusDir;
25#endif 34#endif
26 void parseStatus(); 35 void parseStatus();
27 void parseList(); 36 void parseList();
28}; 37};
29 38
30#endif 39#endif
diff --git a/noncore/unsupported/oipkg/packagelistremote.cpp b/noncore/unsupported/oipkg/packagelistremote.cpp
index bb29e80..b4b6979 100644
--- a/noncore/unsupported/oipkg/packagelistremote.cpp
+++ b/noncore/unsupported/oipkg/packagelistremote.cpp
@@ -1,49 +1,58 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1 10
2#include "packagelistremote.h" 11#include "packagelistremote.h"
3 12
4#include <qstring.h> 13#include <qstring.h>
5#include <stdlib.h> 14#include <stdlib.h>
6#include <unistd.h> 15#include <unistd.h>
7 16
8PackageListRemote::PackageListRemote(PackageManagerSettings* s) 17PackageListRemote::PackageListRemote(PackageManagerSettings* s)
9 : PackageList(s) 18 : PackageList(s)
10{ 19{
11 PackageListRemote(); 20 PackageListRemote();
12} 21}
13 22
14PackageListRemote::PackageListRemote() 23PackageListRemote::PackageListRemote()
15 : PackageList() 24 : PackageList()
16{ 25{
17} 26}
18 27
19PackageListRemote::~PackageListRemote() 28PackageListRemote::~PackageListRemote()
20{ 29{
21} 30}
22 31
23void PackageListRemote::query(QString s) 32void PackageListRemote::query(QString s)
24{ 33{
25 pvDebug(4,"set query "+s); 34 pvDebug(4,"set query "+s);
26 searchString = s; 35 searchString = s;
27} 36}
28 37
29void PackageListRemote::update() 38void PackageListRemote::update()
30{ 39{
31 pvDebug(2,"PackageListRemote::update"); 40 pvDebug(2,"PackageListRemote::update");
32 if (searchString.isEmpty()) return; 41 if (searchString.isEmpty()) return;
33 int r=0; 42 int r=0;
34 QString cmd = "wget"; 43 QString cmd = "wget";
35 QString redirect = "/tmp/oipkg.query"; 44 QString redirect = "/tmp/oipkg.query";
36 45
37 // use file for output 46 // use file for output
38 cmd += " --output-document="+redirect; 47 cmd += " --output-document="+redirect;
39//http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package&section= 48//http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package&section=
40 QString server="http://ipkgfind.handhelds.org/"; 49 QString server="http://ipkgfind.handhelds.org/";
41 cmd += " \""+server+"/packages.phtml"; 50 cmd += " \""+server+"/packages.phtml";
42 cmd += "?format=pda&searchtype=package&section="; 51 cmd += "?format=pda&searchtype=package&section=";
43 cmd += "&query="+searchString; 52 cmd += "&query="+searchString;
44 cmd += "\""; 53 cmd += "\"";
45 54
46 pvDebug(4,"search :"+cmd); 55 pvDebug(4,"search :"+cmd);
47 r = system(cmd.latin1()); 56 r = system(cmd.latin1());
48 readFileEntries( redirect, "remote" ); 57 readFileEntries( redirect, "remote" );
49} 58}
diff --git a/noncore/unsupported/oipkg/packagelistremote.h b/noncore/unsupported/oipkg/packagelistremote.h
index 87bf10d..98632ca 100644
--- a/noncore/unsupported/oipkg/packagelistremote.h
+++ b/noncore/unsupported/oipkg/packagelistremote.h
@@ -1,21 +1,30 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1#ifndef PACKAGELISTREMOTE_H 10#ifndef PACKAGELISTREMOTE_H
2#define PACKAGELISTREMOTE_H 11#define PACKAGELISTREMOTE_H
3 12
4#include "packagelist.h" 13#include "packagelist.h"
5#include "package.h" 14#include "package.h"
6#include "pksettings.h" 15#include "pksettings.h"
7#include "debug.h" 16#include "debug.h"
8 17
9class PackageListRemote : public PackageList { 18class PackageListRemote : public PackageList {
10public: 19public:
11 PackageListRemote(); 20 PackageListRemote();
12 PackageListRemote( PackageManagerSettings* s); 21 PackageListRemote( PackageManagerSettings* s);
13 virtual ~PackageListRemote(); 22 virtual ~PackageListRemote();
14 void query(QString); 23 void query(QString);
15public slots: 24public slots:
16 void update(); 25 void update();
17private: 26private:
18 QString searchString; 27 QString searchString;
19}; 28};
20 29
21#endif 30#endif
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp
index 2bb74e9..0d6fa80 100644
--- a/noncore/unsupported/oipkg/packagelistview.cpp
+++ b/noncore/unsupported/oipkg/packagelistview.cpp
@@ -1,144 +1,153 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1#include "packagelistview.h" 10#include "packagelistview.h"
2 11
3#include <qpopupmenu.h> 12#include <qpopupmenu.h>
4#include <qaction.h> 13#include <qaction.h>
5 14
6#include "packagelistitem.h" 15#include "packagelistitem.h"
7#include "pksettings.h" 16#include "pksettings.h"
8 17
9PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) 18PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s)
10 : QListView(p,n) 19 : QListView(p,n)
11{ 20{
12 settings = s; 21 settings = s;
13 popupMenu = new QPopupMenu( this ); 22 popupMenu = new QPopupMenu( this );
14 destsMenu = new QPopupMenu( popupMenu ); 23 destsMenu = new QPopupMenu( popupMenu );
15 popupTimer = new QTimer( this ); 24 popupTimer = new QTimer( this );
16 setSelectionMode(QListView::NoSelection); 25 setSelectionMode(QListView::NoSelection);
17 addColumn( tr("Package") ); 26 addColumn( tr("Package") );
18 setRootIsDecorated( true ); 27 setRootIsDecorated( true );
19 28
20 connect( popupTimer, SIGNAL(timeout()), 29 connect( popupTimer, SIGNAL(timeout()),
21 this, SLOT(showPopup()) ); 30 this, SLOT(showPopup()) );
22 connect( this, SIGNAL( pressed( QListViewItem* ) ), 31 connect( this, SIGNAL( pressed( QListViewItem* ) ),
23 this, SLOT( setCurrent( QListViewItem* ) ) ); 32 this, SLOT( setCurrent( QListViewItem* ) ) );
24 connect( this, SIGNAL( clicked( QListViewItem* ) ), 33 connect( this, SIGNAL( clicked( QListViewItem* ) ),
25 this, SLOT( stopTimer( QListViewItem* ) ) ); 34 this, SLOT( stopTimer( QListViewItem* ) ) );
26 35
27} 36}
28 37
29//PackageListView::~PackageListView() 38//PackageListView::~PackageListView()
30//{ 39//{
31//} 40//}
32 41
33void PackageListView::setCurrent( QListViewItem* p ) 42void PackageListView::setCurrent( QListViewItem* p )
34{ 43{
35 if ( !p ) return; 44 if ( !p ) return;
36 activePackageListItem = (PackageListItem*)p; 45 activePackageListItem = (PackageListItem*)p;
37 activePackage = activePackageListItem->getPackage(); 46 activePackage = activePackageListItem->getPackage();
38 if (!activePackage) 47 if (!activePackage)
39 { 48 {
40 // QDictIterator<QCheckListItem> it( rootItems ); 49 // QDictIterator<QCheckListItem> it( rootItems );
41 // while ( it.current() ) 50 // while ( it.current() )
42// { 51// {
43 // if ( it.current()==p ) 52 // if ( it.current()==p )
44 // pvDebug(2,"current item"); 53 // pvDebug(2,"current item");
45 // ++it; 54 // ++it;
46 // } 55 // }
47 56
48 return; 57 return;
49 } 58 }
50 popupTimer->start( 750, true ); 59 popupTimer->start( 750, true );
51} 60}
52 61
53 62
54void PackageListView::showPopup() 63void PackageListView::showPopup()
55{ 64{
56 popupMenu->clear(); 65 popupMenu->clear();
57 destsMenu->clear(); 66 destsMenu->clear();
58 67
59 QAction *popupAction; 68 QAction *popupAction;
60 if ( !activePackage->installed() ) 69 if ( !activePackage->installed() )
61 { 70 {
62 popupMenu->insertItem( tr("Install to"), destsMenu ); 71 popupMenu->insertItem( tr("Install to"), destsMenu );
63 QStringList dests = settings->getDestinationNames(); 72 QStringList dests = settings->getDestinationNames();
64 QString ad = settings->getDestinationName(); 73 QString ad = settings->getDestinationName();
65 for (uint i = 0; i < dests.count(); i++ ) 74 for (uint i = 0; i < dests.count(); i++ )
66 { 75 {
67 popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); 76 popupAction = new QAction( dests[i], QString::null, 0, this, 0 );
68 popupAction->addTo( destsMenu ); 77 popupAction->addTo( destsMenu );
69 if ( dests[i] == ad && activePackage->toInstall() ) 78 if ( dests[i] == ad && activePackage->toInstall() )
70 { 79 {
71 popupAction->setToggleAction( true ); 80 popupAction->setToggleAction( true );
72 popupAction->setOn(true); 81 popupAction->setOn(true);
73 }; 82 };
74 } 83 }
75 connect( destsMenu, SIGNAL( activated( int ) ), 84 connect( destsMenu, SIGNAL( activated( int ) ),
76 this, SLOT( changePackageDest( int ) ) ); 85 this, SLOT( changePackageDest( int ) ) );
77 }else{ 86 }else{
78 popupAction = new QAction( tr("Remove"),QString::null, 0, this, 0 ); 87 popupAction = new QAction( tr("Remove"),QString::null, 0, this, 0 );
79 popupAction->addTo( popupMenu ); 88 popupAction->addTo( popupMenu );
80 connect( popupAction, SIGNAL( activated() ), 89 connect( popupAction, SIGNAL( activated() ),
81 this , SLOT( toggleProcess() ) ); 90 this , SLOT( toggleProcess() ) );
82 popupAction = new QAction( tr("Reinstall"),QString::null, 0, this, 0 ); 91 popupAction = new QAction( tr("Reinstall"),QString::null, 0, this, 0 );
83 popupAction->addTo( popupMenu ); 92 popupAction->addTo( popupMenu );
84 popupAction->setEnabled( false ); 93 popupAction->setEnabled( false );
85 } 94 }
86 popupMenu->popup( QCursor::pos() ); 95 popupMenu->popup( QCursor::pos() );
87} 96}
88 97
89void PackageListView::stopTimer( QListViewItem* ) 98void PackageListView::stopTimer( QListViewItem* )
90{ 99{
91 popupTimer->stop(); 100 popupTimer->stop();
92} 101}
93 102
94 103
95void PackageListView::changePackageDest( int i ) 104void PackageListView::changePackageDest( int i )
96{ 105{
97 activePackage->setDest( destsMenu->text(i) ); 106 activePackage->setDest( destsMenu->text(i) );
98 activePackage->setOn(); 107 activePackage->setOn();
99 activePackage->setLink( settings->createLinks() ); 108 activePackage->setLink( settings->createLinks() );
100 activePackageListItem->displayDetails(); 109 activePackageListItem->displayDetails();
101} 110}
102 111
103void PackageListView::toggleProcess() 112void PackageListView::toggleProcess()
104{ 113{
105 activePackage->toggleProcess() ; 114 activePackage->toggleProcess() ;
106 activePackageListItem->displayDetails(); 115 activePackageListItem->displayDetails();
107} 116}
108 117
109void PackageListView::display() 118void PackageListView::display()
110{ 119{
111 QDictIterator<PackageList> list( PackageLists ); 120 QDictIterator<PackageList> list( PackageLists );
112 PackageList *packlist; 121 PackageList *packlist;
113 Package *pack; 122 Package *pack;
114 PackageListItem *item; 123 PackageListItem *item;
115 QCheckListItem *rootItem; 124 QCheckListItem *rootItem;
116 QListViewItem* it; 125 QListViewItem* it;
117 QListViewItem* itdel; 126 QListViewItem* itdel;
118 while ( list.current() ) { 127 while ( list.current() ) {
119 packlist = list.current(); 128 packlist = list.current();
120 rootItem = rootItems.find( list.currentKey() ); 129 rootItem = rootItems.find( list.currentKey() );
121 //rootItem->clear(); 130 //rootItem->clear();
122 it=rootItem->firstChild(); 131 it=rootItem->firstChild();
123 while ( it ) 132 while ( it )
124 { 133 {
125 itdel = it; 134 itdel = it;
126 it = it->nextSibling(); 135 it = it->nextSibling();
127 delete itdel; 136 delete itdel;
128 } 137 }
129 pack = packlist->first(); 138 pack = packlist->first();
130 while( pack ) 139 while( pack )
131 { 140 {
132 item = new PackageListItem( rootItem, pack, settings ); 141 item = new PackageListItem( rootItem, pack, settings );
133 pack = packlist->next(); 142 pack = packlist->next();
134 } 143 }
135 ++list; 144 ++list;
136 } 145 }
137} 146}
138 147
139void PackageListView::addList( QString n, PackageList* pl) 148void PackageListView::addList( QString n, PackageList* pl)
140{ 149{
141 PackageLists.insert(n, pl); 150 PackageLists.insert(n, pl);
142 QCheckListItem *item = new QCheckListItem(this,n); 151 QCheckListItem *item = new QCheckListItem(this,n);
143 rootItems.insert(n, item); 152 rootItems.insert(n, item);
144} 153}
diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h
index 00c0320..3c09ba8 100644
--- a/noncore/unsupported/oipkg/packagelistview.h
+++ b/noncore/unsupported/oipkg/packagelistview.h
@@ -1,61 +1,54 @@
1/*************************************************************************** 1/***************************************************************************
2 packagelistview.h - description
3 -------------------
4 begin : Sat Apr 27 2002
5 copyright : (C) 2002 by tille
6 email : tille@handhelds.org
7 ***************************************************************************/
8
9/***************************************************************************
10 * * 2 * *
11 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 6 * (at your option) any later version. *
15 * * 7 * *
16 ***************************************************************************/ 8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
17 10
18#ifndef PACKAGELISTVIEW_H 11#ifndef PACKAGELISTVIEW_H
19#define PACKAGELISTVIEW_H 12#define PACKAGELISTVIEW_H
20 13
21#include <qlistview.h> 14#include <qlistview.h>
22#include <qaction.h> 15#include <qaction.h>
23#include <qdict.h> 16#include <qdict.h>
24#include <qstring.h> 17#include <qstring.h>
25#include <qtimer.h> 18#include <qtimer.h>
26#include <qwidget.h> 19#include <qwidget.h>
27#include <qpopupmenu.h> 20#include <qpopupmenu.h>
28#include "packagelist.h" 21#include "packagelist.h"
29#include "debug.h" 22#include "debug.h"
30 23
31class PackageListItem; 24class PackageListItem;
32class Package; 25class Package;
33class PackageManagerSettings; 26class PackageManagerSettings;
34 27
35class PackageListView : public QListView 28class PackageListView : public QListView
36{ 29{
37 Q_OBJECT 30 Q_OBJECT
38 31
39public: 32public:
40 PackageListView(QWidget*, const char*, PackageManagerSettings*); 33 PackageListView(QWidget*, const char*, PackageManagerSettings*);
41 void addList( QString, PackageList* ); 34 void addList( QString, PackageList* );
42 //~PackageListView(); 35 //~PackageListView();
43 QTimer *popupTimer; 36 QTimer *popupTimer;
44private: 37private:
45 QDict<PackageList> PackageLists; 38 QDict<PackageList> PackageLists;
46 QDict<QCheckListItem> rootItems; 39 QDict<QCheckListItem> rootItems;
47 PackageManagerSettings *settings; 40 PackageManagerSettings *settings;
48 Package *activePackage; 41 Package *activePackage;
49 PackageListItem *activePackageListItem; 42 PackageListItem *activePackageListItem;
50 QPopupMenu *popupMenu; 43 QPopupMenu *popupMenu;
51 QPopupMenu *destsMenu; 44 QPopupMenu *destsMenu;
52public slots: 45public slots:
53 void showPopup(); 46 void showPopup();
54 void changePackageDest( int ); 47 void changePackageDest( int );
55 void setCurrent( QListViewItem* ); 48 void setCurrent( QListViewItem* );
56 void stopTimer( QListViewItem* ); 49 void stopTimer( QListViewItem* );
57 void toggleProcess(); 50 void toggleProcess();
58 void display(); 51 void display();
59}; 52};
60 53
61#endif 54#endif
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 89309a2..de1f162 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -1,480 +1,489 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1#include "pmipkg.h" 10#include "pmipkg.h"
2#include "pksettings.h" 11#include "pksettings.h"
3#include "package.h" 12#include "package.h"
4#include "packagelistitem.h" 13#include "packagelistitem.h"
5 14
6#include <opie/oprocess.h> 15#include <opie/oprocess.h>
7#include <qpe/resource.h> 16#include <qpe/resource.h>
8#include <qpe/config.h> 17#include <qpe/config.h>
9#include <qpe/stringutil.h> 18#include <qpe/stringutil.h>
10#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
11#include <qdir.h> 20#include <qdir.h>
12#include <qfile.h> 21#include <qfile.h>
13#include <qgroupbox.h> 22#include <qgroupbox.h>
14#include <qmultilineedit.h> 23#include <qmultilineedit.h>
15#include <qstring.h> 24#include <qstring.h>
16#include <qcheckbox.h> 25#include <qcheckbox.h>
17#include <qtextstream.h> 26#include <qtextstream.h>
18#include <qtextview.h> 27#include <qtextview.h>
19 28
20#include <qprogressbar.h> 29#include <qprogressbar.h>
21#include <qpushbutton.h> 30#include <qpushbutton.h>
22#include <qlayout.h> 31#include <qlayout.h>
23 32
24#include <stdlib.h> 33#include <stdlib.h>
25#include <unistd.h> 34#include <unistd.h>
26 35
27#include "mainwindow.h" 36#include "mainwindow.h"
28 37
29 38
30//#define OPROCESS 39//#define OPROCESS
31 40
32PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) 41PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
33 : QObject ( p ) 42 : QObject ( p )
34{ 43{
35 settings = s; 44 settings = s;
36 runwindow = new RunWindow( p, name, true, f ); 45 runwindow = new RunWindow( p, name, true, f );
37#ifdef OPROCESS 46#ifdef OPROCESS
38 ipkgProcess = new OProcess(); 47 ipkgProcess = new OProcess();
39 connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), 48 connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)),
40 this, SLOT(getIpkgOutput(OProcess*,char*,int))); 49 this, SLOT(getIpkgOutput(OProcess*,char*,int)));
41 50
42 connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)), 51 connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)),
43 this, SLOT(getIpkgOutput(OProcess*,char*,int))); 52 this, SLOT(getIpkgOutput(OProcess*,char*,int)));
44 installDialog = 0; 53 installDialog = 0;
45#endif 54#endif
46} 55}
47 56
48PmIpkg::~PmIpkg() 57PmIpkg::~PmIpkg()
49{ 58{
50#ifdef OPROCESS 59#ifdef OPROCESS
51 delete ipkgProcess; 60 delete ipkgProcess;
52#endif 61#endif
53} 62}
54 63
55bool PmIpkg::runIpkg(const QString& args, const QString& dest ) 64bool PmIpkg::runIpkg(const QString& args, const QString& dest )
56{ 65{
57 bool ret=false; 66 bool ret=false;
58 QDir::setCurrent("/tmp"); 67 QDir::setCurrent("/tmp");
59 QString cmd = "/usr/bin/ipkg "; 68 QString cmd = "/usr/bin/ipkg ";
60#ifdef OPROCESS 69#ifdef OPROCESS
61 ipkgProcess->clearArguments(); 70 ipkgProcess->clearArguments();
62 *ipkgProcess << "/usr/bin/ipkg "; 71 *ipkgProcess << "/usr/bin/ipkg ";
63 cmd = ""; 72 cmd = "";
64#endif 73#endif
65 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); 74 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
66 if ( dest == "" ) 75 if ( dest == "" )
67 cmd += " -dest "+settings->getDestinationName(); 76 cmd += " -dest "+settings->getDestinationName();
68 else 77 else
69 cmd += " -dest "+ dest; 78 cmd += " -dest "+ dest;
70 79
71 cmd += " -force-defaults "; 80 cmd += " -force-defaults ";
72 81
73 if (installDialog && installDialog->_force_depends) 82 if (installDialog && installDialog->_force_depends)
74 { 83 {
75 if (installDialog->_force_depends->isChecked()) 84 if (installDialog->_force_depends->isChecked())
76 cmd += " -force-depends "; 85 cmd += " -force-depends ";
77 if (installDialog->_force_reinstall->isChecked()) 86 if (installDialog->_force_reinstall->isChecked())
78 cmd += " -force-reinstall "; 87 cmd += " -force-reinstall ";
79 if (installDialog->_force_remove->isChecked()) 88 if (installDialog->_force_remove->isChecked())
80 cmd += " -force-removal-of-essential-packages "; 89 cmd += " -force-removal-of-essential-packages ";
81 } 90 }
82 91
83 out( "Starting to "+ args+"\n"); 92 out( "Starting to "+ args+"\n");
84 cmd += args; 93 cmd += args;
85 out( "running:\n"+cmd+"\n" ); 94 out( "running:\n"+cmd+"\n" );
86 pvDebug(2,"running:"+cmd); 95 pvDebug(2,"running:"+cmd);
87#ifdef OPROCESS 96#ifdef OPROCESS
88 *ipkgProcess << args; 97 *ipkgProcess << args;
89 out( "running:\n" + cmd); 98 out( "running:\n" + cmd);
90 *ipkgProcess << cmd; 99 *ipkgProcess << cmd;
91 100
92//debug 101//debug
93 ipkgProcess->clearArguments(); 102 ipkgProcess->clearArguments();
94 *ipkgProcess << "/bin/ls "; 103 *ipkgProcess << "/bin/ls ";
95//debug 104//debug
96 QValueList<QCString> a = ipkgProcess->args(); 105 QValueList<QCString> a = ipkgProcess->args();
97 QValueList<QCString>::Iterator it; 106 QValueList<QCString>::Iterator it;
98 for( it = a.begin(); it != a.end(); ++it ) 107 for( it = a.begin(); it != a.end(); ++it )
99 { 108 {
100 out( *it ); 109 out( *it );
101 cmd += *it; 110 cmd += *it;
102 } 111 }
103 112
104 pvDebug(2,"running:"+cmd); 113 pvDebug(2,"running:"+cmd);
105 qApp->processEvents(); 114 qApp->processEvents();
106// sleep(1); 115// sleep(1);
107 ret = ipkgProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); 116 ret = ipkgProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput);
108 if ( !ret ) { 117 if ( !ret ) {
109 pvDebug(2,"Could not execute '" + cmd); 118 pvDebug(2,"Could not execute '" + cmd);
110 out("\nError while executing "+ cmd+"\n\n"); 119 out("\nError while executing "+ cmd+"\n\n");
111 out("\nError while executing\n\n"); 120 out("\nError while executing\n\n");
112 // return false; 121 // return false;
113 } 122 }
114 123
115 while ( ipkgProcess->isRunning() ) 124 while ( ipkgProcess->isRunning() )
116 { 125 {
117 out("."); 126 out(".");
118 pvDebug(7,"wait for oprocess to terminate"); 127 pvDebug(7,"wait for oprocess to terminate");
119 qApp->processEvents(); 128 qApp->processEvents();
120 }; 129 };
121#else 130#else
122 qApp->processEvents(); 131 qApp->processEvents();
123 FILE *fp; 132 FILE *fp;
124 char line[130]; 133 char line[130];
125 QString lineStr, lineStrOld; 134 QString lineStr, lineStrOld;
126 sleep(1); 135 sleep(1);
127 cmd +=" 2>&1"; 136 cmd +=" 2>&1";
128 fp = popen( (const char *) cmd, "r"); 137 fp = popen( (const char *) cmd, "r");
129 if ( fp == NULL ) { 138 if ( fp == NULL ) {
130 qDebug("Could not execute '" + cmd + "'! err=%d", fp); 139 qDebug("Could not execute '" + cmd + "'! err=%d", fp);
131 out("\nError while executing "+ cmd+"\n\n"); 140 out("\nError while executing "+ cmd+"\n\n");
132 ret = false; 141 ret = false;
133 } else { 142 } else {
134 while ( fgets( line, sizeof line, fp) != NULL) 143 while ( fgets( line, sizeof line, fp) != NULL)
135 { 144 {
136 lineStr = line; 145 lineStr = line;
137 lineStr=lineStr.left(lineStr.length()-1); 146 lineStr=lineStr.left(lineStr.length()-1);
138 //Configuring opie-oipkg...Done 147 //Configuring opie-oipkg...Done
139 if (lineStr.contains("Done")) ret = true; 148 if (lineStr.contains("Done")) ret = true;
140 if (lineStr!=lineStrOld) 149 if (lineStr!=lineStrOld)
141 out(lineStr); 150 out(lineStr);
142 lineStrOld = lineStr; 151 lineStrOld = lineStr;
143 qApp->processEvents(); 152 qApp->processEvents();
144 } 153 }
145 } 154 }
146 pclose(fp); 155 pclose(fp);
147#endif 156#endif
148 //out( "Finished!"); 157 //out( "Finished!");
149 pvDebug(2,QString(ret?"success\n":"failure\n")); 158 pvDebug(2,QString(ret?"success\n":"failure\n"));
150 return ret; 159 return ret;
151} 160}
152 161
153void PmIpkg::makeLinks(Package *pack) 162void PmIpkg::makeLinks(Package *pack)
154{ 163{
155 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); 164 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
156 QString pn = pack->name(); 165 QString pn = pack->name();
157 linkPackage( pack->packageName(), pack->dest() ); 166 linkPackage( pack->packageName(), pack->dest() );
158} 167}
159 168
160QStringList* PmIpkg::getList( QString packFileName, QString d ) 169QStringList* PmIpkg::getList( QString packFileName, QString d )
161{ 170{
162 QString dest = settings->getDestinationUrlByName( d ); 171 QString dest = settings->getDestinationUrlByName( d );
163 dest = dest==""?d:dest; 172 dest = dest==""?d:dest;
164 if (dest == "/" ) return 0; 173 if (dest == "/" ) return 0;
165 { 174 {
166 Config cfg( "oipkg", Config::User ); 175 Config cfg( "oipkg", Config::User );
167 cfg.setGroup( "Common" ); 176 cfg.setGroup( "Common" );
168 QString statusDir = cfg.readEntry( "statusDir", "" ); 177 QString statusDir = cfg.readEntry( "statusDir", "" );
169 } 178 }
170 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; 179 packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list";
171 QFile f( packFileName ); 180 QFile f( packFileName );
172 if ( ! f.open(IO_ReadOnly) ) 181 if ( ! f.open(IO_ReadOnly) )
173 { 182 {
174 pvDebug(1," Panik! Could not open"); 183 pvDebug(1," Panik! Could not open");
175 out( "Panik!\n Could not open:\n"+packFileName ); 184 out( "Panik!\n Could not open:\n"+packFileName );
176 return (QStringList*)0; 185 return (QStringList*)0;
177 } 186 }
178 QStringList *fileList = new QStringList(); 187 QStringList *fileList = new QStringList();
179 QTextStream t( &f ); 188 QTextStream t( &f );
180 while ( !t.eof() ) 189 while ( !t.eof() )
181 { 190 {
182 *fileList += t.readLine(); 191 *fileList += t.readLine();
183 } 192 }
184 return fileList; 193 return fileList;
185} 194}
186 195
187void PmIpkg::linkPackage( QString packFileName, QString dest ) 196void PmIpkg::linkPackage( QString packFileName, QString dest )
188{ 197{
189 QStringList *fileList = getList( packFileName, dest ); 198 QStringList *fileList = getList( packFileName, dest );
190 processFileList( fileList, dest ); 199 processFileList( fileList, dest );
191 delete fileList; 200 delete fileList;
192} 201}
193 202
194void PmIpkg::processFileList( QStringList *fileList, QString d ) 203void PmIpkg::processFileList( QStringList *fileList, QString d )
195{ 204{
196 if (!fileList) return; 205 if (!fileList) return;
197 for (uint i=0; i < fileList->count(); i++) 206 for (uint i=0; i < fileList->count(); i++)
198 { 207 {
199 QString dest = settings->getDestinationUrlByName( d ); 208 QString dest = settings->getDestinationUrlByName( d );
200 dest = dest==""?d:dest; 209 dest = dest==""?d:dest;
201 processLinkDir( (*fileList)[i], dest ); 210 processLinkDir( (*fileList)[i], dest );
202 } 211 }
203} 212}
204 213
205 214
206void PmIpkg::processLinkDir( QString file, QString dest ) 215void PmIpkg::processLinkDir( QString file, QString dest )
207{ 216{
208 pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); 217 pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest);
209 if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); 218 if (linkOpp==createLink) pvDebug( 4,"opp: createLink");
210 if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); 219 if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink");
211 if ( dest == "???" || dest == "" ) return; 220 if ( dest == "???" || dest == "" ) return;
212 QString destFile = file; 221 QString destFile = file;
213 file = dest+"/"+file; 222 file = dest+"/"+file;
214 if (file == dest) return; 223 if (file == dest) return;
215// if (linkOpp==createLink) out( "\ncreating links\n" ); 224// if (linkOpp==createLink) out( "\ncreating links\n" );
216 // if (linkOpp==removeLink) out( "\nremoving links\n" ); 225 // if (linkOpp==removeLink) out( "\nremoving links\n" );
217 QFileInfo fileInfo( file ); 226 QFileInfo fileInfo( file );
218 if ( fileInfo.isDir() ) 227 if ( fileInfo.isDir() )
219 { 228 {
220 pvDebug(4, "process dir "+file); 229 pvDebug(4, "process dir "+file);
221 QDir destDir( destFile ); 230 QDir destDir( destFile );
222 if (linkOpp==createLink) destDir.mkdir( destFile, true ); 231 if (linkOpp==createLink) destDir.mkdir( destFile, true );
223 QDir d( file ); 232 QDir d( file );
224// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); 233// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
225 const QFileInfoList *list = d.entryInfoList(); 234 const QFileInfoList *list = d.entryInfoList();
226 QFileInfoListIterator it( *list ); 235 QFileInfoListIterator it( *list );
227 QFileInfo *fi; 236 QFileInfo *fi;
228 while ( (fi=it.current()) ) 237 while ( (fi=it.current()) )
229 { 238 {
230 pvDebug(4, "processLinkDir "+fi->absFilePath()); 239 pvDebug(4, "processLinkDir "+fi->absFilePath());
231 processLinkDir( fi->absFilePath(), dest ); 240 processLinkDir( fi->absFilePath(), dest );
232 ++it; 241 ++it;
233 } 242 }
234 } else 243 } else
235 if ( fileInfo.isFile() ) 244 if ( fileInfo.isFile() )
236 { 245 {
237 const char *instFile = strdup( (file).latin1() ); 246 const char *instFile = strdup( (file).latin1() );
238 const char *linkFile = strdup( (destFile).latin1()); 247 const char *linkFile = strdup( (destFile).latin1());
239 if( linkOpp==createLink ) 248 if( linkOpp==createLink )
240 { 249 {
241 pvDebug(4, "linking: "+file+" -> "+destFile ); 250 pvDebug(4, "linking: "+file+" -> "+destFile );
242 symlink( instFile, linkFile ); 251 symlink( instFile, linkFile );
243 } 252 }
244 } else { 253 } else {
245 const char *linkFile = strdup( (destFile).latin1()); 254 const char *linkFile = strdup( (destFile).latin1());
246 if( linkOpp==removeLink ) 255 if( linkOpp==removeLink )
247 { 256 {
248 QFileInfo toRemoveLink( destFile ); 257 QFileInfo toRemoveLink( destFile );
249 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) 258 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
250 { 259 {
251 pvDebug(4,"removing "+destFile+" no "+file); 260 pvDebug(4,"removing "+destFile+" no "+file);
252 unlink( linkFile ); 261 unlink( linkFile );
253 } 262 }
254 } 263 }
255 } 264 }
256} 265}
257 266
258void PmIpkg::loadList( PackageList *pl ) 267void PmIpkg::loadList( PackageList *pl )
259 { 268 {
260 for( Package *pack = pl->first();pack ; (pack = pl->next()) ) 269 for( Package *pack = pl->first();pack ; (pack = pl->next()) )
261 { 270 {
262 if ( pack && (pack->name() != "") && pack) 271 if ( pack && (pack->name() != "") && pack)
263 { 272 {
264 if ( pack->toInstall() ) 273 if ( pack->toInstall() )
265 to_install.append( pack ); 274 to_install.append( pack );
266 if ( pack->toRemove() ) 275 if ( pack->toRemove() )
267 to_remove.append( pack ); 276 to_remove.append( pack );
268 } 277 }
269 } 278 }
270} 279}
271 280
272void PmIpkg::commit() 281void PmIpkg::commit()
273 { 282 {
274 int sizecount = 0; 283 int sizecount = 0;
275 installDialog = new InstallDialog(settings,0,0,true); 284 installDialog = new InstallDialog(settings,0,0,true);
276 installDialog->toRemoveItem->setOpen( true ); 285 installDialog->toRemoveItem->setOpen( true );
277 installDialog->toInstallItem->setOpen( true ); 286 installDialog->toInstallItem->setOpen( true );
278 for (uint i=0; i < to_remove.count(); i++) 287 for (uint i=0; i < to_remove.count(); i++)
279 { 288 {
280 sizecount += 1; 289 sizecount += 1;
281 installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); 290 installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) );
282 } 291 }
283 for (uint i=0; i < to_install.count(); i++) 292 for (uint i=0; i < to_install.count(); i++)
284 { 293 {
285 sizecount += to_install.at(i)->size().toInt(); 294 sizecount += to_install.at(i)->size().toInt();
286 installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); 295 installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) );
287 } 296 }
288 runwindow->progress->setTotalSteps(sizecount); 297 runwindow->progress->setTotalSteps(sizecount);
289 qDebug("Install size %i",sizecount); 298 qDebug("Install size %i",sizecount);
290 installDialog->showMaximized(); 299 installDialog->showMaximized();
291 installDialog->show(); 300 installDialog->show();
292 if ( installDialog->exec() ) 301 if ( installDialog->exec() )
293 { 302 {
294 doIt(); 303 doIt();
295 runwindow->showMaximized(); 304 runwindow->showMaximized();
296 runwindow->show(); 305 runwindow->show();
297 } 306 }
298 installDialog->close(); 307 installDialog->close();
299 delete installDialog; 308 delete installDialog;
300 installDialog = 0; 309 installDialog = 0;
301 out(tr("\nAll done.")); 310 out(tr("\nAll done."));
302} 311}
303 312
304void PmIpkg::doIt() 313void PmIpkg::doIt()
305{ 314{
306 runwindow->progress->setProgress(0); 315 runwindow->progress->setProgress(0);
307 show(); 316 show();
308 remove(); 317 remove();
309 install(); 318 install();
310} 319}
311 320
312 321
313void PmIpkg::remove() 322void PmIpkg::remove()
314{ 323{
315 if ( to_remove.count() == 0 ) return; 324 if ( to_remove.count() == 0 ) return;
316 325
317 out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); 326 out(tr("Removing")+"\n"+tr("please wait")+"\n\n");
318 327
319 QStringList *fileList; 328 QStringList *fileList;
320 for (uint i=0; i < to_remove.count(); i++) 329 for (uint i=0; i < to_remove.count(); i++)
321 { 330 {
322 if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); 331 if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() );
323 if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) 332 if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() ))
324 { 333 {
325 runwindow->progress->setProgress( 1 ); 334 runwindow->progress->setProgress( 1 );
326 linkOpp = removeLink; 335 linkOpp = removeLink;
327 to_remove.at(i)->processed(); 336 to_remove.at(i)->processed();
328 pvDebug(3,"link "+QString::number(i)); 337 pvDebug(3,"link "+QString::number(i));
329 if ( to_remove.at(i)->link() ) 338 if ( to_remove.at(i)->link() )
330 processFileList( fileList, to_remove.at(i)->dest() ); 339 processFileList( fileList, to_remove.at(i)->dest() );
331 //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); 340 //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count()));
332 //if ( to_remove.at(i) ) to_remove.take( i ); 341 //if ( to_remove.at(i) ) to_remove.take( i );
333 342
334 out("\n"); 343 out("\n");
335 }else{ 344 }else{
336 out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); 345 out(tr("Error while removing ")+to_remove.at(i)->name()+"\n");
337 if ( to_remove.at(i)->link() ) 346 if ( to_remove.at(i)->link() )
338 processFileList( fileList, to_remove.at(i)->dest() ); 347 processFileList( fileList, to_remove.at(i)->dest() );
339 } 348 }
340 if ( to_remove.at(i)->link() ) 349 if ( to_remove.at(i)->link() )
341 processFileList( fileList, to_remove.at(i)->dest() ); 350 processFileList( fileList, to_remove.at(i)->dest() );
342 if ( to_remove.at(i)->link() )delete fileList; 351 if ( to_remove.at(i)->link() )delete fileList;
343 } 352 }
344 to_remove.clear(); 353 to_remove.clear();
345 out("\n"); 354 out("\n");
346} 355}
347 356
348 357
349void PmIpkg::install() 358void PmIpkg::install()
350{ 359{
351 if ( to_install.count() == 0 ) return; 360 if ( to_install.count() == 0 ) return;
352 out(tr("Installing")+"\n"+tr("please wait")+"\n"); 361 out(tr("Installing")+"\n"+tr("please wait")+"\n");
353 for (uint i=0; i < to_install.count(); i++) 362 for (uint i=0; i < to_install.count(); i++)
354 { 363 {
355 qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug 364 qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug
356 if (to_install.at(i)->link()) 365 if (to_install.at(i)->link())
357 { 366 {
358 // hack to have package.list 367 // hack to have package.list
359 // in "dest"/usr/lib/ipkg/info/ 368 // in "dest"/usr/lib/ipkg/info/
360 QString rds = settings->getDestinationUrlByName("root"); 369 QString rds = settings->getDestinationUrlByName("root");
361 QString lds = settings->getDestinationUrlByName(to_install.at(i)->dest()); 370 QString lds = settings->getDestinationUrlByName(to_install.at(i)->dest());
362 QString listFile = "usr/lib/ipkg/lists/"+to_install.at(i)->name()+".list"; 371 QString listFile = "usr/lib/ipkg/lists/"+to_install.at(i)->name()+".list";
363 rds += listFile; 372 rds += listFile;
364 lds += listFile; 373 lds += listFile;
365 const char *rd = rds.latin1(); 374 const char *rd = rds.latin1();
366 const char *ld = lds.latin1(); 375 const char *ld = lds.latin1();
367 pvDebug(4, "linking: "+rds+" -> "+lds ); 376 pvDebug(4, "linking: "+rds+" -> "+lds );
368 symlink( rd, ld ); 377 symlink( rd, ld );
369 } 378 }
370 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) 379 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ))
371 { 380 {
372 runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); 381 runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress());
373 to_install.at(i)->processed(); 382 to_install.at(i)->processed();
374 linkOpp = createLink; 383 linkOpp = createLink;
375 if ( to_install.at(i)->link() ) 384 if ( to_install.at(i)->link() )
376 makeLinks( to_install.at(i) ); 385 makeLinks( to_install.at(i) );
377 // to_install.take( i ); 386 // to_install.take( i );
378 out("\n"); 387 out("\n");
379 }else{ 388 }else{
380 out(tr("Error while installing")+to_install.at(i)->name()+"\n"); 389 out(tr("Error while installing")+to_install.at(i)->name()+"\n");
381 linkOpp = createLink; 390 linkOpp = createLink;
382 if ( to_install.at(i)->link() ) 391 if ( to_install.at(i)->link() )
383 makeLinks( to_install.at(i) ); 392 makeLinks( to_install.at(i) );
384 } 393 }
385 } 394 }
386 out("\n"); 395 out("\n");
387 to_install.clear(); 396 to_install.clear();
388} 397}
389 398
390void PmIpkg::createLinks( const QString &dest ) 399void PmIpkg::createLinks( const QString &dest )
391{ 400{
392 pvDebug(2,"PmIpkg::createLinks "+dest); 401 pvDebug(2,"PmIpkg::createLinks "+dest);
393 linkOpp=createLink; 402 linkOpp=createLink;
394 QString url = settings->getDestinationUrlByName( dest ); 403 QString url = settings->getDestinationUrlByName( dest );
395 url = url==""?dest:url; 404 url = url==""?dest:url;
396 processLinkDir( "/opt", url ); 405 processLinkDir( "/opt", url );
397 processLinkDir( "/usr", url ); 406 processLinkDir( "/usr", url );
398} 407}
399 408
400void PmIpkg::removeLinks( const QString &dest ) 409void PmIpkg::removeLinks( const QString &dest )
401{ 410{
402 pvDebug(2,"PmIpkg::removeLinks "+dest); 411 pvDebug(2,"PmIpkg::removeLinks "+dest);
403 linkOpp=removeLink; 412 linkOpp=removeLink;
404 QString url = settings->getDestinationUrlByName( dest ); 413 QString url = settings->getDestinationUrlByName( dest );
405 url = url==""?dest:url; 414 url = url==""?dest:url;
406 processLinkDir( "/opt", url ); 415 processLinkDir( "/opt", url );
407 processLinkDir( "/usr", url ); 416 processLinkDir( "/usr", url );
408} 417}
409 418
410void PmIpkg::update() 419void PmIpkg::update()
411{ 420{
412 show(); 421 show();
413 if ( runIpkg( "update" ) ) 422 if ( runIpkg( "update" ) )
414 runwindow->close(); 423 runwindow->close();
415 else out("An error occurred!\nPlease check the log."); 424 else out("An error occurred!\nPlease check the log.");
416} 425}
417 426
418void PmIpkg::out( QString o ) 427void PmIpkg::out( QString o )
419{ 428{
420 runwindow->outPut->append(o); 429 runwindow->outPut->append(o);
421 runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); 430 runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE);
422} 431}
423 432
424 433
425 434
426 435
427void PmIpkg::show() 436void PmIpkg::show()
428{ 437{
429 if (!runwindow->isVisible()) 438 if (!runwindow->isVisible())
430 { 439 {
431 runwindow->showMaximized(); 440 runwindow->showMaximized();
432 runwindow->show(); 441 runwindow->show();
433 } 442 }
434 runwindow->outPut->setText(""); 443 runwindow->outPut->setText("");
435} 444}
436 445
437void PmIpkg::installFile(const QString &fileName, const QString &dest) 446void PmIpkg::installFile(const QString &fileName, const QString &dest)
438{ 447{
439 448
440 to_install.clear(); 449 to_install.clear();
441 to_remove.clear(); 450 to_remove.clear();
442 pvDebug( 2,"PmIpkg::installFile "+ fileName); 451 pvDebug( 2,"PmIpkg::installFile "+ fileName);
443 Package *p = new Package(fileName,settings); 452 Package *p = new Package(fileName,settings);
444 if ( dest!="") p->setDest( dest ); 453 if ( dest!="") p->setDest( dest );
445 to_install.append( p ); 454 to_install.append( p );
446 commit(); 455 commit();
447 delete p; 456 delete p;
448} 457}
449 458
450void PmIpkg::removeFile(const QString &fileName, const QString &dest) 459void PmIpkg::removeFile(const QString &fileName, const QString &dest)
451{ 460{
452 461
453 to_install.clear(); 462 to_install.clear();
454 to_remove.clear(); 463 to_remove.clear();
455 pvDebug( 2,"PmIpkg::removeFile "+ fileName); 464 pvDebug( 2,"PmIpkg::removeFile "+ fileName);
456 Package *p = new Package(fileName,settings); 465 Package *p = new Package(fileName,settings);
457 if ( dest!="") p->setDest( dest ); 466 if ( dest!="") p->setDest( dest );
458 to_remove.append( p ); 467 to_remove.append( p );
459 commit(); 468 commit();
460 delete p; 469 delete p;
461} 470}
462 471
463 472
464void PmIpkg::clearLists() 473void PmIpkg::clearLists()
465{ 474{
466 to_remove.clear(); 475 to_remove.clear();
467 to_install.clear(); 476 to_install.clear();
468} 477}
469 478
470 479
471void PmIpkg::getIpkgOutput(OProcess *proc, char *buffer, int buflen) 480void PmIpkg::getIpkgOutput(OProcess *proc, char *buffer, int buflen)
472{ 481{
473 QString lineStr, lineStrOld; 482 QString lineStr, lineStrOld;
474 lineStr = buffer; 483 lineStr = buffer;
475 lineStr=lineStr.left(buflen); 484 lineStr=lineStr.left(buflen);
476 //Configuring opie-oipkg...Done 485 //Configuring opie-oipkg...Done
477 if (lineStr!=lineStrOld) 486 if (lineStr!=lineStrOld)
478 out(lineStr); 487 out(lineStr);
479 lineStrOld = lineStr; 488 lineStrOld = lineStr;
480} 489}
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h
index 2c92348..28bc5dd 100644
--- a/noncore/unsupported/oipkg/pmipkg.h
+++ b/noncore/unsupported/oipkg/pmipkg.h
@@ -1,65 +1,74 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1#ifndef PMIPKG_H 10#ifndef PMIPKG_H
2#define PMIPKG_H 11#define PMIPKG_H
3 12
4 13
5#include <opie/oprocess.h> 14#include <opie/oprocess.h>
6#include <qobject.h> 15#include <qobject.h>
7#include <qlist.h> 16#include <qlist.h>
8#include <qstring.h> 17#include <qstring.h>
9#include <qwidget.h> 18#include <qwidget.h>
10#include "pksettings.h" 19#include "pksettings.h"
11#include "runwindow.h" 20#include "runwindow.h"
12#include "packagelist.h" 21#include "packagelist.h"
13#include "installdialog.h" 22#include "installdialog.h"
14#include "debug.h" 23#include "debug.h"
15 24
16#define createLink 0 25#define createLink 0
17#define removeLink 1 26#define removeLink 1
18 27
19class Package; 28class Package;
20class PmIpkg : public QObject 29class PmIpkg : public QObject
21{ 30{
22 Q_OBJECT 31 Q_OBJECT
23public: 32public:
24 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); 33 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 );
25 ~PmIpkg(); 34 ~PmIpkg();
26 35
27 int linkOpp; 36 int linkOpp;
28 void loadList( PackageList* ); 37 void loadList( PackageList* );
29 void commit(); 38 void commit();
30 void update(); 39 void update();
31 void show(); 40 void show();
32 /** No descriptions */ 41 /** No descriptions */
33 void clearLists(); 42 void clearLists();
34 43
35public slots: 44public slots:
36 void doIt(); 45 void doIt();
37 void install(); 46 void install();
38 void remove(); 47 void remove();
39 void installFile(const QString &fileName, const QString &dest=""); 48 void installFile(const QString &fileName, const QString &dest="");
40 void removeFile(const QString &fileName, const QString &dest=""); 49 void removeFile(const QString &fileName, const QString &dest="");
41 void createLinks( const QString &dest ); 50 void createLinks( const QString &dest );
42 void removeLinks( const QString &dest ); 51 void removeLinks( const QString &dest );
43 52
44//private slots: 53//private slots:
45 void getIpkgOutput(OProcess *proc, char *buffer, int buflen); 54 void getIpkgOutput(OProcess *proc, char *buffer, int buflen);
46 55
47private: 56private:
48 OProcess *ipkgProcess; 57 OProcess *ipkgProcess;
49 PackageManagerSettings* settings; 58 PackageManagerSettings* settings;
50 RunWindow *runwindow; 59 RunWindow *runwindow;
51 InstallDialog *installDialog; 60 InstallDialog *installDialog;
52 QList<Package> to_remove; 61 QList<Package> to_remove;
53 QList<Package> to_install; 62 QList<Package> to_install;
54 void makeLinks(Package*); 63 void makeLinks(Package*);
55 void linkPackage( QString, QString ); 64 void linkPackage( QString, QString );
56 void processLinkDir( QString , QString ); 65 void processLinkDir( QString , QString );
57 bool runIpkg(const QString& args, const QString& dest="" ); 66 bool runIpkg(const QString& args, const QString& dest="" );
58 void out( QString ); 67 void out( QString );
59 QStringList* getList( QString, QString ); 68 QStringList* getList( QString, QString );
60 void processFileList( QStringList*, QString ); 69 void processFileList( QStringList*, QString );
61 70
62 71
63}; 72};
64 73
65#endif 74#endif
diff --git a/noncore/unsupported/oipkg/settings.cpp b/noncore/unsupported/oipkg/settings.cpp
index 85daa98..4bd60c0 100644
--- a/noncore/unsupported/oipkg/settings.cpp
+++ b/noncore/unsupported/oipkg/settings.cpp
@@ -1,441 +1,450 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1#include "pksettings.h" 10#include "pksettings.h"
2 11
3#include <qpe/config.h> 12#include <qpe/config.h>
4#include <qcombobox.h> 13#include <qcombobox.h>
5#include <qfile.h> 14#include <qfile.h>
6#include <qlineedit.h> 15#include <qlineedit.h>
7#include <qpushbutton.h> 16#include <qpushbutton.h>
8#include <qlistbox.h> 17#include <qlistbox.h>
9#include <qcheckbox.h> 18#include <qcheckbox.h>
10#include <qstring.h> 19#include <qstring.h>
11#include <qobject.h> 20#include <qobject.h>
12#include <qtextstream.h> 21#include <qtextstream.h>
13#include <qtabwidget.h> 22#include <qtabwidget.h>
14 23
15 24
16PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) 25PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl )
17 : PackageManagerSettingsBase( parent, name, fl ) 26 : PackageManagerSettingsBase( parent, name, fl )
18{ 27{
19 connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) ); 28 connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) );
20 connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) ); 29 connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) );
21 connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); 30 connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) );
22 connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) ); 31 connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) );
23 connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) ); 32 connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) );
24 connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); 33 connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) );
25 // connect( CheckBoxLink, SIGNAL(toggled(bool)), 34 // connect( CheckBoxLink, SIGNAL(toggled(bool)),
26 // activeLinkDestination, SLOT(setEnabled(bool)) ); 35 // activeLinkDestination, SLOT(setEnabled(bool)) );
27 36
28 connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); 37 connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) );
29 connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); 38 connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) );
30 connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); 39 connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) );
31 connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); 40 connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) );
32 connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); 41 connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) );
33 servername->setEnabled(FALSE); 42 servername->setEnabled(FALSE);
34 serverurl->setEnabled(FALSE); 43 serverurl->setEnabled(FALSE);
35 serverurlDic.setAutoDelete(TRUE); 44 serverurlDic.setAutoDelete(TRUE);
36 destinationname->setEnabled(FALSE); 45 destinationname->setEnabled(FALSE);
37 destinationurl->setEnabled(FALSE); 46 destinationurl->setEnabled(FALSE);
38 destinationurlDic.setAutoDelete(TRUE); 47 destinationurlDic.setAutoDelete(TRUE);
39 readSettings(); 48 readSettings();
40} 49}
41 50
42PackageManagerSettings::~PackageManagerSettings() 51PackageManagerSettings::~PackageManagerSettings()
43{ 52{
44} 53}
45 54
46 55
47void PackageManagerSettings::newServer() 56void PackageManagerSettings::newServer()
48{ 57{
49 int i = servers->count(); 58 int i = servers->count();
50 if ( servername->isEnabled() || serverurl->text().isEmpty() ) { 59 if ( servername->isEnabled() || serverurl->text().isEmpty() ) {
51 serverurlDic.insert(i,new QString("http://")); 60 serverurlDic.insert(i,new QString("http://"));
52 servers->insertItem(tr("New")); 61 servers->insertItem(tr("New"));
53 activeServers->insertItem(tr("New")); 62 activeServers->insertItem(tr("New"));
54 } else { 63 } else {
55 // allows one-level undo 64 // allows one-level undo
56 serverurlDic.insert(i,new QString(serverurl->text())); 65 serverurlDic.insert(i,new QString(serverurl->text()));
57 servers->insertItem(servername->text()); 66 servers->insertItem(servername->text());
58 activeServers->insertItem(servername->text()); 67 activeServers->insertItem(servername->text());
59 } 68 }
60 servers->setSelected(i,TRUE); 69 servers->setSelected(i,TRUE);
61 editServer(i); 70 editServer(i);
62} 71}
63 72
64void PackageManagerSettings::newDestination() 73void PackageManagerSettings::newDestination()
65{ 74{
66 int i = destinations->count(); 75 int i = destinations->count();
67 if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) { 76 if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) {
68 destinationurlDic.insert(i,new QString("/")); 77 destinationurlDic.insert(i,new QString("/"));
69 destinations->insertItem(tr("New")); 78 destinations->insertItem(tr("New"));
70 activeDestination->insertItem(tr("New")); 79 activeDestination->insertItem(tr("New"));
71 activeLinkDestination->insertItem(tr("New")); 80 activeLinkDestination->insertItem(tr("New"));
72 } else { 81 } else {
73 // allows one-level undo 82 // allows one-level undo
74 destinationurlDic.insert(i,new QString(destinationurl->text())); 83 destinationurlDic.insert(i,new QString(destinationurl->text()));
75 destinations->insertItem(destinationname->text()); 84 destinations->insertItem(destinationname->text());
76 activeDestination->insertItem(destinationname->text()); 85 activeDestination->insertItem(destinationname->text());
77 activeLinkDestination->insertItem(destinationname->text()); 86 activeLinkDestination->insertItem(destinationname->text());
78 } 87 }
79 destinations->setSelected(i,TRUE); 88 destinations->setSelected(i,TRUE);
80 editDestination(i); 89 editDestination(i);
81} 90}
82 91
83 92
84void PackageManagerSettings::editServer(int i) 93void PackageManagerSettings::editServer(int i)
85{ 94{
86 if ( servername->isEnabled() ) { 95 if ( servername->isEnabled() ) {
87 disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); 96 disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) );
88 disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); 97 disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) );
89 } else { 98 } else {
90 servername->setEnabled(TRUE); 99 servername->setEnabled(TRUE);
91 serverurl->setEnabled(TRUE); 100 serverurl->setEnabled(TRUE);
92 } 101 }
93 102
94 servername->setText( servers->text(i) ); 103 servername->setText( servers->text(i) );
95 serverurl->setText( *serverurlDic[i] ); 104 serverurl->setText( *serverurlDic[i] );
96 105
97 editedserver = i; 106 editedserver = i;
98 107
99 connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); 108 connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) );
100 connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); 109 connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) );
101} 110}
102 111
103 112
104void PackageManagerSettings::editDestination(int i) 113void PackageManagerSettings::editDestination(int i)
105{ 114{
106 if ( destinationname->isEnabled() ) { 115 if ( destinationname->isEnabled() ) {
107 disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); 116 disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) );
108 disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); 117 disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) );
109 } else { 118 } else {
110 destinationname->setEnabled(TRUE); 119 destinationname->setEnabled(TRUE);
111 destinationurl->setEnabled(TRUE); 120 destinationurl->setEnabled(TRUE);
112 } 121 }
113 122
114 destinationname->setText( destinations->text(i) ); 123 destinationname->setText( destinations->text(i) );
115 destinationurl->setText( *destinationurlDic[i] ); 124 destinationurl->setText( *destinationurlDic[i] );
116 125
117 editeddestination = i; 126 editeddestination = i;
118 127
119 connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); 128 connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) );
120 connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); 129 connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) );
121} 130}
122 131
123void PackageManagerSettings::removeServer() 132void PackageManagerSettings::removeServer()
124{ 133{
125 disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); 134 disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) );
126 disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); 135 disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) );
127 servername->setText(servers->text(editedserver)); 136 servername->setText(servers->text(editedserver));
128 serverurl->setText(*serverurlDic[editedserver]); 137 serverurl->setText(*serverurlDic[editedserver]);
129 disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); 138 disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) );
130 servers->removeItem(editedserver); 139 servers->removeItem(editedserver);
131 activeServers->removeItem(editedserver); 140 activeServers->removeItem(editedserver);
132 connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); 141 connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) );
133 servername->setEnabled(FALSE); 142 servername->setEnabled(FALSE);
134 serverurl->setEnabled(FALSE); 143 serverurl->setEnabled(FALSE);
135} 144}
136 145
137void PackageManagerSettings::removeDestination() 146void PackageManagerSettings::removeDestination()
138{ 147{
139 disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); 148 disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) );
140 disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); 149 disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) );
141 destinationname->setText(destinations->text(editedserver)); 150 destinationname->setText(destinations->text(editedserver));
142 destinationurl->setText(*destinationurlDic[editedserver]); 151 destinationurl->setText(*destinationurlDic[editedserver]);
143 disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); 152 disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) );
144 destinations->removeItem(editeddestination); 153 destinations->removeItem(editeddestination);
145 activeDestination->removeItem(editeddestination); 154 activeDestination->removeItem(editeddestination);
146 activeLinkDestination->removeItem(editeddestination); 155 activeLinkDestination->removeItem(editeddestination);
147 connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); 156 connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) );
148 destinationname->setEnabled(FALSE); 157 destinationname->setEnabled(FALSE);
149 destinationurl->setEnabled(FALSE); 158 destinationurl->setEnabled(FALSE);
150} 159}
151 160
152void PackageManagerSettings::serverNameChanged(const QString& t) 161void PackageManagerSettings::serverNameChanged(const QString& t)
153{ 162{
154 disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); 163 disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) );
155 servers->changeItem( t, editedserver ); 164 servers->changeItem( t, editedserver );
156 activeServers->changeItem( t, editedserver ); 165 activeServers->changeItem( t, editedserver );
157 connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); 166 connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) );
158} 167}
159 168
160void PackageManagerSettings::destNameChanged(const QString& t) 169void PackageManagerSettings::destNameChanged(const QString& t)
161{ 170{
162 disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); 171 disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) );
163 destinations->changeItem( t, editeddestination ); 172 destinations->changeItem( t, editeddestination );
164 activeDestination->changeItem( t, editeddestination ); 173 activeDestination->changeItem( t, editeddestination );
165 activeLinkDestination->changeItem( t, editeddestination ); 174 activeLinkDestination->changeItem( t, editeddestination );
166 connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); 175 connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) );
167} 176}
168 177
169void PackageManagerSettings::serverUrlChanged(const QString& t) 178void PackageManagerSettings::serverUrlChanged(const QString& t)
170{ 179{
171 serverurlDic.replace(editedserver, new QString(t)); 180 serverurlDic.replace(editedserver, new QString(t));
172} 181}
173 182
174void PackageManagerSettings::destUrlChanged(const QString& t) 183void PackageManagerSettings::destUrlChanged(const QString& t)
175{ 184{
176 destinationurlDic.replace(editeddestination, new QString(t)); 185 destinationurlDic.replace(editeddestination, new QString(t));
177} 186}
178 187
179void PackageManagerSettings::writeIpkgConfig(const QString& conffile) 188void PackageManagerSettings::writeIpkgConfig(const QString& conffile)
180{ 189{
181 QFile conf(conffile); 190 QFile conf(conffile);
182 if ( ! conf.open(IO_WriteOnly) ) return; 191 if ( ! conf.open(IO_WriteOnly) ) return;
183 QTextStream s(&conf); 192 QTextStream s(&conf);
184 s << "# "+tr("Written by Opie Package Manager")+"\n"; 193 s << "# "+tr("Written by Opie Package Manager")+"\n";
185 for (int i=0; i<(int)activeServers->count(); i++) 194 for (int i=0; i<(int)activeServers->count(); i++)
186 { 195 {
187 QString url = serverurlDic[i] ? *serverurlDic[i] : QString("???"); 196 QString url = serverurlDic[i] ? *serverurlDic[i] : QString("???");
188 if ( !activeServers->isSelected(i) ) 197 if ( !activeServers->isSelected(i) )
189 s << "#"; 198 s << "#";
190 s << "src " << activeServers->text(i) << " " << url << "\n"; 199 s << "src " << activeServers->text(i) << " " << url << "\n";
191 } 200 }
192 for (int i=0; i<(int)destinations->count(); i++) 201 for (int i=0; i<(int)destinations->count(); i++)
193 { 202 {
194 QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???"); 203 QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???");
195 s << "dest " << destinations->text(i) << " " << url << "\n"; 204 s << "dest " << destinations->text(i) << " " << url << "\n";
196 } 205 }
197 conf.close(); 206 conf.close();
198} 207}
199 208
200 209
201void PackageManagerSettings::readInstallationSettings() 210void PackageManagerSettings::readInstallationSettings()
202{ 211{
203 Config cfg( "oipkg", Config::User ); 212 Config cfg( "oipkg", Config::User );
204 cfg.setGroup( "Settings" ); 213 cfg.setGroup( "Settings" );
205 installationSettingsCount = cfg.readNumEntry( "count", -1 ); 214 installationSettingsCount = cfg.readNumEntry( "count", -1 );
206 currentSetting = cfg.readNumEntry( "current", 0 ); 215 currentSetting = cfg.readNumEntry( "current", 0 );
207 216
208 for (int i = 0; i < installationSettingsCount; i++) 217 for (int i = 0; i < installationSettingsCount; i++)
209 { 218 {
210 cfg.setGroup( "Setting_" + QString::number(i) ); 219 cfg.setGroup( "Setting_" + QString::number(i) );
211 settingName->insertItem( cfg.readEntry( "name", "???" ), i ); 220 settingName->insertItem( cfg.readEntry( "name", "???" ), i );
212 }; 221 };
213 readInstallationSetting( currentSetting ); 222 readInstallationSetting( currentSetting );
214} 223}
215 224
216 225
217void PackageManagerSettings::removeInstallationSetting() 226void PackageManagerSettings::removeInstallationSetting()
218{ 227{
219 settingName->removeItem( settingName->currentItem() ); 228 settingName->removeItem( settingName->currentItem() );
220 Config cfg( "oipkg", Config::User ); 229 Config cfg( "oipkg", Config::User );
221 cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) ); 230 cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) );
222 cfg.clearGroup(); 231 cfg.clearGroup();
223 installationSettingsCount--; 232 installationSettingsCount--;
224 settingName->setEditable( false ); 233 settingName->setEditable( false );
225} 234}
226 235
227void PackageManagerSettings::newInstallationSetting() 236void PackageManagerSettings::newInstallationSetting()
228{ 237{
229 installationSettingsCount++; 238 installationSettingsCount++;
230 settingName->insertItem( "New", installationSettingsCount ); 239 settingName->insertItem( "New", installationSettingsCount );
231 settingName->setCurrentItem( installationSettingsCount ); 240 settingName->setCurrentItem( installationSettingsCount );
232 settingName->setEditable( true ); 241 settingName->setEditable( true );
233} 242}
234 243
235void PackageManagerSettings::installationSettingChange(int cs) 244void PackageManagerSettings::installationSettingChange(int cs)
236{ 245{
237 writeCurrentInstallationSetting(); 246 writeCurrentInstallationSetting();
238 currentSetting = cs; 247 currentSetting = cs;
239 readInstallationSetting( cs ); 248 readInstallationSetting( cs );
240} 249}
241 250
242void PackageManagerSettings::writeInstallationSettings() 251void PackageManagerSettings::writeInstallationSettings()
243{ 252{
244 { 253 {
245 Config cfg( "oipkg", Config::User ); 254 Config cfg( "oipkg", Config::User );
246 cfg.setGroup( "Settings" ); 255 cfg.setGroup( "Settings" );
247 cfg.writeEntry( "count", installationSettingsCount ); 256 cfg.writeEntry( "count", installationSettingsCount );
248 cfg.writeEntry( "current", currentSetting ); 257 cfg.writeEntry( "current", currentSetting );
249 writeCurrentInstallationSetting(); 258 writeCurrentInstallationSetting();
250 } 259 }
251} 260}
252 261
253 262
254void PackageManagerSettings::readInstallationSetting(int setting) 263void PackageManagerSettings::readInstallationSetting(int setting)
255{ 264{
256 if ( setting < 0 ) return; 265 if ( setting < 0 ) return;
257 Config cfg( "oipkg", Config::User ); 266 Config cfg( "oipkg", Config::User );
258 cfg.setGroup( "Setting_" + QString::number( setting ) ); 267 cfg.setGroup( "Setting_" + QString::number( setting ) );
259 CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); 268 CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) );
260 QString dest = cfg.readEntry( "dest" ); 269 QString dest = cfg.readEntry( "dest" );
261 QString linkdest = cfg.readEntry( "linkdest" ); 270 QString linkdest = cfg.readEntry( "linkdest" );
262 271
263 for ( int i = 0; i < activeDestination->count(); i++) 272 for ( int i = 0; i < activeDestination->count(); i++)
264 { 273 {
265 QString name = cfg.readEntry( "name" ); 274 QString name = cfg.readEntry( "name" );
266 if ( activeDestination->text( i ) == name ) 275 if ( activeDestination->text( i ) == name )
267 activeDestination->setCurrentItem( i ); 276 activeDestination->setCurrentItem( i );
268 if ( activeLinkDestination->text( i ) == name ) 277 if ( activeLinkDestination->text( i ) == name )
269 activeLinkDestination->setCurrentItem( i ); 278 activeLinkDestination->setCurrentItem( i );
270 } 279 }
271} 280}
272 281
273void PackageManagerSettings::writeCurrentInstallationSetting() 282void PackageManagerSettings::writeCurrentInstallationSetting()
274{ 283{
275 Config cfg( "oipkg", Config::User ); 284 Config cfg( "oipkg", Config::User );
276 cfg.setGroup( "Setting_" + QString::number(currentSetting) ); 285 cfg.setGroup( "Setting_" + QString::number(currentSetting) );
277 cfg.writeEntry( "link", CheckBoxLink->isChecked() ); 286 cfg.writeEntry( "link", CheckBoxLink->isChecked() );
278 cfg.writeEntry( "dest", getDestinationName() ); 287 cfg.writeEntry( "dest", getDestinationName() );
279 cfg.writeEntry( "linkdest" , getLinkDestinationName() ); 288 cfg.writeEntry( "linkdest" , getLinkDestinationName() );
280 QStringList sers = getActiveServers(); 289 QStringList sers = getActiveServers();
281 int srvc = 0; 290 int srvc = 0;
282 for ( QStringList::Iterator it = sers.begin(); it != sers.end(); ++it ) { 291 for ( QStringList::Iterator it = sers.begin(); it != sers.end(); ++it ) {
283 cfg.writeEntry( "server_" + QString::number(srvc++), *it ); 292 cfg.writeEntry( "server_" + QString::number(srvc++), *it );
284 } 293 }
285 cfg.writeEntry( "server_count", srvc ); 294 cfg.writeEntry( "server_count", srvc );
286} 295}
287 296
288void PackageManagerSettings::renameInstallationSetting() 297void PackageManagerSettings::renameInstallationSetting()
289{ 298{
290 settingName->setEditable( true ); 299 settingName->setEditable( true );
291} 300}
292 301
293void PackageManagerSettings::installationSettingSetName(const QString &name) 302void PackageManagerSettings::installationSettingSetName(const QString &name)
294{ 303{
295 settingName->changeItem( name, settingName->currentItem() ); 304 settingName->changeItem( name, settingName->currentItem() );
296} 305}
297 306
298 307
299bool PackageManagerSettings::readIpkgConfig(const QString& conffile) 308bool PackageManagerSettings::readIpkgConfig(const QString& conffile)
300{ 309{
301 QFile conf(conffile); 310 QFile conf(conffile);
302 if ( conf.open(IO_ReadOnly) ) { 311 if ( conf.open(IO_ReadOnly) ) {
303 QTextStream s(&conf); 312 QTextStream s(&conf);
304 servers->clear(); 313 servers->clear();
305 activeServers->clear(); 314 activeServers->clear();
306 activeDestination->clear(); 315 activeDestination->clear();
307 activeLinkDestination->clear(); 316 activeLinkDestination->clear();
308 serverurlDic.clear(); 317 serverurlDic.clear();
309 destinationurlDic.clear(); 318 destinationurlDic.clear();
310 ipkg_old=0; 319 ipkg_old=0;
311 int currentserver=0; 320 int currentserver=0;
312 while ( !s.atEnd() ) { 321 while ( !s.atEnd() ) {
313 QString l = s.readLine(); 322 QString l = s.readLine();
314 QStringList token = QStringList::split(' ', l); 323 QStringList token = QStringList::split(' ', l);
315 if ( token[0] == "src" || token[0] == "#src" ) { 324 if ( token[0] == "src" || token[0] == "#src" ) {
316 currentserver=servers->count(); 325 currentserver=servers->count();
317 serverurlDic.insert(servers->count(),new QString(token[2])); 326 serverurlDic.insert(servers->count(),new QString(token[2]));
318 int a = token[0] == "src" ? 1 : 0; 327 int a = token[0] == "src" ? 1 : 0;
319 int i = servers->count(); 328 int i = servers->count();
320 servers->insertItem(token[1]); 329 servers->insertItem(token[1]);
321 activeServers->insertItem( token[1] ); 330 activeServers->insertItem( token[1] );
322 activeServers->setSelected(i,a); 331 activeServers->setSelected(i,a);
323 } else if ( token[0] == "dest" ) { 332 } else if ( token[0] == "dest" ) {
324 currentserver=destinations->count(); 333 currentserver=destinations->count();
325 destinationurlDic.insert(destinations->count(),new QString(token[2])); 334 destinationurlDic.insert(destinations->count(),new QString(token[2]));
326 destinations->insertItem(token[1]); 335 destinations->insertItem(token[1]);
327 activeDestination->insertItem( token[1] ); 336 activeDestination->insertItem( token[1] );
328 activeLinkDestination->insertItem( token[1] ); 337 activeLinkDestination->insertItem( token[1] );
329 338
330 } else if ( token[0] == "option" ) { 339 } else if ( token[0] == "option" ) {
331 } else { 340 } else {
332 // Old style? 341 // Old style?
333 int eq = l.find('='); 342 int eq = l.find('=');
334 if ( eq >= 0 ) { 343 if ( eq >= 0 ) {
335 QString v = l.mid(eq+1).stripWhiteSpace(); 344 QString v = l.mid(eq+1).stripWhiteSpace();
336 if ( v[0] == '"' || v[0] == '\'' ) { 345 if ( v[0] == '"' || v[0] == '\'' ) {
337 int cl=v.find(v[0],1); 346 int cl=v.find(v[0],1);
338 if ( cl >= 0 ) 347 if ( cl >= 0 )
339 v = v.mid(1,cl-1); 348 v = v.mid(1,cl-1);
340 } 349 }
341 if ( l.left(12) == "IPKG_SOURCE=" ) { 350 if ( l.left(12) == "IPKG_SOURCE=" ) {
342 ipkg_old=1; 351 ipkg_old=1;
343 currentserver=servers->count(); 352 currentserver=servers->count();
344 serverurlDic.insert(servers->count(),new QString(v)); 353 serverurlDic.insert(servers->count(),new QString(v));
345 servers->insertItem(v); 354 servers->insertItem(v);
346 } else if ( l.left(13) == "#IPKG_SOURCE=" ) { 355 } else if ( l.left(13) == "#IPKG_SOURCE=" ) {
347 serverurlDic.insert(servers->count(),new QString(v)); 356 serverurlDic.insert(servers->count(),new QString(v));
348 servers->insertItem(v); 357 servers->insertItem(v);
349 } else if ( l.left(10) == "IPKG_ROOT=" ) { 358 } else if ( l.left(10) == "IPKG_ROOT=" ) {
350 359
351 } 360 }
352 } 361 }
353 } 362 }
354 } 363 }
355 if ( ipkg_old ) { 364 if ( ipkg_old ) {
356 servers->setSelectionMode(QListBox::Single); 365 servers->setSelectionMode(QListBox::Single);
357 servers->setSelected(currentserver,TRUE); 366 servers->setSelected(currentserver,TRUE);
358 } 367 }
359 return TRUE; 368 return TRUE;
360 } else { 369 } else {
361 return FALSE; 370 return FALSE;
362 } 371 }
363} 372}
364 373
365void PackageManagerSettings::readSettings() 374void PackageManagerSettings::readSettings()
366{ 375{
367 readIpkgConfig("/etc/ipkg.conf"); 376 readIpkgConfig("/etc/ipkg.conf");
368 readInstallationSettings(); 377 readInstallationSettings();
369} 378}
370 379
371void PackageManagerSettings::writeSettings() 380void PackageManagerSettings::writeSettings()
372{ 381{
373 writeIpkgConfig("/etc/ipkg.conf"); 382 writeIpkgConfig("/etc/ipkg.conf");
374 writeInstallationSettings(); 383 writeInstallationSettings();
375} 384}
376 385
377bool PackageManagerSettings::showDialog( int i ) 386bool PackageManagerSettings::showDialog( int i )
378{ 387{
379 TabWidget->setCurrentPage( i ); 388 TabWidget->setCurrentPage( i );
380 showMaximized(); 389 showMaximized();
381 bool ret = exec(); 390 bool ret = exec();
382 if ( ret ) writeSettings(); 391 if ( ret ) writeSettings();
383 else readSettings(); 392 else readSettings();
384 return ret; 393 return ret;
385} 394}
386 395
387QString PackageManagerSettings::getDestinationName() 396QString PackageManagerSettings::getDestinationName()
388{ 397{
389 return activeDestination->currentText(); 398 return activeDestination->currentText();
390} 399}
391 400
392QString PackageManagerSettings::getLinkDestinationName() 401QString PackageManagerSettings::getLinkDestinationName()
393{ 402{
394 return activeLinkDestination->currentText(); 403 return activeLinkDestination->currentText();
395} 404}
396 405
397/** Returns the URL of the active destination */ 406/** Returns the URL of the active destination */
398QString PackageManagerSettings::getDestinationUrl() 407QString PackageManagerSettings::getDestinationUrl()
399{ 408{
400 int dnr = activeDestination->currentItem(); 409 int dnr = activeDestination->currentItem();
401 return *destinationurlDic.find(dnr); 410 return *destinationurlDic.find(dnr);
402} 411}
403 412
404/** Should oipkg create links form install destination to link destination */ 413/** Should oipkg create links form install destination to link destination */
405bool PackageManagerSettings::createLinks() 414bool PackageManagerSettings::createLinks()
406{ 415{
407 return CheckBoxLink->isChecked(); 416 return CheckBoxLink->isChecked();
408} 417}
409 418
410/** get the servers that are active */ 419/** get the servers that are active */
411QStringList PackageManagerSettings::getActiveServers() 420QStringList PackageManagerSettings::getActiveServers()
412{ 421{
413 QStringList sl; 422 QStringList sl;
414 for (int i=0; i<(int)activeServers->count(); i++) 423 for (int i=0; i<(int)activeServers->count(); i++)
415 { 424 {
416 if ( activeServers->isSelected(i) ) 425 if ( activeServers->isSelected(i) )
417 sl += activeServers->text(i); 426 sl += activeServers->text(i);
418 } 427 }
419 return sl; 428 return sl;
420} 429}
421 430
422/** returns the destination listed in ipkg.conf */ 431/** returns the destination listed in ipkg.conf */
423QStringList PackageManagerSettings::getDestinationUrls() 432QStringList PackageManagerSettings::getDestinationUrls()
424{ 433{
425 QStringList sl; 434 QStringList sl;
426 for (int i=0; i<(int)destinations->count(); i++) 435 for (int i=0; i<(int)destinations->count(); i++)
427 { 436 {
428 sl += *destinationurlDic[i]; 437 sl += *destinationurlDic[i];
429 } 438 }
430 return sl; 439 return sl;
431} 440}
432 441
433void PackageManagerSettings::linkEnabled( bool b ) 442void PackageManagerSettings::linkEnabled( bool b )
434{ 443{
435 activeLinkDestination->setEnabled( b ); 444 activeLinkDestination->setEnabled( b );
436} 445}
437 446
438void PackageManagerSettings::activeDestinationChange(int i) 447void PackageManagerSettings::activeDestinationChange(int i)
439{ 448{
440 activeLinkDestination->setCurrentItem( i ); 449 activeLinkDestination->setCurrentItem( i );
441} \ No newline at end of file 450} \ No newline at end of file
diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h
index 9cb7a9b..44459b2 100644
--- a/noncore/unsupported/oipkg/settings.h
+++ b/noncore/unsupported/oipkg/settings.h
@@ -1,67 +1,75 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. *
7 * *
8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
1#ifndef PACKAGEMANAGERSETTINGS_H 10#ifndef PACKAGEMANAGERSETTINGS_H
2#define PACKAGEMANAGERSETTINGS_H 11#define PACKAGEMANAGERSETTINGS_H
3 12
4#include "pksettingsbase.h" 13#include "pksettingsbase.h"
5#include <qintdict.h> 14#include <qintdict.h>
6 15
7 16
8class PackageManagerSettings : public PackageManagerSettingsBase 17class PackageManagerSettings : public PackageManagerSettingsBase
9//class PackageManagerSettings : private PackageManagerSettingsBase
10{ 18{
11 Q_OBJECT 19 Q_OBJECT
12public: 20public:
13 PackageManagerSettings( QWidget* , const char* , WFlags ); 21 PackageManagerSettings( QWidget* , const char* , WFlags );
14 ~PackageManagerSettings(); 22 ~PackageManagerSettings();
15 23
16 bool showDialog( int ) ; 24 bool showDialog( int ) ;
17 QString getDestinationUrl(); 25 QString getDestinationUrl();
18 QString getDestinationName(); 26 QString getDestinationName();
19 QString getLinkDestinationName(); 27 QString getLinkDestinationName();
20 bool createLinks(); 28 bool createLinks();
21 QStringList getActiveServers(); 29 QStringList getActiveServers();
22 QStringList getDestinationUrls(); 30 QStringList getDestinationUrls();
23 31
24public slots: /** No descriptions */ 32public slots: /** No descriptions */
25 void createLinks(); 33 void createLinks();
26 void removeLinks(); 34 void removeLinks();
27 void writeInstallationSettings(); 35 void writeInstallationSettings();
28 void readInstallationSettings(); 36 void readInstallationSettings();
29 void writeCurrentInstallationSetting(); 37 void writeCurrentInstallationSetting();
30 void readInstallationSetting(int); 38 void readInstallationSetting(int);
31 void installationSettingSetName(const QString &); 39 void installationSettingSetName(const QString &);
32 void activeDestinationChange(int) 40 void activeDestinationChange(int)
33 void newServer(); 41 void newServer();
34 void editServer(int); 42 void editServer(int);
35 void removeDestination(); 43 void removeDestination();
36 void newDestination(); 44 void newDestination();
37 void editDestination(int); 45 void editDestination(int);
38 void linkEnabled(bool); 46 void linkEnabled(bool);
39 void removeServer(); 47 void removeServer();
40 void serverNameChanged(const QString&); 48 void serverNameChanged(const QString&);
41 void serverUrlChanged(const QString&); 49 void serverUrlChanged(const QString&);
42 void destNameChanged(const QString&); 50 void destNameChanged(const QString&);
43 void destUrlChanged(const QString&); 51 void destUrlChanged(const QString&);
44 void installationSettingChange(int); 52 void installationSettingChange(int);
45 void newInstallationSetting(); 53 void newInstallationSetting();
46 void removeInstallationSetting(); 54 void removeInstallationSetting();
47 void renameInstallationSetting(); 55 void renameInstallationSetting();
48 56
49private: 57private:
50 QIntDict<QString> serverurlDic; 58 QIntDict<QString> serverurlDic;
51 QIntDict<QString> destinationurlDic; 59 QIntDict<QString> destinationurlDic;
52 int ipkg_old; 60 int ipkg_old;
53 int editedserver; 61 int editedserver;
54 int editeddestination; 62 int editeddestination;
55 int currentSetting; 63 int currentSetting;
56 int installationSettingsCount; 64 int installationSettingsCount;
57 bool changed; 65 bool changed;
58 bool serverChanged; 66 bool serverChanged;
59 67
60 bool readIpkgConfig(const QString&); 68 bool readIpkgConfig(const QString&);
61 void writeIpkgConfig(const QString&); 69 void writeIpkgConfig(const QString&);
62 void writeSettings(); 70 void writeSettings();
63 void readSettings(); 71 void readSettings();
64}; 72};
65 73
66#endif 74#endif
67 75