summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/packagemanager/oconfitem.h7
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp7
-rw-r--r--noncore/settings/packagemanager/opie-packagemanager.control4
3 files changed, 5 insertions, 13 deletions
diff --git a/noncore/settings/packagemanager/oconfitem.h b/noncore/settings/packagemanager/oconfitem.h
index 7b52ce4..9972c00 100644
--- a/noncore/settings/packagemanager/oconfitem.h
+++ b/noncore/settings/packagemanager/oconfitem.h
@@ -17,54 +17,49 @@ _;:, .> :=|. This program is free software; you can
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=0x01, 41 enum Type { Source, Destination, Option, Arch, NotDefined };
42 GzSource=0x02,
43 Destination=0x04,
44 Option=0x08,
45 Arch=0x10,
46 NotDefined=0x20 };
47 42
48 OConfItem( Type type = NotDefined, const QString &name = QString::null, 43 OConfItem( Type type = NotDefined, const QString &name = QString::null,
49 const QString &value = QString::null, const QString &features = QString::null, 44 const QString &value = QString::null, const QString &features = QString::null,
50 bool active = true ); 45 bool active = true );
51 46
52 Type type() { return m_type; } 47 Type type() { return m_type; }
53 const QString &name() { return m_name; } 48 const QString &name() { return m_name; }
54 const QString &value() { return m_value; } 49 const QString &value() { return m_value; }
55 const QString &features() { return m_features; } 50 const QString &features() { return m_features; }
56 bool active() { return m_active; } 51 bool active() { return m_active; }
57 52
58 void setType( Type type ) { m_type = type; } 53 void setType( Type type ) { m_type = type; }
59 void setName( const QString &name ) { m_name = name; } 54 void setName( const QString &name ) { m_name = name; }
60 void setValue( const QString &value ) { m_value = value; } 55 void setValue( const QString &value ) { m_value = value; }
61 void setFeatures( const QString &features ) { m_features = features; } 56 void setFeatures( const QString &features ) { m_features = features; }
62 void setActive( bool active ) { m_active = active; } 57 void setActive( bool active ) { m_active = active; }
63 58
64private: 59private:
65 Type m_type; // Type of configuration item 60 Type m_type; // Type of configuration item
66 QString m_name; // Name of item 61 QString m_name; // Name of item
67 QString m_value; // Value of item 62 QString m_value; // Value of item
68 QString m_features; // Comma-deliminated list of features this item supports 63 QString m_features; // Comma-deliminated list of features this item supports
69 bool m_active; // Indicates whether item is currently active 64 bool m_active; // Indicates whether item is currently active
70}; 65};
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp
index a885ef8..f2d7e39 100644
--- a/noncore/settings/packagemanager/oipkg.cpp
+++ b/noncore/settings/packagemanager/oipkg.cpp
@@ -93,50 +93,49 @@ OIpkg::OIpkg( Config *config, QObject *parent, const char *name )
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::Type)((int)OConfItem::Source | 117 return filterConfItems( OConfItem::Source );
118 (int)OConfItem::GzSource) );
119} 118}
120 119
121OConfItemList *OIpkg::destinations() 120OConfItemList *OIpkg::destinations()
122{ 121{
123 // Retrieve only destinations 122 // Retrieve only destinations
124 return filterConfItems( OConfItem::Destination ); 123 return filterConfItems( OConfItem::Destination );
125} 124}
126 125
127OConfItemList *OIpkg::options() 126OConfItemList *OIpkg::options()
128{ 127{
129 // Retrieve only destinations 128 // Retrieve only destinations
130 return filterConfItems( OConfItem::Option ); 129 return filterConfItems( OConfItem::Option );
131} 130}
132 131
133void OIpkg::setConfigItems( OConfItemList *configList ) 132void OIpkg::setConfigItems( OConfItemList *configList )
134{ 133{
135 if ( m_confInfo ) 134 if ( m_confInfo )
136 delete m_confInfo; 135 delete m_confInfo;
137 136
138 m_confInfo = configList; 137 m_confInfo = configList;
139 138
140 // Write out new /etc/ipkg.conf 139 // Write out new /etc/ipkg.conf
141 QFile confFile( IPKG_CONF ); 140 QFile confFile( IPKG_CONF );
142 if ( confFile.open( IO_WriteOnly ) ) 141 if ( confFile.open( IO_WriteOnly ) )
@@ -523,49 +522,48 @@ void OIpkg::loadConfiguration()
523 522
524 QStringList::Iterator lastFile = confFiles.end(); 523 QStringList::Iterator lastFile = confFiles.end();
525 for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it ) 524 for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it )
526 { 525 {
527 // Create absolute file path if necessary 526 // Create absolute file path if necessary
528 QString absFile = (*it); 527 QString absFile = (*it);
529 if ( !absFile.startsWith( "/" ) ) 528 if ( !absFile.startsWith( "/" ) )
530 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); 529 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" );
531 530
532 // Read in file 531 // Read in file
533 QFile f( absFile ); 532 QFile f( absFile );
534 if ( f.open( IO_ReadOnly ) ) 533 if ( f.open( IO_ReadOnly ) )
535 { 534 {
536 QTextStream s( &f ); 535 QTextStream s( &f );
537 while ( !s.eof() ) 536 while ( !s.eof() )
538 { 537 {
539 538
540 QString line = s.readLine().simplifyWhiteSpace(); 539 QString line = s.readLine().simplifyWhiteSpace();
541 540
542 // Parse line and save info to the conf options list 541 // Parse line and save info to the conf options list
543 if ( !line.isEmpty() ) 542 if ( !line.isEmpty() )
544 { 543 {
545 if ( !line.startsWith( "#" ) || 544 if ( !line.startsWith( "#" ) ||
546 line.startsWith( "#src" ) || 545 line.startsWith( "#src" ) ||
547 line.startsWith( "#src/gz" ) ||
548 line.startsWith( "#dest" ) || 546 line.startsWith( "#dest" ) ||
549 line.startsWith( "#arch" ) || 547 line.startsWith( "#arch" ) ||
550 line.startsWith( "#option" ) ) 548 line.startsWith( "#option" ) )
551 { 549 {
552 int pos = line.find( ' ', 1 ); 550 int pos = line.find( ' ', 1 );
553 551
554 // Type 552 // Type
555 QString typeStr = line.left( pos ); 553 QString typeStr = line.left( pos );
556 OConfItem::Type type; 554 OConfItem::Type type;
557 QString features; 555 QString features;
558 if ( typeStr == "src" || typeStr == "#src" ) 556 if ( typeStr == "src" || typeStr == "#src" )
559 type = OConfItem::Source; 557 type = OConfItem::Source;
560 else if ( typeStr == "src/gz" || typeStr == "#src/gz" ) 558 else if ( typeStr == "src/gz" || typeStr == "#src/gz" )
561 { 559 {
562 type = OConfItem::Source; 560 type = OConfItem::Source;
563 features = "Compressed"; 561 features = "Compressed";
564 } 562 }
565 else if ( typeStr == "dest" || typeStr == "#dest" ) 563 else if ( typeStr == "dest" || typeStr == "#dest" )
566 type = OConfItem::Destination; 564 type = OConfItem::Destination;
567 else if ( typeStr == "option" || typeStr == "#option" ) 565 else if ( typeStr == "option" || typeStr == "#option" )
568 type = OConfItem::Option; 566 type = OConfItem::Option;
569 else if ( typeStr == "arch" || typeStr == "#arch" ) 567 else if ( typeStr == "arch" || typeStr == "#arch" )
570 type = OConfItem::Arch; 568 type = OConfItem::Arch;
571 else 569 else
@@ -599,50 +597,49 @@ void OIpkg::loadConfiguration()
599 { 597 {
600 m_config->setGroup( "Ipkg" ); 598 m_config->setGroup( "Ipkg" );
601 m_ipkgExecOptions = m_config->readNumEntry( "ExecOptions", m_ipkgExecOptions ); 599 m_ipkgExecOptions = m_config->readNumEntry( "ExecOptions", m_ipkgExecOptions );
602 m_ipkgExecVerbosity = m_config->readNumEntry( "Verbosity", m_ipkgExecVerbosity ); 600 m_ipkgExecVerbosity = m_config->readNumEntry( "Verbosity", m_ipkgExecVerbosity );
603 } 601 }
604} 602}
605 603
606OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter ) 604OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter )
607{ 605{
608 // Load Ipkg configuration info if not already cached 606 // Load Ipkg configuration info if not already cached
609 if ( !m_confInfo ) 607 if ( !m_confInfo )
610 loadConfiguration(); 608 loadConfiguration();
611 609
612 // Build new server list (caller is responsible for deleting) 610 // Build new server list (caller is responsible for deleting)
613 OConfItemList *sl = new OConfItemList; 611 OConfItemList *sl = new OConfItemList;
614 612
615 // If typefilter is empty, retrieve all items 613 // If typefilter is empty, retrieve all items
616 bool retrieveAll = ( typefilter == OConfItem::NotDefined ); 614 bool retrieveAll = ( typefilter == OConfItem::NotDefined );
617 615
618 // Parse configuration info for servers 616 // Parse configuration info for servers
619 OConfItemListIterator it( *m_confInfo ); 617 OConfItemListIterator it( *m_confInfo );
620 for ( ; it.current(); ++it ) 618 for ( ; it.current(); ++it )
621 { 619 {
622 OConfItem *item = it.current(); 620 OConfItem *item = it.current();
623 if ( retrieveAll || 621 if ( retrieveAll || item->type() == typefilter )
624 ( item->type() & typefilter ) )
625 { 622 {
626 sl->append( item ); 623 sl->append( item );
627 } 624 }
628 } 625 }
629 626
630 return sl; 627 return sl;
631} 628}
632 629
633const QString &OIpkg::rootPath() 630const QString &OIpkg::rootPath()
634{ 631{
635 if ( m_rootPath.isEmpty() ) 632 if ( m_rootPath.isEmpty() )
636 { 633 {
637 OConfItem *rootDest = findConfItem( OConfItem::Destination, "root" ); 634 OConfItem *rootDest = findConfItem( OConfItem::Destination, "root" );
638 rootDest ? m_rootPath = rootDest->value() 635 rootDest ? m_rootPath = rootDest->value()
639 : m_rootPath = '/'; 636 : m_rootPath = '/';
640 if ( m_rootPath.right( 1 ) == '/' ) 637 if ( m_rootPath.right( 1 ) == '/' )
641 m_rootPath.truncate( m_rootPath.length() - 1 ); 638 m_rootPath.truncate( m_rootPath.length() - 1 );
642 } 639 }
643 return m_rootPath; 640 return m_rootPath;
644} 641}
645 642
646void OIpkg::linkPackageDir( const QString &dest ) 643void OIpkg::linkPackageDir( const QString &dest )
647{ 644{
648 if ( !dest.isNull() ) 645 if ( !dest.isNull() )
diff --git a/noncore/settings/packagemanager/opie-packagemanager.control b/noncore/settings/packagemanager/opie-packagemanager.control
index 0153d40..da3ddfe 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, libipkg0 (>=0.99.120), ipkg-link 5Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg (>=0.99.120)
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: $QPE_VERSION$EXTRAVERSION 10Version: 0.6.1$EXTRAVERSION