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