-rw-r--r-- | noncore/settings/packagemanager/oconfitem.cpp | 47 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oconfitem.h | 14 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkg.cpp | 17 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 15 |
4 files changed, 57 insertions, 36 deletions
diff --git a/noncore/settings/packagemanager/oconfitem.cpp b/noncore/settings/packagemanager/oconfitem.cpp index a90730c..ffa936e 100644 --- a/noncore/settings/packagemanager/oconfitem.cpp +++ b/noncore/settings/packagemanager/oconfitem.cpp | |||
@@ -1,41 +1,42 @@ | |||
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 "oconfitem.h" | 32 | #include "oconfitem.h" |
33 | 33 | ||
34 | OConfItem::OConfItem( Type type, const QString &name, | 34 | OConfItem::OConfItem( Type type, const QString &name, const QString &value, |
35 | const QString &value, bool active ) | 35 | const QString &features, bool active ) |
36 | : m_type( type ) | 36 | : m_type( type ) |
37 | , m_name( name ) | 37 | , m_name( name ) |
38 | , m_value( value ) | 38 | , m_value( value ) |
39 | , m_features( features ) | ||
39 | , m_active( active ) | 40 | , m_active( active ) |
40 | { | 41 | { |
41 | } | 42 | } |
diff --git a/noncore/settings/packagemanager/oconfitem.h b/noncore/settings/packagemanager/oconfitem.h index 7c158c9..9972c00 100644 --- a/noncore/settings/packagemanager/oconfitem.h +++ b/noncore/settings/packagemanager/oconfitem.h | |||
@@ -38,28 +38,32 @@ _;:, .> :=|. This program is free software; you can | |||
38 | class OConfItem | 38 | class OConfItem |
39 | { | 39 | { |
40 | public: | 40 | public: |
41 | enum Type { Source, Destination, Option, Arch, NotDefined }; | 41 | enum Type { Source, Destination, Option, Arch, 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, bool active = true ); | 44 | const QString &value = QString::null, const QString &features = QString::null, |
45 | bool active = true ); | ||
45 | 46 | ||
46 | Type type() { return m_type; } | 47 | Type type() { return m_type; } |
47 | const QString &name() { return m_name; } | 48 | const QString &name() { return m_name; } |
48 | const QString &value() { return m_value; } | 49 | const QString &value() { return m_value; } |
50 | const QString &features() { return m_features; } | ||
49 | bool active() { return m_active; } | 51 | bool active() { return m_active; } |
50 | 52 | ||
51 | void setType( Type type ) { m_type = type; } | 53 | void setType( Type type ) { m_type = type; } |
52 | void setName( const QString &name ) { m_name = name; } | 54 | void setName( const QString &name ) { m_name = name; } |
53 | void setValue( const QString &value ) { m_value = value; } | 55 | void setValue( const QString &value ) { m_value = value; } |
54 | void setActive( bool active ) { m_active = active; } | 56 | void setFeatures( const QString &features ) { m_features = features; } |
57 | void setActive( bool active ) { m_active = active; } | ||
55 | 58 | ||
56 | private: | 59 | private: |
57 | Type m_type; // Type of configuration item | 60 | Type m_type; // Type of configuration item |
58 | QString m_name; // Name of item | 61 | QString m_name; // Name of item |
59 | 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 | ||
60 | bool m_active; // Indicates whether item is currently active | 64 | bool m_active; // Indicates whether item is currently active |
61 | }; | 65 | }; |
62 | 66 | ||
63 | class OConfItemList : public QList<OConfItem> | 67 | class OConfItemList : public QList<OConfItem> |
64 | { | 68 | { |
65 | private: | 69 | private: |
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp index b0cc94d..a66bd51 100644 --- a/noncore/settings/packagemanager/oipkg.cpp +++ b/noncore/settings/packagemanager/oipkg.cpp | |||
@@ -150,13 +150,20 @@ void OIpkg::setConfigItems( OConfItemList *configList ) | |||
150 | QString confLine; | 150 | QString confLine; |
151 | if ( !item->active() ) | 151 | if ( !item->active() ) |
152 | confLine = "#"; | 152 | confLine = "#"; |
153 | 153 | ||
154 | switch ( item->type() ) | 154 | switch ( item->type() ) |
155 | { | 155 | { |
156 | case OConfItem::Source : confLine.append( "src " ); break; | 156 | case OConfItem::Source : |
157 | { | ||
158 | if ( item->features().contains( "Compressed" ) ) | ||
159 | confLine.append( "src/gz " ); | ||
160 | else | ||
161 | confLine.append( "src " ); | ||
162 | } | ||
163 | break; | ||
157 | case OConfItem::Destination : confLine.append( "dest " ); break; | 164 | case OConfItem::Destination : confLine.append( "dest " ); break; |
158 | case OConfItem::Option : confLine.append( "option " ); break; | 165 | case OConfItem::Option : confLine.append( "option " ); break; |
159 | case OConfItem::Arch : confLine.append( "arch " ); break; | 166 | case OConfItem::Arch : confLine.append( "arch " ); break; |
160 | default : break; | 167 | default : break; |
161 | }; | 168 | }; |
162 | 169 | ||
@@ -505,14 +512,20 @@ void OIpkg::loadConfiguration() | |||
505 | { | 512 | { |
506 | int pos = line.find( ' ', 1 ); | 513 | int pos = line.find( ' ', 1 ); |
507 | 514 | ||
508 | // Type | 515 | // Type |
509 | QString typeStr = line.left( pos ); | 516 | QString typeStr = line.left( pos ); |
510 | OConfItem::Type type; | 517 | OConfItem::Type type; |
518 | QString features; | ||
511 | if ( typeStr == "src" || typeStr == "#src" ) | 519 | if ( typeStr == "src" || typeStr == "#src" ) |
512 | type = OConfItem::Source; | 520 | type = OConfItem::Source; |
521 | else if ( typeStr == "src/gz" || typeStr == "#src/gz" ) | ||
522 | { | ||
523 | type = OConfItem::Source; | ||
524 | features = "Compressed"; | ||
525 | } | ||
513 | else if ( typeStr == "dest" || typeStr == "#dest" ) | 526 | else if ( typeStr == "dest" || typeStr == "#dest" ) |
514 | type = OConfItem::Destination; | 527 | type = OConfItem::Destination; |
515 | else if ( typeStr == "option" || typeStr == "#option" ) | 528 | else if ( typeStr == "option" || typeStr == "#option" ) |
516 | type = OConfItem::Option; | 529 | type = OConfItem::Option; |
517 | else if ( typeStr == "arch" || typeStr == "#arch" ) | 530 | else if ( typeStr == "arch" || typeStr == "#arch" ) |
518 | type = OConfItem::Arch; | 531 | type = OConfItem::Arch; |
@@ -530,13 +543,13 @@ void OIpkg::loadConfiguration() | |||
530 | value = line.right( line.length() - endpos - 1 ); | 543 | value = line.right( line.length() - endpos - 1 ); |
531 | 544 | ||
532 | // Active | 545 | // Active |
533 | bool active = !line.startsWith( "#" ); | 546 | bool active = !line.startsWith( "#" ); |
534 | 547 | ||
535 | // Add to list | 548 | // Add to list |
536 | m_confInfo->append( new OConfItem( type, name, value, active ) ); | 549 | m_confInfo->append( new OConfItem( type, name, value, features, active ) ); |
537 | } | 550 | } |
538 | } | 551 | } |
539 | } | 552 | } |
540 | 553 | ||
541 | f.close(); | 554 | f.close(); |
542 | } | 555 | } |
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index 886430f..d9a67f3 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp | |||
@@ -98,23 +98,25 @@ void OIpkgConfigDlg::accept() | |||
98 | { | 98 | { |
99 | confItem->setValue( m_proxyHttpServer->text() ); | 99 | confItem->setValue( m_proxyHttpServer->text() ); |
100 | confItem->setActive( m_proxyHttpActive->isChecked() ); | 100 | confItem->setActive( m_proxyHttpActive->isChecked() ); |
101 | } | 101 | } |
102 | else | 102 | else |
103 | m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", | 103 | m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", |
104 | m_proxyHttpServer->text(), m_proxyHttpActive->isChecked() ) ); | 104 | m_proxyHttpServer->text(), QString::null, |
105 | m_proxyHttpActive->isChecked() ) ); | ||
105 | 106 | ||
106 | confItem = findConfItem( OConfItem::Option, "ftp_proxy" ); | 107 | confItem = findConfItem( OConfItem::Option, "ftp_proxy" ); |
107 | if ( confItem ) | 108 | if ( confItem ) |
108 | { | 109 | { |
109 | confItem->setValue( m_proxyFtpServer->text() ); | 110 | confItem->setValue( m_proxyFtpServer->text() ); |
110 | confItem->setActive( m_proxyFtpActive->isChecked() ); | 111 | confItem->setActive( m_proxyFtpActive->isChecked() ); |
111 | } | 112 | } |
112 | else | 113 | else |
113 | m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", | 114 | m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", |
114 | m_proxyFtpServer->text(), m_proxyFtpActive->isChecked() ) ); | 115 | m_proxyFtpServer->text(), QString::null, |
116 | m_proxyFtpActive->isChecked() ) ); | ||
115 | 117 | ||
116 | confItem = findConfItem( OConfItem::Option, "proxy_username" ); | 118 | confItem = findConfItem( OConfItem::Option, "proxy_username" ); |
117 | if ( confItem ) | 119 | if ( confItem ) |
118 | confItem->setValue( m_proxyUsername->text() ); | 120 | confItem->setValue( m_proxyUsername->text() ); |
119 | else | 121 | else |
120 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", | 122 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", |
@@ -532,15 +534,16 @@ void OIpkgConfigDlg::slotServerUpdate() | |||
532 | m_serverList->changeItem( newName, m_serverCurrent ); | 534 | m_serverList->changeItem( newName, m_serverCurrent ); |
533 | } | 535 | } |
534 | } | 536 | } |
535 | } | 537 | } |
536 | else | 538 | else |
537 | { | 539 | { |
538 | // Add new destination to configuration list | 540 | // Add new server to configuration list |
539 | m_configs->append( new OConfItem( OConfItem::Source, newName, | 541 | // TODO - support src/gz |
540 | m_serverLocation->text(), m_serverActive->isChecked() ) ); | 542 | m_configs->append( new OConfItem( OConfItem::Source, newName, m_serverLocation->text(), |
543 | QString::null, m_serverActive->isChecked() ) ); | ||
541 | m_configs->sort(); | 544 | m_configs->sort(); |
542 | 545 | ||
543 | m_serverList->insertItem( newName ); | 546 | m_serverList->insertItem( newName ); |
544 | m_serverList->setCurrentItem( m_serverList->count() ); | 547 | m_serverList->setCurrentItem( m_serverList->count() ); |
545 | m_serverNew = false; | 548 | m_serverNew = false; |
546 | } | 549 | } |
@@ -627,13 +630,13 @@ void OIpkgConfigDlg::slotDestUpdate() | |||
627 | } | 630 | } |
628 | } | 631 | } |
629 | else | 632 | else |
630 | { | 633 | { |
631 | // Add new destination to configuration list | 634 | // Add new destination to configuration list |
632 | m_configs->append( new OConfItem( OConfItem::Destination, newName, | 635 | m_configs->append( new OConfItem( OConfItem::Destination, newName, |
633 | m_destLocation->text(), m_destActive->isChecked() ) ); | 636 | m_destLocation->text(), QString::null, m_destActive->isChecked() ) ); |
634 | m_configs->sort(); | 637 | m_configs->sort(); |
635 | 638 | ||
636 | m_destList->insertItem( newName ); | 639 | m_destList->insertItem( newName ); |
637 | m_destList->setCurrentItem( m_destList->count() ); | 640 | m_destList->setCurrentItem( m_destList->count() ); |
638 | m_destNew = false; | 641 | m_destNew = false; |
639 | } | 642 | } |