summaryrefslogtreecommitdiff
authordrw <drw>2005-02-22 22:25:39 (UTC)
committer drw <drw>2005-02-22 22:25:39 (UTC)
commit504c5f59c082106028e3dbc9126d7b655908224f (patch) (unidiff)
tree2cf4465cb2a46b0d13f909d073225585ad4e5092
parenta2eea1c6273acd16fed2406493923c52fba19ebc (diff)
downloadopie-504c5f59c082106028e3dbc9126d7b655908224f.zip
opie-504c5f59c082106028e3dbc9126d7b655908224f.tar.gz
opie-504c5f59c082106028e3dbc9126d7b655908224f.tar.bz2
Add support for lists_dir ipkg configuration option, optimize ipkg configuration file read routine, update version to 0.6.2
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/ChangeLog7
-rw-r--r--noncore/settings/packagemanager/README6
-rw-r--r--noncore/settings/packagemanager/TODO6
-rw-r--r--noncore/settings/packagemanager/oconfitem.h2
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp117
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.cpp138
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.h7
-rw-r--r--noncore/settings/packagemanager/opie-packagemanager.control2
8 files changed, 177 insertions, 108 deletions
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog
index 38756b1..92b542c 100644
--- a/noncore/settings/packagemanager/ChangeLog
+++ b/noncore/settings/packagemanager/ChangeLog
@@ -1,65 +1,72 @@
12005-02-22 Dan Williams <drw@handhelds.org>
2
3 * Released version 0.6.2
4 * Added support for ipkg configuration option, 'lists_dir'
5 * Make app depend on libipkg-0.99.143, or greater
6 * Optimize ipkg configuration file read routine
7
12005-02-16 Dan Williams <drw@handhelds.org> 82005-02-16 Dan Williams <drw@handhelds.org>
2 9
3 * Fixed stupid bug where last package in status file was not shown as installed when it should be 10 * Fixed stupid bug where last package in status file was not shown as installed when it should be
4 * Removed printf's 11 * Removed printf's
5 12
62005-01-02 Dan Williams <drw@handhelds.org> 132005-01-02 Dan Williams <drw@handhelds.org>
7 14
8 * Released version 0.6.1 15 * Released version 0.6.1
9 * Implemented native package linking code to remove need for ipkg-link 16 * Implemented native package linking code to remove need for ipkg-link
10 * Implement package in OIpkg (removed from InstallDlg) as this is ipkg specific 17 * Implement package in OIpkg (removed from InstallDlg) as this is ipkg specific
11 * Many small code tweaks 18 * Many small code tweaks
12 19
132004-12-21 Dan Williams <drw@handhelds.org> 202004-12-21 Dan Williams <drw@handhelds.org>
14 21
15 * Released version 0.6.0 22 * Released version 0.6.0
16 * Added support for Ipkg 'src/gz' feeds 23 * Added support for Ipkg 'src/gz' feeds
17 * Improve server and destination tabs UI's in configuration dialog 24 * Improve server and destination tabs UI's in configuration dialog
18 * Fix app linking to link all dependent packages as well as selected packages 25 * Fix app linking to link all dependent packages as well as selected packages
19 * Hide 'Retrive File List' button once list is retrieved in Package Info dialog 26 * Hide 'Retrive File List' button once list is retrieved in Package Info dialog
20 27
212004-11-18 Dan Williams <drw@handhelds.org> 282004-11-18 Dan Williams <drw@handhelds.org>
22 29
23 * Released version 0.5.0 30 * Released version 0.5.0
24 * All v1.0 functionality implemented 31 * All v1.0 functionality implemented
25 * Implemented installation of local packages 32 * Implemented installation of local packages
26 * Implemented linking of non-root apps (using ipkg-link) 33 * Implemented linking of non-root apps (using ipkg-link)
27 * Many UI tweaks for installation and filter dialogs 34 * Many UI tweaks for installation and filter dialogs
28 35
292004-04-21 Dan Williams <drw@handhelds.org> 362004-04-21 Dan Williams <drw@handhelds.org>
30 37
31 * Released version 0.4.0 38 * Released version 0.4.0
32 * Added saving of ipkg configuration information 39 * Added saving of ipkg configuration information
33 * Re-initialize ipkg when configuration information changes 40 * Re-initialize ipkg when configuration information changes
34 * Added QWhatsThis for all UI controls 41 * Added QWhatsThis for all UI controls
35 * Remove Location from OConfItem as it is not used/needed 42 * Remove Location from OConfItem as it is not used/needed
36 * Re-ordered includes to follow Opie standards 43 * Re-ordered includes to follow Opie standards
37 44
382004-02-13 Dan Williams <drw@handhelds.org> 452004-02-13 Dan Williams <drw@handhelds.org>
39 46
40 * Released version 0.3.0 47 * Released version 0.3.0
41 * Fix handling of filtering options in View menu 48 * Fix handling of filtering options in View menu
42 * Do proper version string comparison 49 * Do proper version string comparison
43 * Fix string alignment code in PromptDlg to eliminate QT warning messages 50 * Fix string alignment code in PromptDlg to eliminate QT warning messages
44 51
452004-02-12 Dan Williams <drw@handhelds.org> 522004-02-12 Dan Williams <drw@handhelds.org>
46 53
47 * Package information dialog implemented 54 * Package information dialog implemented
48 * What's This app icon enabled 55 * What's This app icon enabled
49 * Changed all QDialog::exec() occurences to QPEApplication::execDialog() 56 * Changed all QDialog::exec() occurences to QPEApplication::execDialog()
50 57
512004-01-23 Dan Williams <drw@handhelds.org> 582004-01-23 Dan Williams <drw@handhelds.org>
52 59
53 * Added package download functionality 60 * Added package download functionality
54 * Have Opie update links after install/removal so that apps 61 * Have Opie update links after install/removal so that apps
55 will display properly in Launcher 62 will display properly in Launcher
56 63
572004-01-20 Dan Williams <drw@handhelds.org> 642004-01-20 Dan Williams <drw@handhelds.org>
58 65
59 * Released version 0.2.0 66 * Released version 0.2.0
60 * Converted to use libipkg in place of spawning ipkg process 67 * Converted to use libipkg in place of spawning ipkg process
61 68
622004-01-13 Dan Williams <drw@handhelds.org> 692004-01-13 Dan Williams <drw@handhelds.org>
63 70
64 * Released version 0.1.0 71 * Released version 0.1.0
65 * Initial check-in of new package management client to eventually replace AQPkg 72 * Initial check-in of new package management client to eventually replace AQPkg
diff --git a/noncore/settings/packagemanager/README b/noncore/settings/packagemanager/README
index ff6d113..9720cb4 100644
--- a/noncore/settings/packagemanager/README
+++ b/noncore/settings/packagemanager/README
@@ -1,55 +1,55 @@
1/************************************************************************ 1/************************************************************************
2/* 2/*
3/* Opie - Package Manager 3/* Opie - Package Manager
4/* ======================== 4/* ========================
5/* Version 0.6.0 5/* Version 0.6.2
6/* 6/*
7/* A package management client for Opie 7/* A package management client for Opie
8/* 8/*
9/************************************************************************ 9/************************************************************************
10 10
11------------------------------------------------------- 11-------------------------------------------------------
12 Release Notes for Opie-PackageManager - January, 2004 12 Release Notes for Opie-PackageManager - February, 2004
13------------------------------------------------------- 13-------------------------------------------------------
14 14
15====================== 15======================
16= To-do = 16= To-do =
17====================== 17======================
18 18
19- See $OPIEDIR/noncore/settings/packagemanager/TODO for more info. 19- See $OPIEDIR/noncore/settings/packagemanager/TODO for more info.
20 20
21====================== 21======================
22= Build = 22= Build =
23====================== 23======================
24 24
25In order to build opie-packagemanager, libipkg needs to be present on 25In order to build opie-packagemanager, libipkg needs to be present on
26the build system along with the appropriate headers. 26the build system along with the appropriate headers.
27 27
28- libipkg source (best to use version 109 or greater): 28- libipkg source (best to use version 109 or greater):
29 - Familiar CVS directory: familiar/dist/ipkg/C (e.g. 'cvs co familiar/dist/ipkg/C') 29 - Familiar CVS directory: familiar/dist/ipkg/C (e.g. 'cvs co familiar/dist/ipkg/C')
30 - FTP: ftp://handhelds.org/linux/packages/ipkg 30 - FTP: ftp://handhelds.org/linux/packages/ipkg
31 31
32- before building opie-packagemanager, define the environmental variable 32- before building opie-packagemanager, define the environmental variable
33 IPKGDIR to point to the directory containing the ipkg source code 33 IPKGDIR to point to the directory containing the ipkg source code
34 - e.g. 'export IPKGDIR=$HOME/familiar/dist/ipkg/C' 34 - e.g. 'export IPKGDIR=$HOME/familiar/dist/ipkg/C'
35 35
36====================== 36======================
37= Run = 37= Run =
38====================== 38======================
39 39
40- In order to use opie-packagemanager, libipkg must be installed 40- In order to use opie-packagemanager, libipkg must be installed
41 on the system. 41 on the system.
42 42
43====================== 43======================
44= Credits = 44= Credits =
45====================== 45======================
46 46
47- Opie-PackageManager is (C) 2003-2004 Dan Williams 47- Opie-PackageManager is (C) 2003-2005 Dan Williams
48 48
49====================== 49======================
50= Links = 50= Links =
51====================== 51======================
52 52
53- Opie Project: http://opie.handhelds.org 53- Opie Project: http://opie.handhelds.org
54- OpenZaurus Project: http://openzaurus.org 54- OpenZaurus Project: http://openzaurus.org
55- Familiar Project: http://familiar.handhelds.org 55- Familiar Project: http://familiar.handhelds.org
diff --git a/noncore/settings/packagemanager/TODO b/noncore/settings/packagemanager/TODO
index 2512624..dd70b11 100644
--- a/noncore/settings/packagemanager/TODO
+++ b/noncore/settings/packagemanager/TODO
@@ -1,15 +1,13 @@
1/************************************************************************ 1/************************************************************************
2/* 2/*
3/* Opie - Package Manager 3/* Opie - Package Manager
4/* ======================== 4/* ========================
5/* Version 0.6.1 5/* Version 0.6.2
6/* 6/*
7/* A package management client for Opie 7/* A package management client for Opie
8/* 8/*
9/************************************************************************ 9/************************************************************************
10 10
11----------------------------------------------- 11-----------------------------------------------
12 To-do for Opie-PackageManager - January, 2005 12 To-do for Opie-PackageManager - February, 2005
13----------------------------------------------- 13-----------------------------------------------
14
151. Re-work package download dialog
diff --git a/noncore/settings/packagemanager/oconfitem.h b/noncore/settings/packagemanager/oconfitem.h
index 9972c00..b306e93 100644
--- a/noncore/settings/packagemanager/oconfitem.h
+++ b/noncore/settings/packagemanager/oconfitem.h
@@ -1,96 +1,96 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 3
4 Copyright (c) 2003 Dan Williams <drw@handhelds.org> 4 Copyright (c) 2003 Dan Williams <drw@handhelds.org>
5 =. 5 =.
6 .=l. 6 .=l.
7 .>+-= 7 .>+-=
8_;:, .> :=|. This program is free software; you can 8_;:, .> :=|. This program is free software; you can
9.> <`_, > . <= redistribute it and/or modify it under 9.> <`_, > . <= redistribute it and/or modify it under
10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
11.="- .-=="i, .._ License as published by the Free Software 11.="- .-=="i, .._ License as published by the Free Software
12- . .-<_> .<> Foundation; either version 2 of the License, 12- . .-<_> .<> Foundation; either version 2 of the License,
13 ._= =} : or (at your option) any later version. 13 ._= =} : or (at your option) any later version.
14 .%`+i> _;_. 14 .%`+i> _;_.
15 .i_,=:_. -<s. This program is distributed in the hope that 15 .i_,=:_. -<s. This program is distributed in the hope that
16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
17 : .. .:, . . . without even the implied warranty of 17 : .. .:, . . . without even the implied warranty of
18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.= = ; Library General Public License for more 20..}^=.= = ; Library General Public License for more
21++= -. .` .: details. 21++= -. .` .: details.
22: = ...= . :.=- 22: = ...= . :.=-
23-. .:....=;==+<; You should have received a copy of the GNU 23-. .:....=;==+<; You should have received a copy of the GNU
24 -_. . . )=. = Library General Public License along with 24 -_. . . )=. = Library General Public License along with
25 -- :-=` this library; see the file COPYING.LIB. 25 -- :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#ifndef OCONFITEM_H 32#ifndef OCONFITEM_H
33#define OCONFITEM_H 33#define OCONFITEM_H
34 34
35#include <qlist.h> 35#include <qlist.h>
36#include <qstring.h> 36#include <qstring.h>
37 37
38class OConfItem 38class OConfItem
39{ 39{
40public: 40public:
41 enum Type { Source, Destination, Option, Arch, NotDefined }; 41 enum Type { Source, Destination, Option, Arch, Other, NotDefined };
42 42
43 OConfItem( Type type = NotDefined, const QString &name = QString::null, 43 OConfItem( Type type = NotDefined, const QString &name = QString::null,
44 const QString &value = QString::null, const QString &features = QString::null, 44 const QString &value = QString::null, const QString &features = QString::null,
45 bool active = true ); 45 bool active = true );
46 46
47 Type type() { return m_type; } 47 Type type() { return m_type; }
48 const QString &name() { return m_name; } 48 const QString &name() { return m_name; }
49 const QString &value() { return m_value; } 49 const QString &value() { return m_value; }
50 const QString &features() { return m_features; } 50 const QString &features() { return m_features; }
51 bool active() { return m_active; } 51 bool active() { return m_active; }
52 52
53 void setType( Type type ) { m_type = type; } 53 void setType( Type type ) { m_type = type; }
54 void setName( const QString &name ) { m_name = name; } 54 void setName( const QString &name ) { m_name = name; }
55 void setValue( const QString &value ) { m_value = value; } 55 void setValue( const QString &value ) { m_value = value; }
56 void setFeatures( const QString &features ) { m_features = features; } 56 void setFeatures( const QString &features ) { m_features = features; }
57 void setActive( bool active ) { m_active = active; } 57 void setActive( bool active ) { m_active = active; }
58 58
59private: 59private:
60 Type m_type; // Type of configuration item 60 Type m_type; // Type of configuration item
61 QString m_name; // Name of item 61 QString m_name; // Name of item
62 QString m_value; // Value of item 62 QString m_value; // Value of item
63 QString m_features; // Comma-deliminated list of features this item supports 63 QString m_features; // Comma-deliminated list of features this item supports
64 bool m_active; // Indicates whether item is currently active 64 bool m_active; // Indicates whether item is currently active
65}; 65};
66 66
67class OConfItemList : public QList<OConfItem> 67class OConfItemList : public QList<OConfItem>
68{ 68{
69private: 69private:
70 70
71 int compareItems( QCollection::Item item1, QCollection::Item item2 ) 71 int compareItems( QCollection::Item item1, QCollection::Item item2 )
72 { 72 {
73 // Sort by OConfItem location then by type 73 // Sort by OConfItem location then by type
74 OConfItem::Type type1 = reinterpret_cast<OConfItem*>(item1)->type(); 74 OConfItem::Type type1 = reinterpret_cast<OConfItem*>(item1)->type();
75 OConfItem::Type type2 = reinterpret_cast<OConfItem*>(item2)->type(); 75 OConfItem::Type type2 = reinterpret_cast<OConfItem*>(item2)->type();
76 if ( type1 < type2 ) 76 if ( type1 < type2 )
77 return -1; 77 return -1;
78 else if ( type1 == type2 ) 78 else if ( type1 == type2 )
79 { 79 {
80 QString name1 = reinterpret_cast<OConfItem*>(item1)->name(); 80 QString name1 = reinterpret_cast<OConfItem*>(item1)->name();
81 QString name2 = reinterpret_cast<OConfItem*>(item2)->name(); 81 QString name2 = reinterpret_cast<OConfItem*>(item2)->name();
82 if ( name1 < name2 ) 82 if ( name1 < name2 )
83 return -1; 83 return -1;
84 else if ( name1 == name2 ) 84 else if ( name1 == name2 )
85 return 0; 85 return 0;
86 else /*if ( name1 > name2 )*/ 86 else /*if ( name1 > name2 )*/
87 return 1; 87 return 1;
88 } 88 }
89 else /*if ( type1 > type2 )*/ 89 else /*if ( type1 > type2 )*/
90 return 1; 90 return 1;
91 } 91 }
92}; 92};
93 93
94typedef QListIterator<OConfItem> OConfItemListIterator; 94typedef QListIterator<OConfItem> OConfItemListIterator;
95 95
96#endif 96#endif
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp
index e7e292e..3d2c621 100644
--- a/noncore/settings/packagemanager/oipkg.cpp
+++ b/noncore/settings/packagemanager/oipkg.cpp
@@ -1,769 +1,794 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 3
4 Copyright (c) 2003 Dan Williams <drw@handhelds.org> 4 Copyright (c) 2003 Dan Williams <drw@handhelds.org>
5 =. 5 =.
6 .=l. 6 .=l.
7 .>+-= 7 .>+-=
8_;:, .> :=|. This program is free software; you can 8_;:, .> :=|. This program is free software; you can
9.> <`_, > . <= redistribute it and/or modify it under 9.> <`_, > . <= redistribute it and/or modify it under
10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
11.="- .-=="i, .._ License as published by the Free Software 11.="- .-=="i, .._ License as published by the Free Software
12- . .-<_> .<> Foundation; either version 2 of the License, 12- . .-<_> .<> Foundation; either version 2 of the License,
13 ._= =} : or (at your option) any later version. 13 ._= =} : or (at your option) any later version.
14 .%`+i> _;_. 14 .%`+i> _;_.
15 .i_,=:_. -<s. This program is distributed in the hope that 15 .i_,=:_. -<s. This program is distributed in the hope that
16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
17 : .. .:, . . . without even the implied warranty of 17 : .. .:, . . . without even the implied warranty of
18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.= = ; Library General Public License for more 20..}^=.= = ; Library General Public License for more
21++= -. .` .: details. 21++= -. .` .: details.
22: = ...= . :.=- 22: = ...= . :.=-
23-. .:....=;==+<; You should have received a copy of the GNU 23-. .:....=;==+<; You should have received a copy of the GNU
24 -_. . . )=. = Library General Public License along with 24 -_. . . )=. = Library General Public License along with
25 -- :-=` this library; see the file COPYING.LIB. 25 -- :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#include "oipkg.h" 32#include "oipkg.h"
33 33
34#include <qdir.h> 34#include <qdir.h>
35#include <qfile.h> 35#include <qfile.h>
36#include <qtextstream.h> 36#include <qtextstream.h>
37 37
38#include <stdlib.h> 38#include <stdlib.h>
39#include <unistd.h> 39#include <unistd.h>
40 40
41const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file 41const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file
42const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files 42const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files
43const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists 43const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists
44const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location 44const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location
45const QString IPKG_INFO_PATH = "usr/lib/ipkg/info"; // Package file lists location 45const QString IPKG_INFO_PATH = "usr/lib/ipkg/info"; // Package file lists location
46 46
47OIpkg *oipkg; 47OIpkg *oipkg;
48 48
49// Ipkg callback functions 49// Ipkg callback functions
50 50
51int fsignalIpkgMessage( ipkg_conf_t *conf, message_level_t level, char *msg ) 51int fsignalIpkgMessage( ipkg_conf_t *conf, message_level_t level, char *msg )
52{ 52{
53 // Display message only if it is below the message level threshold 53 // Display message only if it is below the message level threshold
54 if ( conf && ( conf->verbosity < level ) ) 54 if ( conf && ( conf->verbosity < level ) )
55 return 0; 55 return 0;
56 else 56 else
57 oipkg->ipkgMessage( msg ); 57 oipkg->ipkgMessage( msg );
58 58
59 return 0; 59 return 0;
60} 60}
61 61
62char *fIpkgResponse( char */*question*/ ) 62char *fIpkgResponse( char */*question*/ )
63{ 63{
64 return 0l; 64 return 0l;
65} 65}
66 66
67int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) 67int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ )
68{ 68{
69 oipkg->ipkgStatus( desc ); 69 oipkg->ipkgStatus( desc );
70 return 0; 70 return 0;
71} 71}
72 72
73int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/, 73int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/,
74 void */*userdata*/ ) 74 void */*userdata*/ )
75{ 75{
76 oipkg->ipkgList( desc ); 76 oipkg->ipkgList( desc );
77 return 0; 77 return 0;
78} 78}
79 79
80OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) 80OIpkg::OIpkg( Config *config, QObject *parent, const char *name )
81 : QObject( parent, name ) 81 : QObject( parent, name )
82 , m_config( config ) 82 , m_config( config )
83 , m_confInfo( NULL ) 83 , m_confInfo( NULL )
84 , m_ipkgExecOptions( 0 ) 84 , m_ipkgExecOptions( 0 )
85 , m_ipkgExecVerbosity( 1 ) 85 , m_ipkgExecVerbosity( 1 )
86{ 86{
87 // Keep pointer to self for the Ipkg callback functions 87 // Keep pointer to self for the Ipkg callback functions
88 oipkg = this; 88 oipkg = this;
89 89
90 // Initialize libipkg 90 // Initialize libipkg
91 ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); 91 ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs );
92 92
93 // Default ipkg run-time arguments 93 // Default ipkg run-time arguments
94 m_ipkgArgs.noaction = false; 94 m_ipkgArgs.noaction = false;
95 m_ipkgArgs.force_defaults = true; 95 m_ipkgArgs.force_defaults = true;
96} 96}
97 97
98OIpkg::~OIpkg() 98OIpkg::~OIpkg()
99{ 99{
100 // Upon destruction, ensure that items in config list are deleted with list 100 // Upon destruction, ensure that items in config list are deleted with list
101 if ( m_confInfo ) 101 if ( m_confInfo )
102 m_confInfo->setAutoDelete( true ); 102 m_confInfo->setAutoDelete( true );
103 103
104 // Free up libipkg resources 104 // Free up libipkg resources
105 ipkg_deinit( &m_ipkgArgs ); 105 ipkg_deinit( &m_ipkgArgs );
106} 106}
107 107
108OConfItemList *OIpkg::configItems() 108OConfItemList *OIpkg::configItems()
109{ 109{
110 // Retrieve all configuration items 110 // Retrieve all configuration items
111 return filterConfItems(); 111 return filterConfItems();
112} 112}
113 113
114OConfItemList *OIpkg::servers() 114OConfItemList *OIpkg::servers()
115{ 115{
116 // Retrieve only servers 116 // Retrieve only servers
117 return filterConfItems( OConfItem::Source ); 117 return filterConfItems( OConfItem::Source );
118} 118}
119 119
120OConfItemList *OIpkg::destinations() 120OConfItemList *OIpkg::destinations()
121{ 121{
122 // Retrieve only destinations 122 // Retrieve only destinations
123 return filterConfItems( OConfItem::Destination ); 123 return filterConfItems( OConfItem::Destination );
124} 124}
125 125
126OConfItemList *OIpkg::options() 126OConfItemList *OIpkg::options()
127{ 127{
128 // Retrieve only destinations 128 // Retrieve only destinations
129 return filterConfItems( OConfItem::Option ); 129 return filterConfItems( OConfItem::Option );
130} 130}
131 131
132void OIpkg::setConfigItems( OConfItemList *configList ) 132void OIpkg::setConfigItems( OConfItemList *configList )
133{ 133{
134 if ( m_confInfo ) 134 if ( m_confInfo )
135 delete m_confInfo; 135 delete m_confInfo;
136 136
137 m_confInfo = configList; 137 m_confInfo = configList;
138 138
139 // Write out new /etc/ipkg.conf 139 // Write out new /etc/ipkg.conf
140 QFile confFile( IPKG_CONF ); 140 QFile confFile( IPKG_CONF );
141 if ( confFile.open( IO_WriteOnly ) ) 141 if ( confFile.open( IO_WriteOnly ) )
142 { 142 {
143 QTextStream confStream( &confFile ); 143 QTextStream confStream( &confFile );
144 confStream << "# Generated by Opie Package Manager\n\n"; 144 confStream << "# Generated by Opie Package Manager\n\n";
145 145
146 OConfItemListIterator it( *m_confInfo ); 146 OConfItemListIterator it( *m_confInfo );
147 for ( ; it.current(); ++it ) 147 for ( ; it.current(); ++it )
148 { 148 {
149 OConfItem *item = it.current(); 149 OConfItem *item = it.current();
150 150
151 // Only write out valid conf items 151 // Only write out valid conf items
152 if ( item->type() != OConfItem::NotDefined ) 152 if ( item->type() != OConfItem::NotDefined )
153 { 153 {
154 QString confLine; 154 QString confLine;
155 QString name = item->name();
155 if ( !item->active() ) 156 if ( !item->active() )
156 confLine = "#"; 157 confLine = "#";
157 158
158 switch ( item->type() ) 159 switch ( item->type() )
159 { 160 {
160 case OConfItem::Source : 161 case OConfItem::Source :
161 { 162 {
162 if ( item->features().contains( "Compressed" ) ) 163 if ( item->features().contains( "Compressed" ) )
163 confLine.append( "src/gz " ); 164 confLine.append( "src/gz" );
164 else 165 else
165 confLine.append( "src " ); 166 confLine.append( "src" );
167 }
168 break;
169 case OConfItem::Destination : confLine.append( "dest" ); break;
170 case OConfItem::Option : confLine.append( "option" ); break;
171 case OConfItem::Arch : confLine.append( "arch" ); break;
172 case OConfItem::Other :
173 {
174 // For options w/type = Other, the mapping is as follows:
175 // name = typeStr (e.g. "lists_dir")
176 // value = value
177 // features = name (from configuration file)
178 confLine.append( item->name() );
179 name = item->features();
166 } 180 }
167 break; 181 break;
168 case OConfItem::Destination : confLine.append( "dest " ); break;
169 case OConfItem::Option : confLine.append( "option " ); break;
170 case OConfItem::Arch : confLine.append( "arch " ); break;
171 default : break; 182 default : break;
172 }; 183 };
173 184
174 confStream << confLine << " " << item->name() << " " << item->value() << "\n"; 185 confStream << confLine << " " << name << " " << item->value() << "\n";
175 } 186 }
176 } 187 }
177 188
178 confFile.close(); 189 confFile.close();
179 } 190 }
180 else 191 else
181 { 192 {
182 // Problem writing to /etc/ipkg.conf, exit before removing other conf files 193 // Problem writing to /etc/ipkg.conf, exit before removing other conf files
183 return; 194 return;
184 } 195 }
185 196
186 // Delete /etc/ipkg/*.conf files (/etc/ipkg.conf should now have all settings 197 // Delete /etc/ipkg/*.conf files (/etc/ipkg.conf should now have all settings
187 QStringList confFiles; 198 QStringList confFiles;
188 QDir confDir( IPKG_CONF_DIR ); 199 QDir confDir( IPKG_CONF_DIR );
189 if ( confDir.exists() ) 200 if ( confDir.exists() )
190 { 201 {
191 confDir.setNameFilter( "*.conf" ); 202 confDir.setNameFilter( "*.conf" );
192 confDir.setFilter( QDir::Files ); 203 confDir.setFilter( QDir::Files );
193 confFiles = confDir.entryList( "*.conf", QDir::Files ); 204 confFiles = confDir.entryList( "*.conf", QDir::Files );
194 205
195 QStringList::Iterator lastFile = confFiles.end(); 206 QStringList::Iterator lastFile = confFiles.end();
196 for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it ) 207 for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it )
197 { 208 {
198 // Create absolute file path if necessary 209 // Create absolute file path if necessary
199 QString absFile = (*it); 210 QString absFile = (*it);
200 if ( !absFile.startsWith( "/" ) ) 211 if ( !absFile.startsWith( "/" ) )
201 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); 212 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" );
202 213
203 // Delete file 214 // Delete file
204 QFile::remove( absFile ); 215 QFile::remove( absFile );
205 } 216 }
206 } 217 }
207 218
208 // Reinitialize libipkg to pick up new configuration 219 // Reinitialize libipkg to pick up new configuration
209 ipkg_deinit( &m_ipkgArgs ); 220 ipkg_deinit( &m_ipkgArgs );
210 ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); 221 ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs );
211 m_ipkgArgs.noaction = false; 222 m_ipkgArgs.noaction = false;
212 m_ipkgArgs.force_defaults = true; 223 m_ipkgArgs.force_defaults = true;
213} 224}
214 225
215void OIpkg::saveSettings() 226void OIpkg::saveSettings()
216{ 227{
217 // Save Ipkg execution options to application configuration file 228 // Save Ipkg execution options to application configuration file
218 if ( m_config ) 229 if ( m_config )
219 { 230 {
220 m_config->setGroup( "Ipkg" ); 231 m_config->setGroup( "Ipkg" );
221 m_config->writeEntry( "ExecOptions", m_ipkgExecOptions ); 232 m_config->writeEntry( "ExecOptions", m_ipkgExecOptions );
222 m_config->writeEntry( "Verbosity", m_ipkgExecVerbosity ); 233 m_config->writeEntry( "Verbosity", m_ipkgExecVerbosity );
223 } 234 }
224} 235}
225 236
226OPackageList *OIpkg::availablePackages( const QString &server ) 237OPackageList *OIpkg::availablePackages( const QString &server )
227{ 238{
228 // Load Ipkg configuration info if not already cached 239 // Load Ipkg configuration info if not already cached
229 if ( !m_confInfo ) 240 if ( !m_confInfo )
230 loadConfiguration(); 241 loadConfiguration();
231 242
232 // Build new server list (caller is responsible for deleting) 243 // Build new server list (caller is responsible for deleting)
233 OPackageList *pl = new OPackageList; 244 OPackageList *pl = new OPackageList;
234 245
235 // Open package list file 246 // Open package list file
236 QFile f( IPKG_PKG_PATH + "/" + server ); 247 QFile f( IPKG_PKG_PATH + "/" + server );
237 if ( !f.open( IO_ReadOnly ) ) 248 if ( !f.open( IO_ReadOnly ) )
238 return NULL; 249 return NULL;
239 QTextStream t( &f ); 250 QTextStream t( &f );
240 251
241 // Process all information in package list file 252 // Process all information in package list file
242 OPackage *package = NULL; 253 OPackage *package = NULL;
243 QString line = t.readLine(); 254 QString line = t.readLine();
244 while ( !t.eof() ) 255 while ( !t.eof() )
245 { 256 {
246 // Determine key/value pair 257 // Determine key/value pair
247 int pos = line.find( ':', 0 ); 258 int pos = line.find( ':', 0 );
248 QString key; 259 QString key;
249 if ( pos > -1 ) 260 if ( pos > -1 )
250 key = line.mid( 0, pos ); 261 key = line.mid( 0, pos );
251 else 262 else
252 key = QString::null; 263 key = QString::null;
253 QString value = line.mid( pos+2, line.length()-pos ); 264 QString value = line.mid( pos+2, line.length()-pos );
254 265
255 // Allocate new package and insert into list 266 // Allocate new package and insert into list
256 if ( package == NULL && !key.isEmpty() ) 267 if ( package == NULL && !key.isEmpty() )
257 { 268 {
258 package = new OPackage( value ); 269 package = new OPackage( value );
259 package->setSource( server ); 270 package->setSource( server );
260 pl->append( package ); 271 pl->append( package );
261 } 272 }
262 273
263 // Update package data 274 // Update package data
264 if ( key == "Package" ) 275 if ( key == "Package" )
265 package->setName( value ); 276 package->setName( value );
266 else if ( key == "Version" ) 277 else if ( key == "Version" )
267 package->setVersion( value ); 278 package->setVersion( value );
268 else if ( key == "Section" ) 279 else if ( key == "Section" )
269 package->setCategory( value ); 280 package->setCategory( value );
270 //DataManager::setAvailableCategories( value ); 281 //DataManager::setAvailableCategories( value );
271 else if ( key.isEmpty() && value.isEmpty() ) 282 else if ( key.isEmpty() && value.isEmpty() )
272 package = NULL; 283 package = NULL;
273 284
274 // Skip past all description lines 285 // Skip past all description lines
275 if ( key == "Description" ) 286 if ( key == "Description" )
276 { 287 {
277 line = t.readLine(); 288 line = t.readLine();
278 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) 289 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() )
279 line = t.readLine(); 290 line = t.readLine();
280 } 291 }
281 else 292 else
282 line = t.readLine(); 293 line = t.readLine();
283 } 294 }
284 295
285 f.close(); 296 f.close();
286 297
287 return pl; 298 return pl;
288} 299}
289 300
290OPackageList *OIpkg::installedPackages( const QString &destName, const QString &destPath ) 301OPackageList *OIpkg::installedPackages( const QString &destName, const QString &destPath )
291{ 302{
292 // Load Ipkg configuration info if not already cached 303 // Load Ipkg configuration info if not already cached
293 if ( !m_confInfo ) 304 if ( !m_confInfo )
294 loadConfiguration(); 305 loadConfiguration();
295 306
296 // Build new server list (caller is responsible for deleting) 307 // Build new server list (caller is responsible for deleting)
297 OPackageList *pl = new OPackageList; 308 OPackageList *pl = new OPackageList;
298 309
299 // Open status file 310 // Open status file
300 QString path = destPath; 311 QString path = destPath;
301 if ( path.right( 1 ) != "/" ) 312 if ( path.right( 1 ) != "/" )
302 path.append( "/" ); 313 path.append( "/" );
303 path.append( IPKG_STATUS_PATH ); 314 path.append( IPKG_STATUS_PATH );
304 315
305 QFile f( path ); 316 QFile f( path );
306 if ( !f.open( IO_ReadOnly ) ) 317 if ( !f.open( IO_ReadOnly ) )
307 return NULL; 318 return NULL;
308 QTextStream t( &f ); 319 QTextStream t( &f );
309 320
310 // Process all information in status file 321 // Process all information in status file
311 bool newPackage = false; 322 bool newPackage = false;
312 QString line = t.readLine(); 323 QString line = t.readLine();
313 QString name; 324 QString name;
314 QString version; 325 QString version;
315 QString status; 326 QString status;
316 327
317 while ( !t.eof() ) 328 while ( !t.eof() )
318 { 329 {
319 // Determine key/value pair 330 // Determine key/value pair
320 int pos = line.find( ':', 0 ); 331 int pos = line.find( ':', 0 );
321 QString key; 332 QString key;
322 if ( pos > -1 ) 333 if ( pos > -1 )
323 key = line.mid( 0, pos ); 334 key = line.mid( 0, pos );
324 else 335 else
325 key = QString::null; 336 key = QString::null;
326 QString value = line.mid( pos+2, line.length()-pos ); 337 QString value = line.mid( pos+2, line.length()-pos );
327 338
328 // Allocate new package and insert into list 339 // Allocate new package and insert into list
329 if ( newPackage && !key.isEmpty() ) 340 if ( newPackage && !key.isEmpty() )
330 { 341 {
331 // Add to list only if it has a valid name and is installed 342 // Add to list only if it has a valid name and is installed
332 if ( !name.isNull() && status.contains( " installed" ) ) 343 if ( !name.isNull() && status.contains( " installed" ) )
333 { 344 {
334 pl->append( new OPackage( name, QString::null, version, QString::null, destName ) ); 345 pl->append( new OPackage( name, QString::null, version, QString::null, destName ) );
335 name = QString::null; 346 name = QString::null;
336 version = QString::null; 347 version = QString::null;
337 status = QString::null; 348 status = QString::null;
338 349
339 newPackage = false; 350 newPackage = false;
340 } 351 }
341 } 352 }
342 353
343 // Update package data 354 // Update package data
344 if ( key == "Package" ) 355 if ( key == "Package" )
345 name = value; 356 name = value;
346 else if ( key == "Version" ) 357 else if ( key == "Version" )
347 version = value; 358 version = value;
348 else if ( key == "Status" ) 359 else if ( key == "Status" )
349 status = value; 360 status = value;
350 else if ( key.isEmpty() && value.isEmpty() ) 361 else if ( key.isEmpty() && value.isEmpty() )
351 newPackage = true; 362 newPackage = true;
352 363
353 // Skip past all description lines 364 // Skip past all description lines
354 if ( key == "Description" ) 365 if ( key == "Description" )
355 { 366 {
356 line = t.readLine(); 367 line = t.readLine();
357 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) 368 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() )
358 line = t.readLine(); 369 line = t.readLine();
359 } 370 }
360 else 371 else
361 line = t.readLine(); 372 line = t.readLine();
362 } 373 }
363 374
364 f.close(); 375 f.close();
365 376
366 // Make sure to add to list last entry 377 // Make sure to add to list last entry
367 if ( !name.isNull() && status.contains( " installed" ) ) 378 if ( !name.isNull() && status.contains( " installed" ) )
368 pl->append( new OPackage( name, QString::null, version, QString::null, destName ) ); 379 pl->append( new OPackage( name, QString::null, version, QString::null, destName ) );
369 380
370 return pl; 381 return pl;
371} 382}
372 383
373OConfItem *OIpkg::findConfItem( OConfItem::Type type, const QString &name ) 384OConfItem *OIpkg::findConfItem( OConfItem::Type type, const QString &name )
374{ 385{
375 // Find configuration item in list 386 // Find configuration item in list
376 OConfItemListIterator configIt( *m_confInfo ); 387 OConfItemListIterator configIt( *m_confInfo );
377 OConfItem *config = 0l; 388 OConfItem *config = 0l;
378 for ( ; configIt.current(); ++configIt ) 389 for ( ; configIt.current(); ++configIt )
379 { 390 {
380 config = configIt.current(); 391 config = configIt.current();
381 if ( config->type() == type && config->name() == name ) 392 if ( config->type() == type && config->name() == name )
382 break; 393 break;
383 } 394 }
384 395
385 if ( config && config->type() == type && config->name() == name ) 396 if ( config && config->type() == type && config->name() == name )
386 return config; 397 return config;
387 398
388 return 0l; 399 return 0l;
389} 400}
390 401
391bool OIpkg::executeCommand( OPackage::Command command, const QStringList &parameters, const QString &destination, 402bool OIpkg::executeCommand( OPackage::Command command, const QStringList &parameters, const QString &destination,
392 const QObject *receiver, const char *slotOutput, bool rawOutput ) 403 const QObject *receiver, const char *slotOutput, bool rawOutput )
393{ 404{
394 if ( command == OPackage::NotDefined ) 405 if ( command == OPackage::NotDefined )
395 return false; 406 return false;
396 407
397 // Set ipkg run-time options/arguments 408 // Set ipkg run-time options/arguments
398 m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS ); 409 m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS );
399 m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL ); 410 m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL );
400 // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); 411 // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE );
401 m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE ); 412 m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE );
402 m_ipkgArgs.verbosity = m_ipkgExecVerbosity; 413 m_ipkgArgs.verbosity = m_ipkgExecVerbosity;
403 if ( m_ipkgArgs.dest ) 414 if ( m_ipkgArgs.dest )
404 free( m_ipkgArgs.dest ); 415 free( m_ipkgArgs.dest );
405 if ( !destination.isNull() ) 416 if ( !destination.isNull() )
406 { 417 {
407 int len = destination.length() + 1; 418 int len = destination.length() + 1;
408 m_ipkgArgs.dest = (char *)malloc( len ); 419 m_ipkgArgs.dest = (char *)malloc( len );
409 strncpy( m_ipkgArgs.dest, destination, destination.length() ); 420 strncpy( m_ipkgArgs.dest, destination, destination.length() );
410 m_ipkgArgs.dest[ len - 1 ] = '\0'; 421 m_ipkgArgs.dest[ len - 1 ] = '\0';
411 } 422 }
412 else 423 else
413 m_ipkgArgs.dest = 0l; 424 m_ipkgArgs.dest = 0l;
414 425
415 // Connect output signal to widget 426 // Connect output signal to widget
416 427
417 if ( !rawOutput ) 428 if ( !rawOutput )
418 { 429 {
419 // TODO - connect to local slot and parse output before emitting signalIpkgMessage 430 // TODO - connect to local slot and parse output before emitting signalIpkgMessage
420 } 431 }
421 432
422 switch( command ) 433 switch( command )
423 { 434 {
424 case OPackage::Update : { 435 case OPackage::Update : {
425 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); 436 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput );
426 ipkg_lists_update( &m_ipkgArgs ); 437 ipkg_lists_update( &m_ipkgArgs );
427 }; 438 };
428 break; 439 break;
429 case OPackage::Upgrade : { 440 case OPackage::Upgrade : {
430 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); 441 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput );
431 ipkg_packages_upgrade( &m_ipkgArgs ); 442 ipkg_packages_upgrade( &m_ipkgArgs );
432 443
433 // Re-link non-root destinations to make sure everything is in sync 444 // Re-link non-root destinations to make sure everything is in sync
434 OConfItemList *destList = destinations(); 445 OConfItemList *destList = destinations();
435 OConfItemListIterator it( *destList ); 446 OConfItemListIterator it( *destList );
436 for ( ; it.current(); ++it ) 447 for ( ; it.current(); ++it )
437 { 448 {
438 OConfItem *dest = it.current(); 449 OConfItem *dest = it.current();
439 if ( dest->name() != "root" ) 450 if ( dest->name() != "root" )
440 linkPackageDir( dest->name() ); 451 linkPackageDir( dest->name() );
441 } 452 }
442 delete destList; 453 delete destList;
443 }; 454 };
444 break; 455 break;
445 case OPackage::Install : { 456 case OPackage::Install : {
446 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); 457 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput );
447 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) 458 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it )
448 { 459 {
449 ipkg_packages_install( &m_ipkgArgs, (*it) ); 460 ipkg_packages_install( &m_ipkgArgs, (*it) );
450 } 461 }
451 if ( destination != "root" ) 462 if ( destination != "root" )
452 linkPackageDir( destination ); 463 linkPackageDir( destination );
453 }; 464 };
454 break; 465 break;
455 case OPackage::Remove : { 466 case OPackage::Remove : {
456 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); 467 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput );
457 468
458 // Get list of destinations for unlinking of packages not installed to root 469 // Get list of destinations for unlinking of packages not installed to root
459 OConfItemList *destList = destinations(); 470 OConfItemList *destList = destinations();
460 471
461 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) 472 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it )
462 { 473 {
463 unlinkPackage( (*it), destList ); 474 unlinkPackage( (*it), destList );
464 ipkg_packages_remove( &m_ipkgArgs, (*it), true ); 475 ipkg_packages_remove( &m_ipkgArgs, (*it), true );
465 } 476 }
466 477
467 delete destList; 478 delete destList;
468 }; 479 };
469 break; 480 break;
470 case OPackage::Download : { 481 case OPackage::Download : {
471 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); 482 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput );
472 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) 483 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it )
473 { 484 {
474 ipkg_packages_download( &m_ipkgArgs, (*it) ); 485 ipkg_packages_download( &m_ipkgArgs, (*it) );
475 } 486 }
476 }; 487 };
477 break; 488 break;
478 case OPackage::Info : { 489 case OPackage::Info : {
479 connect( this, SIGNAL(signalIpkgStatus(const QString &)), receiver, slotOutput ); 490 connect( this, SIGNAL(signalIpkgStatus(const QString &)), receiver, slotOutput );
480 ipkg_packages_info( &m_ipkgArgs, (*parameters.begin()), &fIpkgStatus, 0l ); 491 ipkg_packages_info( &m_ipkgArgs, (*parameters.begin()), &fIpkgStatus, 0l );
481 }; 492 };
482 break; 493 break;
483 case OPackage::Files : { 494 case OPackage::Files : {
484 connect( this, SIGNAL(signalIpkgList(const QString &)), receiver, slotOutput ); 495 connect( this, SIGNAL(signalIpkgList(const QString &)), receiver, slotOutput );
485 ipkg_package_files( &m_ipkgArgs, (*parameters.begin()), &fIpkgFiles, 0l ); 496 ipkg_package_files( &m_ipkgArgs, (*parameters.begin()), &fIpkgFiles, 0l );
486 }; 497 };
487 break; 498 break;
488 default : break; 499 default : break;
489 }; 500 };
490 501
491 return true; 502 return true;
492} 503}
493 504
494void OIpkg::ipkgMessage( char *msg ) 505void OIpkg::ipkgMessage( char *msg )
495{ 506{
496 emit signalIpkgMessage( msg ); 507 emit signalIpkgMessage( msg );
497} 508}
498 509
499void OIpkg::ipkgStatus( char *status ) 510void OIpkg::ipkgStatus( char *status )
500{ 511{
501 emit signalIpkgStatus( status ); 512 emit signalIpkgStatus( status );
502} 513}
503 514
504void OIpkg::ipkgList( char *filelist ) 515void OIpkg::ipkgList( char *filelist )
505{ 516{
506 emit signalIpkgList( filelist ); 517 emit signalIpkgList( filelist );
507} 518}
508 519
509void OIpkg::loadConfiguration() 520void OIpkg::loadConfiguration()
510{ 521{
511 if ( m_confInfo ) 522 if ( m_confInfo )
512 delete m_confInfo; 523 delete m_confInfo;
513 524
514 // Load configuration item list 525 // Load configuration item list
515 m_confInfo = new OConfItemList(); 526 m_confInfo = new OConfItemList();
516 527
517 QStringList confFiles; 528 QStringList confFiles;
518 QDir confDir( IPKG_CONF_DIR ); 529 QDir confDir( IPKG_CONF_DIR );
519 if ( confDir.exists() ) 530 if ( confDir.exists() )
520 { 531 {
521 confDir.setNameFilter( "*.conf" ); 532 confDir.setNameFilter( "*.conf" );
522 confDir.setFilter( QDir::Files ); 533 confDir.setFilter( QDir::Files );
523 confFiles = confDir.entryList( "*.conf", QDir::Files ); 534 confFiles = confDir.entryList( "*.conf", QDir::Files );
524 } 535 }
525 confFiles << IPKG_CONF; 536 confFiles << IPKG_CONF;
526 537
527 QStringList::Iterator lastFile = confFiles.end(); 538 QStringList::Iterator lastFile = confFiles.end();
528 for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it ) 539 for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it )
529 { 540 {
530 // Create absolute file path if necessary 541 // Create absolute file path if necessary
531 QString absFile = (*it); 542 QString absFile = (*it);
532 if ( !absFile.startsWith( "/" ) ) 543 if ( !absFile.startsWith( "/" ) )
533 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); 544 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" );
534 545
535 // Read in file 546 // Read in file
536 QFile f( absFile ); 547 QFile f( absFile );
537 if ( f.open( IO_ReadOnly ) ) 548 if ( f.open( IO_ReadOnly ) )
538 { 549 {
539 QTextStream s( &f ); 550 QTextStream s( &f );
540 while ( !s.eof() ) 551 while ( !s.eof() )
541 { 552 {
542 553
543 QString line = s.readLine().simplifyWhiteSpace(); 554 QString line = s.readLine().simplifyWhiteSpace();
544 555
545 // Parse line and save info to the conf options list 556 // Parse line and save info to the conf options list
546 if ( !line.isEmpty() ) 557 if ( !line.isEmpty() )
547 { 558 {
548 if ( !line.startsWith( "#" ) || 559 // Strip leading comment marker if exists
549 line.startsWith( "#src" ) || 560 bool comment = false;
550 line.startsWith( "#dest" ) || 561 if ( line.startsWith( "#" ) )
551 line.startsWith( "#arch" ) ||
552 line.startsWith( "#option" ) )
553 { 562 {
554 int pos = line.find( ' ', 1 ); 563 line.remove( 0, 1 );
555 564 line = line.simplifyWhiteSpace();
556 // Type 565 comment = true;
557 QString typeStr = line.left( pos ); 566 }
558 OConfItem::Type type;
559 QString features;
560 if ( typeStr == "src" || typeStr == "#src" )
561 type = OConfItem::Source;
562 else if ( typeStr == "src/gz" || typeStr == "#src/gz" )
563 {
564 type = OConfItem::Source;
565 features = "Compressed";
566 }
567 else if ( typeStr == "dest" || typeStr == "#dest" )
568 type = OConfItem::Destination;
569 else if ( typeStr == "option" || typeStr == "#option" )
570 type = OConfItem::Option;
571 else if ( typeStr == "arch" || typeStr == "#arch" )
572 type = OConfItem::Arch;
573 else
574 type = OConfItem::NotDefined;
575 ++pos;
576 int endpos = line.find( ' ', pos );
577
578 // Name
579 QString name = line.mid( pos, endpos - pos );
580
581 // Value
582 QString value = "";
583 if ( endpos > -1 )
584 value = line.right( line.length() - endpos - 1 );
585 567
586 // Active 568 bool recognizedOption = true;
587 bool active = !line.startsWith( "#" ); 569 int pos = line.find( ' ', 1 ) + 1;
570 int endpos = line.find( ' ', pos );
571
572 // Name
573 QString name = line.mid( pos, endpos - pos );
574
575 // Value
576 QString value = "";
577 if ( endpos > -1 )
578 value = line.right( line.length() - endpos - 1 );
579
580 // Active
581 bool active = !comment;
582
583 // Type
584 // For options w/type = Other, the mapping is as follows:
585 // name = typeStr (e.g. "lists_dir")
586 // value = value
587 // features = name (from configuration file)
588
589 QString typeStr = line.left( pos - 1 );
590 OConfItem::Type type;
591 QString features;
592 if ( typeStr == "src" )
593 type = OConfItem::Source;
594 else if ( typeStr == "src/gz" )
595 {
596 type = OConfItem::Source;
597 features = "Compressed";
598 }
599 else if ( typeStr == "dest" )
600 type = OConfItem::Destination;
601 else if ( typeStr == "option" )
602 type = OConfItem::Option;
603 else if ( typeStr == "arch" )
604 type = OConfItem::Arch;
605 else if ( typeStr == "lists_dir" )
606 {
607 type = OConfItem::Other;
608 features = name;
609 name = typeStr;
610 }
611 else
612 recognizedOption = false;
588 613
589 // Add to list 614 // Add to list
615 if ( recognizedOption )
590 m_confInfo->append( new OConfItem( type, name, value, features, active ) ); 616 m_confInfo->append( new OConfItem( type, name, value, features, active ) );
591 }
592 } 617 }
593 } 618 }
594 619
595 f.close(); 620 f.close();
596 } 621 }
597 } 622 }
598 623
599 // Load Ipkg execution options from application configuration file 624 // Load Ipkg execution options from application configuration file
600 if ( m_config ) 625 if ( m_config )
601 { 626 {
602 m_config->setGroup( "Ipkg" ); 627 m_config->setGroup( "Ipkg" );
603 m_ipkgExecOptions = m_config->readNumEntry( "ExecOptions", m_ipkgExecOptions ); 628 m_ipkgExecOptions = m_config->readNumEntry( "ExecOptions", m_ipkgExecOptions );
604 m_ipkgExecVerbosity = m_config->readNumEntry( "Verbosity", m_ipkgExecVerbosity ); 629 m_ipkgExecVerbosity = m_config->readNumEntry( "Verbosity", m_ipkgExecVerbosity );
605 } 630 }
606} 631}
607 632
608OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter ) 633OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter )
609{ 634{
610 // Load Ipkg configuration info if not already cached 635 // Load Ipkg configuration info if not already cached
611 if ( !m_confInfo ) 636 if ( !m_confInfo )
612 loadConfiguration(); 637 loadConfiguration();
613 638
614 // Build new server list (caller is responsible for deleting) 639 // Build new server list (caller is responsible for deleting)
615 OConfItemList *sl = new OConfItemList; 640 OConfItemList *sl = new OConfItemList;
616 641
617 // If typefilter is empty, retrieve all items 642 // If typefilter is empty, retrieve all items
618 bool retrieveAll = ( typefilter == OConfItem::NotDefined ); 643 bool retrieveAll = ( typefilter == OConfItem::NotDefined );
619 644
620 // Parse configuration info for servers 645 // Parse configuration info for servers
621 OConfItemListIterator it( *m_confInfo ); 646 OConfItemListIterator it( *m_confInfo );
622 for ( ; it.current(); ++it ) 647 for ( ; it.current(); ++it )
623 { 648 {
624 OConfItem *item = it.current(); 649 OConfItem *item = it.current();
625 if ( retrieveAll || item->type() == typefilter ) 650 if ( retrieveAll || item->type() == typefilter )
626 { 651 {
627 sl->append( item ); 652 sl->append( item );
628 } 653 }
629 } 654 }
630 655
631 return sl; 656 return sl;
632} 657}
633 658
634const QString &OIpkg::rootPath() 659const QString &OIpkg::rootPath()
635{ 660{
636 if ( m_rootPath.isEmpty() ) 661 if ( m_rootPath.isEmpty() )
637 { 662 {
638 OConfItem *rootDest = findConfItem( OConfItem::Destination, "root" ); 663 OConfItem *rootDest = findConfItem( OConfItem::Destination, "root" );
639 rootDest ? m_rootPath = rootDest->value() 664 rootDest ? m_rootPath = rootDest->value()
640 : m_rootPath = '/'; 665 : m_rootPath = '/';
641 if ( m_rootPath.right( 1 ) == '/' ) 666 if ( m_rootPath.right( 1 ) == '/' )
642 m_rootPath.truncate( m_rootPath.length() - 1 ); 667 m_rootPath.truncate( m_rootPath.length() - 1 );
643 } 668 }
644 return m_rootPath; 669 return m_rootPath;
645} 670}
646 671
647void OIpkg::linkPackageDir( const QString &dest ) 672void OIpkg::linkPackageDir( const QString &dest )
648{ 673{
649 if ( !dest.isNull() ) 674 if ( !dest.isNull() )
650 { 675 {
651 OConfItem *destConfItem = findConfItem( OConfItem::Destination, dest ); 676 OConfItem *destConfItem = findConfItem( OConfItem::Destination, dest );
652 677
653 emit signalIpkgMessage( tr( "Linking packages installed in: %1" ).arg( dest ) ); 678 emit signalIpkgMessage( tr( "Linking packages installed in: %1" ).arg( dest ) );
654 679
655 // Set package destination directory 680 // Set package destination directory
656 QString destDir = destConfItem->value(); 681 QString destDir = destConfItem->value();
657 QString destInfoDir = destDir; 682 QString destInfoDir = destDir;
658 if ( destInfoDir.right( 1 ) != '/' ) 683 if ( destInfoDir.right( 1 ) != '/' )
659 destInfoDir.append( '/' ); 684 destInfoDir.append( '/' );
660 destInfoDir.append( IPKG_INFO_PATH ); 685 destInfoDir.append( IPKG_INFO_PATH );
661 686
662 // Get list of installed packages in destination 687 // Get list of installed packages in destination
663 QDir packageDir( destInfoDir ); 688 QDir packageDir( destInfoDir );
664 QStringList packageFiles; 689 QStringList packageFiles;
665 if ( packageDir.exists() ) 690 if ( packageDir.exists() )
666 { 691 {
667 packageDir.setNameFilter( "*.list" ); 692 packageDir.setNameFilter( "*.list" );
668 packageDir.setFilter( QDir::Files ); 693 packageDir.setFilter( QDir::Files );
669 packageFiles = packageDir.entryList( "*.list", QDir::Files ); 694 packageFiles = packageDir.entryList( "*.list", QDir::Files );
670 } 695 }
671 696
672 // Link all files for every package installed in desination 697 // Link all files for every package installed in desination
673 QStringList::Iterator lastFile = packageFiles.end(); 698 QStringList::Iterator lastFile = packageFiles.end();
674 for ( QStringList::Iterator it = packageFiles.begin(); it != lastFile; ++it ) 699 for ( QStringList::Iterator it = packageFiles.begin(); it != lastFile; ++it )
675 { 700 {
676 //emit signalIpkgMessage( QString( "Processing: %1/%2" ).arg( destInfoDir ).arg (*it) ); 701 //emit signalIpkgMessage( QString( "Processing: %1/%2" ).arg( destInfoDir ).arg (*it) );
677 QString packageFileName = destInfoDir; 702 QString packageFileName = destInfoDir;
678 packageFileName.append( '/' ); 703 packageFileName.append( '/' );
679 packageFileName.append( (*it) ); 704 packageFileName.append( (*it) );
680 QFile packageFile( packageFileName ); 705 QFile packageFile( packageFileName );
681 if ( packageFile.open( IO_ReadOnly ) ) 706 if ( packageFile.open( IO_ReadOnly ) )
682 { 707 {
683 QTextStream t( &packageFile ); 708 QTextStream t( &packageFile );
684 QString linkFile; 709 QString linkFile;
685 while ( !t.eof() ) 710 while ( !t.eof() )
686 { 711 {
687 // Get the name of the file to link and build the sym link filename 712 // Get the name of the file to link and build the sym link filename
688 linkFile = t.readLine(); 713 linkFile = t.readLine();
689 QString linkDest( linkFile.right( linkFile.length() - destDir.length() ) ); 714 QString linkDest( linkFile.right( linkFile.length() - destDir.length() ) );
690 linkDest.prepend( rootPath() ); 715 linkDest.prepend( rootPath() );
691 716
692 // If file installed file is actually symbolic link, use actual file for linking 717 // If file installed file is actually symbolic link, use actual file for linking
693 QFileInfo fileInfo( linkFile ); 718 QFileInfo fileInfo( linkFile );
694 if ( fileInfo.isSymLink() && !fileInfo.readLink().isEmpty() ) 719 if ( fileInfo.isSymLink() && !fileInfo.readLink().isEmpty() )
695 linkFile = fileInfo.readLink(); 720 linkFile = fileInfo.readLink();
696 721
697 // See if directory exists in 'root', if not, create 722 // See if directory exists in 'root', if not, create
698 fileInfo.setFile( linkDest ); 723 fileInfo.setFile( linkDest );
699 QString linkDestDirName = fileInfo.dirPath( true ); 724 QString linkDestDirName = fileInfo.dirPath( true );
700 QDir linkDestDir( linkDestDirName ); 725 QDir linkDestDir( linkDestDirName );
701 if ( !linkDestDir.exists() ) 726 if ( !linkDestDir.exists() )
702 { 727 {
703 linkDestDir.mkdir( linkDestDirName ); 728 linkDestDir.mkdir( linkDestDirName );
704 } 729 }
705 else 730 else
706 { 731 {
707 // Remove any previous link to make sure we will be pointing to the current version 732 // Remove any previous link to make sure we will be pointing to the current version
708 if ( QFile::exists( linkDest ) ) 733 if ( QFile::exists( linkDest ) )
709 QFile::remove( linkDest ); 734 QFile::remove( linkDest );
710 } 735 }
711 736
712 // Link the file 737 // Link the file
713 //emit signalIpkgMessage( QString( "Linking '%1' to '%2'" ).arg( linkFile ).arg( linkDest ) ); 738 //emit signalIpkgMessage( QString( "Linking '%1' to '%2'" ).arg( linkFile ).arg( linkDest ) );
714 if ( symlink( linkFile, linkDest ) == -1 ) 739 if ( symlink( linkFile, linkDest ) == -1 )
715 emit signalIpkgMessage( tr( "Error linkling '%1' to '%2'" ) 740 emit signalIpkgMessage( tr( "Error linkling '%1' to '%2'" )
716 .arg( linkFile ) 741 .arg( linkFile )
717 .arg( linkDest ) ); 742 .arg( linkDest ) );
718 } 743 }
719 packageFile.close(); 744 packageFile.close();
720 } 745 }
721 } 746 }
722 } 747 }
723} 748}
724 749
725void OIpkg::unlinkPackage( const QString &package, OConfItemList *destList ) 750void OIpkg::unlinkPackage( const QString &package, OConfItemList *destList )
726{ 751{
727 if ( !package.isNull() ) 752 if ( !package.isNull() )
728 { 753 {
729 // Find destination package is installed in 754 // Find destination package is installed in
730 if ( destList ) 755 if ( destList )
731 { 756 {
732 OConfItemListIterator it( *destList ); 757 OConfItemListIterator it( *destList );
733 for ( ; it.current(); ++it ) 758 for ( ; it.current(); ++it )
734 { 759 {
735 OConfItem *dest = it.current(); 760 OConfItem *dest = it.current();
736 QString destInfoFileName = QString( "%1/%2/%3.list" ).arg( dest->value() ) 761 QString destInfoFileName = QString( "%1/%2/%3.list" ).arg( dest->value() )
737 .arg( IPKG_INFO_PATH ) 762 .arg( IPKG_INFO_PATH )
738 .arg( package ); 763 .arg( package );
739 //emit signalIpkgMessage( QString( "Looking for '%1'" ).arg ( destInfoFileName ) ); 764 //emit signalIpkgMessage( QString( "Looking for '%1'" ).arg ( destInfoFileName ) );
740 765
741 // If found and destination is not 'root', remove symbolic links 766 // If found and destination is not 'root', remove symbolic links
742 if ( QFile::exists( destInfoFileName ) && dest->name() != "root" ) 767 if ( QFile::exists( destInfoFileName ) && dest->name() != "root" )
743 { 768 {
744 QFile destInfoFile( destInfoFileName ); 769 QFile destInfoFile( destInfoFileName );
745 if ( destInfoFile.open( IO_ReadOnly ) ) 770 if ( destInfoFile.open( IO_ReadOnly ) )
746 { 771 {
747 QTextStream t( &destInfoFile ); 772 QTextStream t( &destInfoFile );
748 QString linkFile; 773 QString linkFile;
749 while ( !t.eof() ) 774 while ( !t.eof() )
750 { 775 {
751 // Get the name of the file to link and build the sym link filename 776 // Get the name of the file to link and build the sym link filename
752 linkFile = t.readLine(); 777 linkFile = t.readLine();
753 QString linkDest( linkFile.right( linkFile.length() - 778 QString linkDest( linkFile.right( linkFile.length() -
754 dest->value().length() ) ); 779 dest->value().length() ) );
755 linkDest.prepend( rootPath() ); 780 linkDest.prepend( rootPath() );
756 781
757 //emit signalIpkgMessage( QString( "Deleting: '%1'" ).arg( linkDest ) ); 782 //emit signalIpkgMessage( QString( "Deleting: '%1'" ).arg( linkDest ) );
758 QFile::remove( linkDest ); 783 QFile::remove( linkDest );
759 } 784 }
760 destInfoFile.close(); 785 destInfoFile.close();
761 } 786 }
762 787
763 emit signalIpkgMessage( tr( "Links removed for: %1" ).arg( package ) ); 788 emit signalIpkgMessage( tr( "Links removed for: %1" ).arg( package ) );
764 return; 789 return;
765 } 790 }
766 } 791 }
767 } 792 }
768 } 793 }
769} 794}
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
index e6d6a81..7ee2d74 100644
--- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp
+++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
@@ -1,646 +1,682 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 3
4 Copyright (c) 2003 Dan Williams <drw@handhelds.org> 4 Copyright (c) 2003 Dan Williams <drw@handhelds.org>
5 =. 5 =.
6 .=l. 6 .=l.
7 .>+-= 7 .>+-=
8_;:, .> :=|. This program is free software; you can 8_;:, .> :=|. This program is free software; you can
9.> <`_, > . <= redistribute it and/or modify it under 9.> <`_, > . <= redistribute it and/or modify it under
10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
11.="- .-=="i, .._ License as published by the Free Software 11.="- .-=="i, .._ License as published by the Free Software
12- . .-<_> .<> Foundation; either version 2 of the License, 12- . .-<_> .<> Foundation; either version 2 of the License,
13 ._= =} : or (at your option) any later version. 13 ._= =} : or (at your option) any later version.
14 .%`+i> _;_. 14 .%`+i> _;_.
15 .i_,=:_. -<s. This program is distributed in the hope that 15 .i_,=:_. -<s. This program is distributed in the hope that
16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
17 : .. .:, . . . without even the implied warranty of 17 : .. .:, . . . without even the implied warranty of
18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.= = ; Library General Public License for more 20..}^=.= = ; Library General Public License for more
21++= -. .` .: details. 21++= -. .` .: details.
22: = ...= . :.=- 22: = ...= . :.=-
23-. .:....=;==+<; You should have received a copy of the GNU 23-. .:....=;==+<; You should have received a copy of the GNU
24 -_. . . )=. = Library General Public License along with 24 -_. . . )=. = Library General Public License along with
25 -- :-=` this library; see the file COPYING.LIB. 25 -- :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#include "oipkgconfigdlg.h" 32#include "oipkgconfigdlg.h"
33 33
34#include <opie2/ofiledialog.h> 34#include <opie2/ofiledialog.h>
35 35
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37#include <qpe/resource.h> 37#include <qpe/resource.h>
38 38
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qcombobox.h> 40#include <qcombobox.h>
41#include <qgroupbox.h> 41#include <qgroupbox.h>
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qlineedit.h> 43#include <qlineedit.h>
44#include <qlistbox.h> 44#include <qlistbox.h>
45#include <qpushbutton.h> 45#include <qpushbutton.h>
46#include <qscrollview.h> 46#include <qscrollview.h>
47#include <qwhatsthis.h> 47#include <qwhatsthis.h>
48 48
49OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) 49OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent )
50 : QDialog( parent, QString::null, true, WStyle_ContextHelp ) 50 : QDialog( parent, QString::null, true, WStyle_ContextHelp )
51 , m_ipkg( ipkg ) 51 , m_ipkg( ipkg )
52 , m_configs( 0l ) 52 , m_configs( 0l )
53 , m_installOptions( installOptions ) 53 , m_installOptions( installOptions )
54 , m_serverCurrent( -1 ) 54 , m_serverCurrent( -1 )
55 , m_destCurrent( -1 ) 55 , m_destCurrent( -1 )
56 , m_layout( this, 2, 4 ) 56 , m_layout( this, 2, 4 )
57 , m_tabWidget( this ) 57 , m_tabWidget( this )
58{ 58{
59 setCaption( tr( "Configuration" ) ); 59 setCaption( tr( "Configuration" ) );
60 60
61 // Initialize configuration widgets 61 // Initialize configuration widgets
62 if ( !installOptions ) 62 if ( !installOptions )
63 { 63 {
64 initServerWidget(); 64 initServerWidget();
65 initDestinationWidget(); 65 initDestinationWidget();
66 initProxyWidget(); 66 initProxyWidget();
67 } 67 }
68 initOptionsWidget(); 68 initOptionsWidget();
69 69
70 // Load configuration information 70 // Load configuration information
71 initData(); 71 initData();
72 72
73 // Setup tabs for all info 73 // Setup tabs for all info
74 m_layout.addWidget( &m_tabWidget ); 74 m_layout.addWidget( &m_tabWidget );
75 if ( !m_installOptions ) 75 if ( !m_installOptions )
76 { 76 {
77 m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); 77 m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) );
78 m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); 78 m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) );
79 m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); 79 m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) );
80 m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); 80 m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) );
81 m_tabWidget.setCurrentTab( tr( "Servers" ) ); 81 m_tabWidget.setCurrentTab( tr( "Servers" ) );
82 } 82 }
83 else 83 else
84 { 84 {
85 m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); 85 m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) );
86 } 86 }
87} 87}
88 88
89void OIpkgConfigDlg::accept() 89void OIpkgConfigDlg::accept()
90{ 90{
91 // Save server, destination and proxy configuration 91 // Save server, destination and proxy configuration
92 if ( !m_installOptions ) 92 if ( !m_installOptions )
93 { 93 {
94 // Update proxy information before saving settings 94 // Update proxy information before saving settings
95 OConfItem *confItem = m_ipkg->findConfItem( OConfItem::Option, "http_proxy" ); 95 OConfItem *confItem = m_ipkg->findConfItem( OConfItem::Option, "http_proxy" );
96 if ( confItem ) 96 if ( confItem )
97 { 97 {
98 confItem->setValue( m_proxyHttpServer->text() ); 98 confItem->setValue( m_proxyHttpServer->text() );
99 confItem->setActive( m_proxyHttpActive->isChecked() ); 99 confItem->setActive( m_proxyHttpActive->isChecked() );
100 } 100 }
101 else 101 else
102 m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", 102 m_configs->append( new OConfItem( OConfItem::Option, "http_proxy",
103 m_proxyHttpServer->text(), QString::null, 103 m_proxyHttpServer->text(), QString::null,
104 m_proxyHttpActive->isChecked() ) ); 104 m_proxyHttpActive->isChecked() ) );
105 105
106 confItem = m_ipkg->findConfItem( OConfItem::Option, "ftp_proxy" ); 106 confItem = m_ipkg->findConfItem( OConfItem::Option, "ftp_proxy" );
107 if ( confItem ) 107 if ( confItem )
108 { 108 {
109 confItem->setValue( m_proxyFtpServer->text() ); 109 confItem->setValue( m_proxyFtpServer->text() );
110 confItem->setActive( m_proxyFtpActive->isChecked() ); 110 confItem->setActive( m_proxyFtpActive->isChecked() );
111 } 111 }
112 else 112 else
113 m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", 113 m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy",
114 m_proxyFtpServer->text(), QString::null, 114 m_proxyFtpServer->text(), QString::null,
115 m_proxyFtpActive->isChecked() ) ); 115 m_proxyFtpActive->isChecked() ) );
116 116
117 confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_username" ); 117 confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_username" );
118 if ( confItem ) 118 if ( confItem )
119 confItem->setValue( m_proxyUsername->text() ); 119 confItem->setValue( m_proxyUsername->text() );
120 else 120 else
121 m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", 121 m_configs->append( new OConfItem( OConfItem::Option, "proxy_username",
122 m_proxyUsername->text() ) ); 122 m_proxyUsername->text() ) );
123 123
124 confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_password" ); 124 confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_password" );
125 if ( confItem ) 125 if ( confItem )
126 confItem->setValue( m_proxyPassword->text() ); 126 confItem->setValue( m_proxyPassword->text() );
127 else 127 else
128 m_configs->append( new OConfItem( OConfItem::Option, "proxy_password", 128 m_configs->append( new OConfItem( OConfItem::Option, "proxy_password",
129 m_proxyPassword->text() ) ); 129 m_proxyPassword->text() ) );
130 130
131 confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" );
132 if ( confItem )
133 confItem->setValue( m_optSourceLists->text() );
134 else
135 m_configs->append( new OConfItem( OConfItem::Other, "lists_dir",
136 m_optSourceLists->text(), "name" ) );
137
131 m_ipkg->setConfigItems( m_configs ); 138 m_ipkg->setConfigItems( m_configs );
132 } 139 }
133 140
134 // Save options configuration 141 // Save options configuration
135 int options = 0; 142 int options = 0;
136 if ( m_optForceDepends->isChecked() ) 143 if ( m_optForceDepends->isChecked() )
137 options |= FORCE_DEPENDS; 144 options |= FORCE_DEPENDS;
138 if ( m_optForceReinstall->isChecked() ) 145 if ( m_optForceReinstall->isChecked() )
139 options |= FORCE_REINSTALL; 146 options |= FORCE_REINSTALL;
140 if ( m_optForceRemove->isChecked() ) 147 if ( m_optForceRemove->isChecked() )
141 options |= FORCE_REMOVE; 148 options |= FORCE_REMOVE;
142 if ( m_optForceOverwrite->isChecked() ) 149 if ( m_optForceOverwrite->isChecked() )
143 options |= FORCE_OVERWRITE; 150 options |= FORCE_OVERWRITE;
144 m_ipkg->setIpkgExecOptions( options ); 151 m_ipkg->setIpkgExecOptions( options );
145 m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); 152 m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() );
146 153
147 QDialog::accept(); 154 QDialog::accept();
148} 155}
149 156
150void OIpkgConfigDlg::reject() 157void OIpkgConfigDlg::reject()
151{ 158{
152 if ( m_configs ) 159 if ( m_configs )
153 delete m_configs; 160 delete m_configs;
154} 161}
155 162
156void OIpkgConfigDlg::initServerWidget() 163void OIpkgConfigDlg::initServerWidget()
157{ 164{
158 m_serverWidget = new QWidget( this ); 165 m_serverWidget = new QWidget( this );
159 166
160 // Initialize UI 167 // Initialize UI
161 QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); 168 QVBoxLayout *vb = new QVBoxLayout( m_serverWidget );
162 QScrollView *sv = new QScrollView( m_serverWidget ); 169 QScrollView *sv = new QScrollView( m_serverWidget );
163 vb->addWidget( sv, 0, 0 ); 170 vb->addWidget( sv, 0, 0 );
164 sv->setResizePolicy( QScrollView::AutoOneFit ); 171 sv->setResizePolicy( QScrollView::AutoOneFit );
165 sv->setFrameStyle( QFrame::NoFrame ); 172 sv->setFrameStyle( QFrame::NoFrame );
166 QWidget *container = new QWidget( sv->viewport() ); 173 QWidget *container = new QWidget( sv->viewport() );
167 sv->addChild( container ); 174 sv->addChild( container );
168 QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); 175 QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 );
169 176
170 m_serverList = new QListBox( container ); 177 m_serverList = new QListBox( container );
171 QWhatsThis::add( m_serverList, tr( "This is a list of all servers configured. Select one here to edit or delete, or add a new one below." ) ); 178 QWhatsThis::add( m_serverList, tr( "This is a list of all servers configured. Select one here to edit or delete, or add a new one below." ) );
172 m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 179 m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
173 connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) ); 180 connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) );
174 layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 ); 181 layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 );
175 182
176 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 183 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
177 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); 184 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) );
178 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); 185 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) );
179 layout->addWidget( btn, 1, 0 ); 186 layout->addWidget( btn, 1, 0 );
180 187
181 m_serverEditBtn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), container ); 188 m_serverEditBtn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), container );
182 m_serverEditBtn->setEnabled( false ); 189 m_serverEditBtn->setEnabled( false );
183 QWhatsThis::add( m_serverEditBtn, tr( "Tap here to edit the entry selected above." ) ); 190 QWhatsThis::add( m_serverEditBtn, tr( "Tap here to edit the entry selected above." ) );
184 connect( m_serverEditBtn, SIGNAL(clicked()), this, SLOT(slotServerEdit()) ); 191 connect( m_serverEditBtn, SIGNAL(clicked()), this, SLOT(slotServerEdit()) );
185 layout->addWidget( m_serverEditBtn, 1, 1 ); 192 layout->addWidget( m_serverEditBtn, 1, 1 );
186 193
187 m_serverDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); 194 m_serverDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
188 m_serverDeleteBtn->setEnabled( false ); 195 m_serverDeleteBtn->setEnabled( false );
189 QWhatsThis::add( m_serverDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); 196 QWhatsThis::add( m_serverDeleteBtn, tr( "Tap here to delete the entry selected above." ) );
190 connect( m_serverDeleteBtn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); 197 connect( m_serverDeleteBtn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) );
191 layout->addWidget( m_serverDeleteBtn, 1, 2 ); 198 layout->addWidget( m_serverDeleteBtn, 1, 2 );
192} 199}
193 200
194void OIpkgConfigDlg::initDestinationWidget() 201void OIpkgConfigDlg::initDestinationWidget()
195{ 202{
196 m_destWidget = new QWidget( this ); 203 m_destWidget = new QWidget( this );
197 204
198 // Initialize UI 205 // Initialize UI
199 QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); 206 QVBoxLayout *vb = new QVBoxLayout( m_destWidget );
200 QScrollView *sv = new QScrollView( m_destWidget ); 207 QScrollView *sv = new QScrollView( m_destWidget );
201 vb->addWidget( sv, 0, 0 ); 208 vb->addWidget( sv, 0, 0 );
202 sv->setResizePolicy( QScrollView::AutoOneFit ); 209 sv->setResizePolicy( QScrollView::AutoOneFit );
203 sv->setFrameStyle( QFrame::NoFrame ); 210 sv->setFrameStyle( QFrame::NoFrame );
204 QWidget *container = new QWidget( sv->viewport() ); 211 QWidget *container = new QWidget( sv->viewport() );
205 sv->addChild( container ); 212 sv->addChild( container );
206 QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); 213 QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 );
207 214
208 m_destList = new QListBox( container ); 215 m_destList = new QListBox( container );
209 QWhatsThis::add( m_destList, tr( "This is a list of all destinations configured for this device. Select one here to edit or delete, or add a new one below." ) ); 216 QWhatsThis::add( m_destList, tr( "This is a list of all destinations configured for this device. Select one here to edit or delete, or add a new one below." ) );
210 m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 217 m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
211 connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestSelected(int)) ); 218 connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestSelected(int)) );
212 layout->addMultiCellWidget( m_destList, 0, 0, 0, 2 ); 219 layout->addMultiCellWidget( m_destList, 0, 0, 0, 2 );
213 220
214 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 221 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
215 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); 222 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) );
216 connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); 223 connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) );
217 layout->addWidget( btn, 1, 0 ); 224 layout->addWidget( btn, 1, 0 );
218 225
219 m_destEditBtn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), container ); 226 m_destEditBtn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), container );
220 m_destEditBtn->setEnabled( false ); 227 m_destEditBtn->setEnabled( false );
221 QWhatsThis::add( m_destEditBtn, tr( "Tap here to edit the entry selected above." ) ); 228 QWhatsThis::add( m_destEditBtn, tr( "Tap here to edit the entry selected above." ) );
222 connect( m_destEditBtn, SIGNAL(clicked()), this, SLOT(slotDestEdit()) ); 229 connect( m_destEditBtn, SIGNAL(clicked()), this, SLOT(slotDestEdit()) );
223 layout->addWidget( m_destEditBtn, 1, 1 ); 230 layout->addWidget( m_destEditBtn, 1, 1 );
224 231
225 m_destDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); 232 m_destDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
226 m_destDeleteBtn->setEnabled( false ); 233 m_destDeleteBtn->setEnabled( false );
227 QWhatsThis::add( m_destDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); 234 QWhatsThis::add( m_destDeleteBtn, tr( "Tap here to delete the entry selected above." ) );
228 connect( m_destDeleteBtn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); 235 connect( m_destDeleteBtn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) );
229 layout->addWidget( m_destDeleteBtn, 1, 2 ); 236 layout->addWidget( m_destDeleteBtn, 1, 2 );
230} 237}
231 238
232void OIpkgConfigDlg::initProxyWidget() 239void OIpkgConfigDlg::initProxyWidget()
233{ 240{
234 m_proxyWidget = new QWidget( this ); 241 m_proxyWidget = new QWidget( this );
235 242
236 // Initialize UI 243 // Initialize UI
237 QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget ); 244 QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget );
238 QScrollView *sv = new QScrollView( m_proxyWidget ); 245 QScrollView *sv = new QScrollView( m_proxyWidget );
239 vb->addWidget( sv, 0, 0 ); 246 vb->addWidget( sv, 0, 0 );
240 sv->setResizePolicy( QScrollView::AutoOneFit ); 247 sv->setResizePolicy( QScrollView::AutoOneFit );
241 sv->setFrameStyle( QFrame::NoFrame ); 248 sv->setFrameStyle( QFrame::NoFrame );
242 QWidget *container = new QWidget( sv->viewport() ); 249 QWidget *container = new QWidget( sv->viewport() );
243 sv->addChild( container ); 250 sv->addChild( container );
244 QGridLayout *layout = new QGridLayout( container, 4, 2, 2, 4 ); 251 QGridLayout *layout = new QGridLayout( container, 4, 2, 2, 4 );
245 252
246 // HTTP proxy server configuration 253 // HTTP proxy server configuration
247 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); 254 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container );
248 grpbox->layout()->setSpacing( 2 ); 255 grpbox->layout()->setSpacing( 2 );
249 grpbox->layout()->setMargin( 4 ); 256 grpbox->layout()->setMargin( 4 );
250 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); 257 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 );
251 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); 258 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() );
252 m_proxyHttpServer = new QLineEdit( grpbox ); 259 m_proxyHttpServer = new QLineEdit( grpbox );
253 QWhatsThis::add( m_proxyHttpServer, tr( "Enter the URL address of the HTTP proxy server here." ) ); 260 QWhatsThis::add( m_proxyHttpServer, tr( "Enter the URL address of the HTTP proxy server here." ) );
254 grplayout->addWidget( m_proxyHttpServer ); 261 grplayout->addWidget( m_proxyHttpServer );
255 m_proxyHttpActive = new QCheckBox( tr( "Enabled" ), grpbox ); 262 m_proxyHttpActive = new QCheckBox( tr( "Enabled" ), grpbox );
256 QWhatsThis::add( m_proxyHttpActive, tr( "Tap here to enable or disable the HTTP proxy server." ) ); 263 QWhatsThis::add( m_proxyHttpActive, tr( "Tap here to enable or disable the HTTP proxy server." ) );
257 grplayout->addWidget( m_proxyHttpActive ); 264 grplayout->addWidget( m_proxyHttpActive );
258 265
259 // FTP proxy server configuration 266 // FTP proxy server configuration
260 grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); 267 grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container );
261 grpbox->layout()->setSpacing( 2 ); 268 grpbox->layout()->setSpacing( 2 );
262 grpbox->layout()->setMargin( 4 ); 269 grpbox->layout()->setMargin( 4 );
263 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); 270 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 );
264 grplayout = new QVBoxLayout( grpbox->layout() ); 271 grplayout = new QVBoxLayout( grpbox->layout() );
265 m_proxyFtpServer = new QLineEdit( grpbox ); 272 m_proxyFtpServer = new QLineEdit( grpbox );
266 QWhatsThis::add( m_proxyFtpServer, tr( "Enter the URL address of the FTP proxy server here." ) ); 273 QWhatsThis::add( m_proxyFtpServer, tr( "Enter the URL address of the FTP proxy server here." ) );
267 grplayout->addWidget( m_proxyFtpServer ); 274 grplayout->addWidget( m_proxyFtpServer );
268 m_proxyFtpActive = new QCheckBox( tr( "Enabled" ), grpbox ); 275 m_proxyFtpActive = new QCheckBox( tr( "Enabled" ), grpbox );
269 QWhatsThis::add( m_proxyFtpActive, tr( "Tap here to enable or disable the FTP proxy server." ) ); 276 QWhatsThis::add( m_proxyFtpActive, tr( "Tap here to enable or disable the FTP proxy server." ) );
270 grplayout->addWidget( m_proxyFtpActive ); 277 grplayout->addWidget( m_proxyFtpActive );
271 278
272 // Proxy server username and password configuration 279 // Proxy server username and password configuration
273 QLabel *label = new QLabel( tr( "Username:" ), container ); 280 QLabel *label = new QLabel( tr( "Username:" ), container );
274 QWhatsThis::add( label, tr( "Enter the username for the proxy servers here." ) ); 281 QWhatsThis::add( label, tr( "Enter the username for the proxy servers here." ) );
275 layout->addWidget( label, 2, 0 ); 282 layout->addWidget( label, 2, 0 );
276 m_proxyUsername = new QLineEdit( container ); 283 m_proxyUsername = new QLineEdit( container );
277 QWhatsThis::add( m_proxyUsername, tr( "Enter the username for the proxy servers here." ) ); 284 QWhatsThis::add( m_proxyUsername, tr( "Enter the username for the proxy servers here." ) );
278 layout->addWidget( m_proxyUsername, 2, 1 ); 285 layout->addWidget( m_proxyUsername, 2, 1 );
279 286
280 label = new QLabel( tr( "Password:" ), container ); 287 label = new QLabel( tr( "Password:" ), container );
281 QWhatsThis::add( label, tr( "Enter the password for the proxy servers here." ) ); 288 QWhatsThis::add( label, tr( "Enter the password for the proxy servers here." ) );
282 layout->addWidget( label, 3, 0 ); 289 layout->addWidget( label, 3, 0 );
283 m_proxyPassword = new QLineEdit( container ); 290 m_proxyPassword = new QLineEdit( container );
284 QWhatsThis::add( m_proxyPassword, tr( "Enter the password for the proxy servers here." ) ); 291 QWhatsThis::add( m_proxyPassword, tr( "Enter the password for the proxy servers here." ) );
285 layout->addWidget( m_proxyPassword, 3, 1 ); 292 layout->addWidget( m_proxyPassword, 3, 1 );
286} 293}
287 294
288void OIpkgConfigDlg::initOptionsWidget() 295void OIpkgConfigDlg::initOptionsWidget()
289{ 296{
290 m_optionsWidget = new QWidget( this ); 297 m_optionsWidget = new QWidget( this );
291 298
292 // Initialize UI 299 // Initialize UI
293 QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget ); 300 QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget );
294 QScrollView *sv = new QScrollView( m_optionsWidget ); 301 QScrollView *sv = new QScrollView( m_optionsWidget );
295 vb->addWidget( sv, 0, 0 ); 302 vb->addWidget( sv, 0, 0 );
296 sv->setResizePolicy( QScrollView::AutoOneFit ); 303 sv->setResizePolicy( QScrollView::AutoOneFit );
297 sv->setFrameStyle( QFrame::NoFrame ); 304 sv->setFrameStyle( QFrame::NoFrame );
298 QWidget *container = new QWidget( sv->viewport() ); 305 QWidget *container = new QWidget( sv->viewport() );
299 sv->addChild( container ); 306 sv->addChild( container );
300 QVBoxLayout *layout = new QVBoxLayout( container, 2, 4 ); 307 QGridLayout *layout = new QGridLayout( container, 8, 2, 2, 4 );
301 308
302 m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container ); 309 m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container );
303 QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) ); 310 QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) );
304 layout->addWidget( m_optForceDepends ); 311 layout->addMultiCellWidget( m_optForceDepends, 0, 0, 0, 1 );
305 312
306 m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); 313 m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container );
307 QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) ); 314 QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) );
308 layout->addWidget( m_optForceReinstall ); 315 layout->addMultiCellWidget( m_optForceReinstall, 1, 1, 0, 1 );
309 316
310 m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); 317 m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container );
311 QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) ); 318 QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) );
312 layout->addWidget( m_optForceRemove ); 319 layout->addMultiCellWidget( m_optForceRemove, 2, 2, 0, 1 );
313 320
314 m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); 321 m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container );
315 QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) ); 322 QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) );
316 layout->addWidget( m_optForceOverwrite ); 323 layout->addMultiCellWidget( m_optForceOverwrite, 3, 3, 0, 1 );
317 324
318 QLabel *l = new QLabel( tr( "Information Level" ), container ); 325 QLabel *l = new QLabel( tr( "Information level:" ), container );
319 QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); 326 QWhatsThis::add( l, tr( "Select information level for Ipkg." ) );
320 layout->addWidget( l ); 327 layout->addMultiCellWidget( l, 4, 4, 0, 1 );
321 328
322 m_optVerboseIpkg = new QComboBox( container ); 329 m_optVerboseIpkg = new QComboBox( container );
323 QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); 330 QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) );
324 m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); 331 m_optVerboseIpkg->insertItem( tr( "Errors only" ) );
325 m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); 332 m_optVerboseIpkg->insertItem( tr( "Normal messages" ) );
326 m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); 333 m_optVerboseIpkg->insertItem( tr( "Informative messages" ) );
327 m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); 334 m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) );
328 layout->addWidget( m_optVerboseIpkg ); 335 layout->addMultiCellWidget( m_optVerboseIpkg, 5, 5, 0, 1 );
336
337 l = new QLabel( tr( "Package source lists directory:" ), container );
338 QWhatsThis::add( l, tr( "Enter the directory where package source feed information is stored." ) );
339 layout->addMultiCellWidget( l, 6, 6, 0, 1 );
340
341 m_optSourceLists = new QLineEdit( container );
342 QWhatsThis::add( m_optSourceLists, tr( "Enter the directory where package source feed information is stored." ) );
343 layout->addWidget( m_optSourceLists, 7, 0 );
344 QPushButton *btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, container );
345 btn->setMaximumWidth( btn->height() );
346 QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) );
347 connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) );
348 layout->addWidget( btn, 7, 1 );
329 349
330 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); 350 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
331} 351}
332 352
333void OIpkgConfigDlg::initData() 353void OIpkgConfigDlg::initData()
334{ 354{
335 // Read ipkg configuration (server/destination/proxy) information 355 // Read ipkg configuration (server/destination/proxy) information
336 if ( m_ipkg && !m_installOptions ) 356 if ( m_ipkg && !m_installOptions )
337 { 357 {
338 m_configs = m_ipkg->configItems(); 358 m_configs = m_ipkg->configItems();
339 if ( m_configs ) 359 if ( m_configs )
340 { 360 {
341 for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) 361 for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt )
342 { 362 {
343 OConfItem *config = configIt.current(); 363 OConfItem *config = configIt.current();
344 364
345 // Add configuration item to the appropriate dialog controls 365 // Add configuration item to the appropriate dialog controls
346 if ( config ) 366 if ( config )
347 { 367 {
348 if ( config->type() == OConfItem::Source ) 368 switch ( config->type() )
349 { 369 {
350 m_serverList->insertItem( config->name() ); 370 case OConfItem::Source : m_serverList->insertItem( config->name() ); break;
351 } 371 case OConfItem::Destination : m_destList->insertItem( config->name() ); break;
352 else if ( config->type() == OConfItem::Destination ) 372 case OConfItem::Option :
353 { 373 {
354 m_destList->insertItem( config->name() ); 374 if ( config->name() == "http_proxy" )
355 } 375 {
356 else if ( config->type() == OConfItem::Option ) 376 m_proxyHttpServer->setText( config->value() );
357 { 377 m_proxyHttpActive->setChecked( config->active() );
358 if ( config->name() == "http_proxy" ) 378 }
359 { 379 else if ( config->name() == "ftp_proxy" )
360 m_proxyHttpServer->setText( config->value() ); 380 {
361 m_proxyHttpActive->setChecked( config->active() ); 381 m_proxyFtpServer->setText( config->value() );
362 } 382 m_proxyFtpActive->setChecked( config->active() );
363 else if ( config->name() == "ftp_proxy" ) 383 }
364 { 384 else if ( config->name() == "proxy_username" )
365 m_proxyFtpServer->setText( config->value() ); 385 {
366 m_proxyFtpActive->setChecked( config->active() ); 386 m_proxyUsername->setText( config->value() );
367 } 387 }
368 else if ( config->name() == "proxy_username" ) 388 else if ( config->name() == "proxy_password" )
369 { 389 {
370 m_proxyUsername->setText( config->value() ); 390 m_proxyPassword->setText( config->value() );
371 } 391 }
372 else if ( config->name() == "proxy_password" ) 392 }
373 { 393 break;
374 m_proxyPassword->setText( config->value() ); 394 case OConfItem::Other :
375 } 395 {
376 } 396 if ( config->name() == "lists_dir" )
397 m_optSourceLists->setText( config->value() );
398 else // TODO - use proper libipkg define
399 m_optSourceLists->setText( "/usr/lib/ipkg/lists" );
400 }
401 break;
402 default : break;
403 };
377 } 404 }
378 } 405 }
379 } 406 }
380 } 407 }
381 408
382 // Get Ipkg execution options 409 // Get Ipkg execution options
383 int options = m_ipkg->ipkgExecOptions(); 410 int options = m_ipkg->ipkgExecOptions();
384 if ( options & FORCE_DEPENDS ) 411 if ( options & FORCE_DEPENDS )
385 m_optForceDepends->setChecked( true ); 412 m_optForceDepends->setChecked( true );
386 if ( options & FORCE_REINSTALL ) 413 if ( options & FORCE_REINSTALL )
387 m_optForceReinstall->setChecked( true ); 414 m_optForceReinstall->setChecked( true );
388 if ( options & FORCE_REMOVE ) 415 if ( options & FORCE_REMOVE )
389 m_optForceRemove->setChecked( true ); 416 m_optForceRemove->setChecked( true );
390 if ( options & FORCE_OVERWRITE ) 417 if ( options & FORCE_OVERWRITE )
391 m_optForceOverwrite->setChecked( true ); 418 m_optForceOverwrite->setChecked( true );
392 419
393 m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); 420 m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() );
394} 421}
395 422
396void OIpkgConfigDlg::slotServerSelected( int index ) 423void OIpkgConfigDlg::slotServerSelected( int index )
397{ 424{
398 m_serverCurrent = index; 425 m_serverCurrent = index;
399 426
400 // Enable Edit and Delete buttons 427 // Enable Edit and Delete buttons
401 m_serverEditBtn->setEnabled( true ); 428 m_serverEditBtn->setEnabled( true );
402 m_serverDeleteBtn->setEnabled( true ); 429 m_serverDeleteBtn->setEnabled( true );
403} 430}
404 431
405void OIpkgConfigDlg::slotServerNew() 432void OIpkgConfigDlg::slotServerNew()
406{ 433{
407 OConfItem *server = new OConfItem( OConfItem::Source ); 434 OConfItem *server = new OConfItem( OConfItem::Source );
408 435
409 OIpkgServerDlg dlg( server, this ); 436 OIpkgServerDlg dlg( server, this );
410 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) 437 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted )
411 { 438 {
412 // Add to configuration option list 439 // Add to configuration option list
413 m_configs->append( server ); 440 m_configs->append( server );
414 m_configs->sort(); 441 m_configs->sort();
415 442
416 // Add to server list 443 // Add to server list
417 m_serverList->insertItem( server->name() ); 444 m_serverList->insertItem( server->name() );
418 m_serverList->setCurrentItem( m_serverList->count() ); 445 m_serverList->setCurrentItem( m_serverList->count() );
419 } 446 }
420 else 447 else
421 delete server; 448 delete server;
422} 449}
423 450
424void OIpkgConfigDlg::slotServerEdit() 451void OIpkgConfigDlg::slotServerEdit()
425{ 452{
426 // Find selected server in list 453 // Find selected server in list
427 OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); 454 OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() );
428 455
429 // Edit server 456 // Edit server
430 if ( server ) 457 if ( server )
431 { 458 {
432 QString origName = server->name(); 459 QString origName = server->name();
433 OIpkgServerDlg dlg( server, this ); 460 OIpkgServerDlg dlg( server, this );
434 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) 461 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted )
435 { 462 {
436 // Check to see if name has changed, if so update the server list 463 // Check to see if name has changed, if so update the server list
437 if ( server->name() != origName ) 464 if ( server->name() != origName )
438 m_serverList->changeItem( server->name(), m_serverCurrent ); 465 m_serverList->changeItem( server->name(), m_serverCurrent );
439 } 466 }
440 } 467 }
441} 468}
442 469
443void OIpkgConfigDlg::slotServerDelete() 470void OIpkgConfigDlg::slotServerDelete()
444{ 471{
445 // Find selected server in list 472 // Find selected server in list
446 OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); 473 OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() );
447 474
448 // Delete server 475 // Delete server
449 if ( server ) 476 if ( server )
450 { 477 {
451 m_configs->removeRef( server ); 478 m_configs->removeRef( server );
452 m_serverList->removeItem( m_serverCurrent ); 479 m_serverList->removeItem( m_serverCurrent );
453 } 480 }
454} 481}
455 482
456void OIpkgConfigDlg::slotDestSelected( int index ) 483void OIpkgConfigDlg::slotDestSelected( int index )
457{ 484{
458 m_destCurrent = index; 485 m_destCurrent = index;
459 486
460 // Enable Edit and Delete buttons 487 // Enable Edit and Delete buttons
461 m_destEditBtn->setEnabled( true ); 488 m_destEditBtn->setEnabled( true );
462 m_destDeleteBtn->setEnabled( true ); 489 m_destDeleteBtn->setEnabled( true );
463} 490}
464 491
465void OIpkgConfigDlg::slotDestNew() 492void OIpkgConfigDlg::slotDestNew()
466{ 493{
467 OConfItem *dest = new OConfItem( OConfItem::Destination ); 494 OConfItem *dest = new OConfItem( OConfItem::Destination );
468 495
469 OIpkgDestDlg dlg( dest, this ); 496 OIpkgDestDlg dlg( dest, this );
470 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) 497 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted )
471 { 498 {
472 // Add to configuration option list 499 // Add to configuration option list
473 m_configs->append( dest ); 500 m_configs->append( dest );
474 m_configs->sort(); 501 m_configs->sort();
475 502
476 // Add to destination list 503 // Add to destination list
477 m_destList->insertItem( dest->name() ); 504 m_destList->insertItem( dest->name() );
478 m_destList->setCurrentItem( m_destList->count() ); 505 m_destList->setCurrentItem( m_destList->count() );
479 } 506 }
480 else 507 else
481 delete dest; 508 delete dest;
482} 509}
483 510
484void OIpkgConfigDlg::slotDestEdit() 511void OIpkgConfigDlg::slotDestEdit()
485{ 512{
486 // Find selected destination in list 513 // Find selected destination in list
487 OConfItem *dest = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); 514 OConfItem *dest = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() );
488 515
489 // Edit destination 516 // Edit destination
490 if ( dest ) 517 if ( dest )
491 { 518 {
492 QString origName = dest->name(); 519 QString origName = dest->name();
493 OIpkgDestDlg dlg( dest, this ); 520 OIpkgDestDlg dlg( dest, this );
494 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) 521 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted )
495 { 522 {
496 // Check to see if name has changed, if so update the dest list 523 // Check to see if name has changed, if so update the dest list
497 if ( dest->name() != origName ) 524 if ( dest->name() != origName )
498 m_destList->changeItem( dest->name(), m_destCurrent ); 525 m_destList->changeItem( dest->name(), m_destCurrent );
499 } 526 }
500 } 527 }
501} 528}
502 529
503void OIpkgConfigDlg::slotDestDelete() 530void OIpkgConfigDlg::slotDestDelete()
504{ 531{
505 // Find selected destination in list 532 // Find selected destination in list
506 OConfItem *destination = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); 533 OConfItem *destination = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() );
507 534
508 // Delete destination 535 // Delete destination
509 if ( destination ) 536 if ( destination )
510 { 537 {
511 m_configs->removeRef( destination ); 538 m_configs->removeRef( destination );
512 m_destList->removeItem( m_destCurrent ); 539 m_destList->removeItem( m_destCurrent );
513 } 540 }
514} 541}
515 542
543void OIpkgConfigDlg::slotOptSelectSourceListsPath()
544{
545 QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_optSourceLists->text() );
546 if ( path.at( path.length() - 1 ) == '/' )
547 path.truncate( path.length() - 1 );
548 if ( !path.isNull() )
549 m_optSourceLists->setText( path );
550}
551
516OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) 552OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent )
517 : QDialog( parent, QString::null, true, WStyle_ContextHelp ) 553 : QDialog( parent, QString::null, true, WStyle_ContextHelp )
518 , m_server( server ) 554 , m_server( server )
519{ 555{
520 setCaption( tr( "Edit Server" ) ); 556 setCaption( tr( "Edit Server" ) );
521 557
522 // Initialize UI 558 // Initialize UI
523 QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); 559 QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 );
524 560
525 m_active = new QCheckBox( tr( "Active" ), this ); 561 m_active = new QCheckBox( tr( "Active" ), this );
526 QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); 562 QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) );
527 layout->addWidget( m_active ); 563 layout->addWidget( m_active );
528 564
529 layout->addStretch(); 565 layout->addStretch();
530 566
531 QLabel *label = new QLabel( tr( "Name:" ), this ); 567 QLabel *label = new QLabel( tr( "Name:" ), this );
532 QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); 568 QWhatsThis::add( label, tr( "Enter the name of this entry here." ) );
533 layout->addWidget( label ); 569 layout->addWidget( label );
534 m_name = new QLineEdit( this ); 570 m_name = new QLineEdit( this );
535 QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) ); 571 QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) );
536 layout->addWidget( m_name ); 572 layout->addWidget( m_name );
537 573
538 layout->addStretch(); 574 layout->addStretch();
539 575
540 label = new QLabel( tr( "Address:" ), this ); 576 label = new QLabel( tr( "Address:" ), this );
541 QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) ); 577 QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) );
542 layout->addWidget( label ); 578 layout->addWidget( label );
543 m_location = new QLineEdit( this ); 579 m_location = new QLineEdit( this );
544 QWhatsThis::add( m_location, tr( "Enter the URL address of this entry here." ) ); 580 QWhatsThis::add( m_location, tr( "Enter the URL address of this entry here." ) );
545 layout->addWidget( m_location ); 581 layout->addWidget( m_location );
546 582
547 layout->addStretch(); 583 layout->addStretch();
548 584
549 m_compressed = new QCheckBox( tr( "Compressed server feed" ), this ); 585 m_compressed = new QCheckBox( tr( "Compressed server feed" ), this );
550 QWhatsThis::add( m_compressed, tr( "Tap here to indicate whether the server support compressed archives or not." ) ); 586 QWhatsThis::add( m_compressed, tr( "Tap here to indicate whether the server support compressed archives or not." ) );
551 layout->addWidget( m_compressed ); 587 layout->addWidget( m_compressed );
552 588
553 // Populate initial information 589 // Populate initial information
554 if ( m_server ) 590 if ( m_server )
555 { 591 {
556 m_name->setText( m_server->name() ); 592 m_name->setText( m_server->name() );
557 m_location->setText( m_server->value() ); 593 m_location->setText( m_server->value() );
558 m_compressed->setChecked( m_server->features().contains( "Compressed" ) ); 594 m_compressed->setChecked( m_server->features().contains( "Compressed" ) );
559 m_active->setChecked( m_server->active() ); 595 m_active->setChecked( m_server->active() );
560 } 596 }
561} 597}
562 598
563void OIpkgServerDlg::accept() 599void OIpkgServerDlg::accept()
564{ 600{
565 // Save information entered 601 // Save information entered
566 QString name = m_name->text(); 602 QString name = m_name->text();
567 name.replace( QRegExp( " " ), "_" ); 603 name.replace( QRegExp( " " ), "_" );
568 m_server->setName( name ); 604 m_server->setName( name );
569 m_server->setValue( m_location->text() ); 605 m_server->setValue( m_location->text() );
570 m_compressed->isChecked() ? m_server->setFeatures( "Compressed" ) 606 m_compressed->isChecked() ? m_server->setFeatures( "Compressed" )
571 : m_server->setFeatures( QString::null ); 607 : m_server->setFeatures( QString::null );
572 m_server->setActive( m_active->isChecked() ); 608 m_server->setActive( m_active->isChecked() );
573 609
574 QDialog::accept(); 610 QDialog::accept();
575} 611}
576 612
577OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent ) 613OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent )
578 : QDialog( parent, QString::null, true, WStyle_ContextHelp ) 614 : QDialog( parent, QString::null, true, WStyle_ContextHelp )
579 , m_dest( dest ) 615 , m_dest( dest )
580{ 616{
581 setCaption( tr( "Edit Destination" ) ); 617 setCaption( tr( "Edit Destination" ) );
582 618
583 // Initialize UI 619 // Initialize UI
584 QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); 620 QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 );
585 621
586 m_active = new QCheckBox( tr( "Active" ), this ); 622 m_active = new QCheckBox( tr( "Active" ), this );
587 QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); 623 QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) );
588 layout->addWidget( m_active ); 624 layout->addWidget( m_active );
589 625
590 layout->addStretch(); 626 layout->addStretch();
591 627
592 QLabel *label = new QLabel( tr( "Name:" ), this ); 628 QLabel *label = new QLabel( tr( "Name:" ), this );
593 QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); 629 QWhatsThis::add( label, tr( "Enter the name of this entry here." ) );
594 layout->addWidget( label ); 630 layout->addWidget( label );
595 m_name = new QLineEdit( this ); 631 m_name = new QLineEdit( this );
596 QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) ); 632 QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) );
597 layout->addWidget( m_name ); 633 layout->addWidget( m_name );
598 634
599 layout->addStretch(); 635 layout->addStretch();
600 636
601 label = new QLabel( tr( "Location:" ), this ); 637 label = new QLabel( tr( "Location:" ), this );
602 QWhatsThis::add( label, tr( "Enter the absolute directory path of this entry here." ) ); 638 QWhatsThis::add( label, tr( "Enter the absolute directory path of this entry here." ) );
603 layout->addWidget( label ); 639 layout->addWidget( label );
604 640
605 QHBoxLayout *layout2 = new QHBoxLayout( this, 2, 4 ); 641 QHBoxLayout *layout2 = new QHBoxLayout( this, 2, 4 );
606 layout->addLayout( layout2 ); 642 layout->addLayout( layout2 );
607 643
608 m_location = new QLineEdit( this ); 644 m_location = new QLineEdit( this );
609 QWhatsThis::add( m_location, tr( "Enter the absolute directory path of this entry here." ) ); 645 QWhatsThis::add( m_location, tr( "Enter the absolute directory path of this entry here." ) );
610 layout2->addWidget( m_location ); 646 layout2->addWidget( m_location );
611 QPushButton *btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, this ); 647 QPushButton *btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, this );
612 btn->setMaximumWidth( btn->height() ); 648 btn->setMaximumWidth( btn->height() );
613 QWhatsThis::add( btn, tr( "Tap here to select the desired location." ) ); 649 QWhatsThis::add( btn, tr( "Tap here to select the desired location." ) );
614 connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) ); 650 connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) );
615 layout2->addWidget( btn ); 651 layout2->addWidget( btn );
616 652
617 // Populate initial information 653 // Populate initial information
618 if ( m_dest ) 654 if ( m_dest )
619 { 655 {
620 m_name->setText( m_dest->name() ); 656 m_name->setText( m_dest->name() );
621 m_location->setText( m_dest->value() ); 657 m_location->setText( m_dest->value() );
622 m_active->setChecked( m_dest->active() ); 658 m_active->setChecked( m_dest->active() );
623 } 659 }
624} 660}
625 661
626void OIpkgDestDlg::accept() 662void OIpkgDestDlg::accept()
627{ 663{
628 // Save information entered 664 // Save information entered
629 QString name = m_name->text(); 665 QString name = m_name->text();
630 name.replace( QRegExp( " " ), "_" ); 666 name.replace( QRegExp( " " ), "_" );
631 m_dest->setName( name ); 667 m_dest->setName( name );
632 m_dest->setValue( m_location->text() ); 668 m_dest->setValue( m_location->text() );
633 m_dest->setActive( m_active->isChecked() ); 669 m_dest->setActive( m_active->isChecked() );
634 670
635 QDialog::accept(); 671 QDialog::accept();
636} 672}
637 673
638void OIpkgDestDlg::slotSelectPath() 674void OIpkgDestDlg::slotSelectPath()
639{ 675{
640 QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_location->text() ); 676 QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_location->text() );
641 if ( path.at( path.length() - 1 ) == '/' ) 677 if ( path.at( path.length() - 1 ) == '/' )
642 path.truncate( path.length() - 1 ); 678 path.truncate( path.length() - 1 );
643 if ( !path.isNull() ) 679 if ( !path.isNull() )
644 m_location->setText( path ); 680 m_location->setText( path );
645} 681}
646 682
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.h b/noncore/settings/packagemanager/oipkgconfigdlg.h
index 0fb2e16..9e23b62 100644
--- a/noncore/settings/packagemanager/oipkgconfigdlg.h
+++ b/noncore/settings/packagemanager/oipkgconfigdlg.h
@@ -1,164 +1,167 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 3
4 Copyright (c) 2003 Dan Williams <drw@handhelds.org> 4 Copyright (c) 2003 Dan Williams <drw@handhelds.org>
5 =. 5 =.
6 .=l. 6 .=l.
7 .>+-= 7 .>+-=
8_;:, .> :=|. This program is free software; you can 8_;:, .> :=|. This program is free software; you can
9.> <`_, > . <= redistribute it and/or modify it under 9.> <`_, > . <= redistribute it and/or modify it under
10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
11.="- .-=="i, .._ License as published by the Free Software 11.="- .-=="i, .._ License as published by the Free Software
12- . .-<_> .<> Foundation; either version 2 of the License, 12- . .-<_> .<> Foundation; either version 2 of the License,
13 ._= =} : or (at your option) any later version. 13 ._= =} : or (at your option) any later version.
14 .%`+i> _;_. 14 .%`+i> _;_.
15 .i_,=:_. -<s. This program is distributed in the hope that 15 .i_,=:_. -<s. This program is distributed in the hope that
16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
17 : .. .:, . . . without even the implied warranty of 17 : .. .:, . . . without even the implied warranty of
18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.= = ; Library General Public License for more 20..}^=.= = ; Library General Public License for more
21++= -. .` .: details. 21++= -. .` .: details.
22: = ...= . :.=- 22: = ...= . :.=-
23-. .:....=;==+<; You should have received a copy of the GNU 23-. .:....=;==+<; You should have received a copy of the GNU
24 -_. . . )=. = Library General Public License along with 24 -_. . . )=. = Library General Public License along with
25 -- :-=` this library; see the file COPYING.LIB. 25 -- :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32 32
33#ifndef OIPKGCONFIGDLG_H 33#ifndef OIPKGCONFIGDLG_H
34#define OIPKGCONFIGDLG_H 34#define OIPKGCONFIGDLG_H
35 35
36#include <opie2/otabwidget.h> 36#include <opie2/otabwidget.h>
37 37
38#include <qdialog.h> 38#include <qdialog.h>
39#include <qlayout.h> 39#include <qlayout.h>
40 40
41#include "oipkg.h" 41#include "oipkg.h"
42 42
43class QCheckBox; 43class QCheckBox;
44class QComboBox; 44class QComboBox;
45class QLineEdit; 45class QLineEdit;
46class QListBox; 46class QListBox;
47class QPushButton; 47class QPushButton;
48 48
49class OIpkgConfigDlg : public QDialog 49class OIpkgConfigDlg : public QDialog
50{ 50{
51 Q_OBJECT 51 Q_OBJECT
52 52
53public: 53public:
54 OIpkgConfigDlg( OIpkg *ipkg = 0l, bool installOptions = false, QWidget *parent = 0l ); 54 OIpkgConfigDlg( OIpkg *ipkg = 0l, bool installOptions = false, QWidget *parent = 0l );
55 55
56protected slots: 56protected slots:
57 void accept(); 57 void accept();
58 void reject(); 58 void reject();
59 59
60private: 60private:
61 OIpkg *m_ipkg; // Pointer to Ipkg class for retrieving/saving configuration options 61 OIpkg *m_ipkg; // Pointer to Ipkg class for retrieving/saving configuration options
62 OConfItemList *m_configs; // Local list of configuration items 62 OConfItemList *m_configs; // Local list of configuration items
63 63
64 bool m_installOptions; // If true, will only display the Options tab 64 bool m_installOptions; // If true, will only display the Options tab
65 65
66 // Server/Destination cached information 66 // Server/Destination cached information
67 int m_serverCurrent; // Index of currently selected server in m_serverList 67 int m_serverCurrent; // Index of currently selected server in m_serverList
68 int m_destCurrent; // Index of currently selected destination in m_destList 68 int m_destCurrent; // Index of currently selected destination in m_destList
69 69
70 // UI controls 70 // UI controls
71 QVBoxLayout m_layout; // Main dialog layout control 71 QVBoxLayout m_layout; // Main dialog layout control
72 Opie::Ui::OTabWidget m_tabWidget; // Main tab widget control 72 Opie::Ui::OTabWidget m_tabWidget; // Main tab widget control
73 QWidget *m_serverWidget; // Widget containing server configuration controls 73 QWidget *m_serverWidget; // Widget containing server configuration controls
74 QWidget *m_destWidget; // Widget containing destination configuration controls 74 QWidget *m_destWidget; // Widget containing destination configuration controls
75 QWidget *m_proxyWidget; // Widget containing proxy configuration controls 75 QWidget *m_proxyWidget; // Widget containing proxy configuration controls
76 QWidget *m_optionsWidget; // Widget containing ipkg execution configuration controls 76 QWidget *m_optionsWidget; // Widget containing ipkg execution configuration controls
77 77
78 // Server configuration UI controls 78 // Server configuration UI controls
79 QListBox *m_serverList; // Server list selection 79 QListBox *m_serverList; // Server list selection
80 QPushButton *m_serverEditBtn; // Server edit button 80 QPushButton *m_serverEditBtn; // Server edit button
81 QPushButton *m_serverDeleteBtn; // Server edit button 81 QPushButton *m_serverDeleteBtn; // Server edit button
82 82
83 // Destination configuration UI controls 83 // Destination configuration UI controls
84 QListBox *m_destList; // Destination list selection 84 QListBox *m_destList; // Destination list selection
85 QPushButton *m_destEditBtn; // Destination edit button 85 QPushButton *m_destEditBtn; // Destination edit button
86 QPushButton *m_destDeleteBtn; // Destination edit button 86 QPushButton *m_destDeleteBtn; // Destination edit button
87 87
88 // Proxy server configuration UI controls 88 // Proxy server configuration UI controls
89 QLineEdit *m_proxyHttpServer; // HTTP proxy server URL edit box 89 QLineEdit *m_proxyHttpServer; // HTTP proxy server URL edit box
90 QCheckBox *m_proxyHttpActive; // Activate HTTP proxy check box 90 QCheckBox *m_proxyHttpActive; // Activate HTTP proxy check box
91 QLineEdit *m_proxyFtpServer; // FTP proxy server edit box 91 QLineEdit *m_proxyFtpServer; // FTP proxy server edit box
92 QCheckBox *m_proxyFtpActive; // Activate FTP proxy check box 92 QCheckBox *m_proxyFtpActive; // Activate FTP proxy check box
93 QLineEdit *m_proxyUsername; // Proxy server username edit box 93 QLineEdit *m_proxyUsername; // Proxy server username edit box
94 QLineEdit *m_proxyPassword; // Proxy server password edit box 94 QLineEdit *m_proxyPassword; // Proxy server password edit box
95 95
96 // Options configuration UI controls 96 // Options configuration UI controls
97 QCheckBox *m_optForceDepends; // Force depends ipkg option checkbox 97 QCheckBox *m_optForceDepends; // Force depends ipkg option checkbox
98 QCheckBox *m_optForceReinstall; // Force reinstall ipkg option checkbox 98 QCheckBox *m_optForceReinstall; // Force reinstall ipkg option checkbox
99 QCheckBox *m_optForceRemove; // Force remove ipkg option checkbox 99 QCheckBox *m_optForceRemove; // Force remove ipkg option checkbox
100 QCheckBox *m_optForceOverwrite; // Force overwrite ipkg option checkbox 100 QCheckBox *m_optForceOverwrite; // Force overwrite ipkg option checkbox
101 QComboBox *m_optVerboseIpkg; // Ipkg verbosity option selection 101 QComboBox *m_optVerboseIpkg; // Ipkg verbosity option selection
102 QLineEdit *m_optSourceLists; // Ipkg source lists destination directory
102 103
103 void initServerWidget(); 104 void initServerWidget();
104 void initDestinationWidget(); 105 void initDestinationWidget();
105 void initProxyWidget(); 106 void initProxyWidget();
106 void initOptionsWidget(); 107 void initOptionsWidget();
107 108
108 void initData(); 109 void initData();
109 110
110private slots: 111private slots:
111 void slotServerSelected( int index ); 112 void slotServerSelected( int index );
112 void slotServerNew(); 113 void slotServerNew();
113 void slotServerEdit(); 114 void slotServerEdit();
114 void slotServerDelete(); 115 void slotServerDelete();
115 116
116 void slotDestSelected( int index ); 117 void slotDestSelected( int index );
117 void slotDestNew(); 118 void slotDestNew();
118 void slotDestEdit(); 119 void slotDestEdit();
119 void slotDestDelete(); 120 void slotDestDelete();
121
122 void slotOptSelectSourceListsPath();
120}; 123};
121 124
122class OIpkgServerDlg : public QDialog 125class OIpkgServerDlg : public QDialog
123{ 126{
124 Q_OBJECT 127 Q_OBJECT
125 128
126public: 129public:
127 OIpkgServerDlg( OConfItem *server = 0l, QWidget *parent = 0l ); 130 OIpkgServerDlg( OConfItem *server = 0l, QWidget *parent = 0l );
128 131
129protected slots: 132protected slots:
130 void accept(); 133 void accept();
131 134
132private: 135private:
133 OConfItem *m_server; 136 OConfItem *m_server;
134 137
135 // UI controls 138 // UI controls
136 QLineEdit *m_name; // Server name edit box 139 QLineEdit *m_name; // Server name edit box
137 QLineEdit *m_location; // Server location URL edit box 140 QLineEdit *m_location; // Server location URL edit box
138 QCheckBox *m_compressed; // Indicates whether the server is a 'src/gz' feed 141 QCheckBox *m_compressed; // Indicates whether the server is a 'src/gz' feed
139 QCheckBox *m_active; // Indicates whether the server is activated 142 QCheckBox *m_active; // Indicates whether the server is activated
140}; 143};
141 144
142class OIpkgDestDlg : public QDialog 145class OIpkgDestDlg : public QDialog
143{ 146{
144 Q_OBJECT 147 Q_OBJECT
145 148
146public: 149public:
147 OIpkgDestDlg( OConfItem *dest = 0l, QWidget *parent = 0l ); 150 OIpkgDestDlg( OConfItem *dest = 0l, QWidget *parent = 0l );
148 151
149protected slots: 152protected slots:
150 void accept(); 153 void accept();
151 154
152private: 155private:
153 OConfItem *m_dest; 156 OConfItem *m_dest;
154 157
155 // UI controls 158 // UI controls
156 QLineEdit *m_name; // Destination name edit box 159 QLineEdit *m_name; // Destination name edit box
157 QLineEdit *m_location; // Destination location URL edit box 160 QLineEdit *m_location; // Destination location URL edit box
158 QCheckBox *m_active; // Indicates whether the destination is activated 161 QCheckBox *m_active; // Indicates whether the destination is activated
159 162
160private slots: 163private slots:
161 void slotSelectPath(); 164 void slotSelectPath();
162}; 165};
163 166
164#endif 167#endif
diff --git a/noncore/settings/packagemanager/opie-packagemanager.control b/noncore/settings/packagemanager/opie-packagemanager.control
index 5da7a84..94348dd 100644
--- a/noncore/settings/packagemanager/opie-packagemanager.control
+++ b/noncore/settings/packagemanager/opie-packagemanager.control
@@ -1,10 +1,10 @@
1Package: opie-packagemanager 1Package: opie-packagemanager
2Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop 2Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop
3Priority: optional 3Priority: optional
4Section: opie/settings 4Section: opie/settings
5Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg (>=0.99.143) 5Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg (>=0.99.143)
6Replaces: packagemanager 6Replaces: packagemanager
7Architecture: arm 7Architecture: arm
8Maintainer: Dan Williams (drw@handhelds.org) 8Maintainer: Dan Williams (drw@handhelds.org)
9Description: Opie package management client 9Description: Opie package management client
10Version: 0.6.1$EXTRAVERSION 10Version: 0.6.2$EXTRAVERSION