31 files changed, 951 insertions, 617 deletions
diff --git a/noncore/settings/aqpkg/categoryfilterimpl.cpp b/noncore/settings/aqpkg/categoryfilterimpl.cpp index e8ce7e7..61e1f93 100644 --- a/noncore/settings/aqpkg/categoryfilterimpl.cpp +++ b/noncore/settings/aqpkg/categoryfilterimpl.cpp | |||
@@ -1,94 +1,107 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | categoryfilterimpl.cpp - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Sun Nov 17 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | |||
17 | #include <iostream> | 30 | #include <iostream> |
18 | using namespace std; | 31 | using namespace std; |
19 | 32 | ||
20 | #include <qgroupbox.h> | 33 | #include <qgroupbox.h> |
21 | #include <qlayout.h> | 34 | #include <qlayout.h> |
22 | #include <qlistbox.h> | 35 | #include <qlistbox.h> |
23 | #include <qstring.h> | 36 | #include <qstring.h> |
24 | 37 | ||
25 | #include "categoryfilterimpl.h" | 38 | #include "categoryfilterimpl.h" |
26 | 39 | ||
27 | CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent, const char *name ) | 40 | CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent, const char *name ) |
28 | : QDialog( parent, name, true ) | 41 | : QDialog( parent, name, true ) |
29 | { | 42 | { |
30 | setCaption( tr( "Category Filter" ) ); | 43 | setCaption( tr( "Category Filter" ) ); |
31 | 44 | ||
32 | QVBoxLayout *layout = new QVBoxLayout( this ); | 45 | QVBoxLayout *layout = new QVBoxLayout( this ); |
33 | layout->setMargin( 2 ); | 46 | layout->setMargin( 2 ); |
34 | layout->setSpacing( 4 ); | 47 | layout->setSpacing( 4 ); |
35 | 48 | ||
36 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Select one or more groups" ), this ); | 49 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Select one or more groups" ), this ); |
37 | grpbox->layout()->setSpacing( 2 ); | 50 | grpbox->layout()->setSpacing( 2 ); |
38 | grpbox->layout()->setMargin( 4 ); | 51 | grpbox->layout()->setMargin( 4 ); |
39 | layout->addWidget( grpbox ); | 52 | layout->addWidget( grpbox ); |
40 | 53 | ||
41 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); | 54 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); |
42 | 55 | ||
43 | lstCategories = new QListBox( grpbox ); | 56 | lstCategories = new QListBox( grpbox ); |
44 | lstCategories->setSelectionMode( QListBox::Multi ); | 57 | lstCategories->setSelectionMode( QListBox::Multi ); |
45 | grplayout->addWidget( lstCategories ); | 58 | grplayout->addWidget( lstCategories ); |
46 | 59 | ||
47 | // Split up categories and add them to the listbox | 60 | // Split up categories and add them to the listbox |
48 | int start = 1; | 61 | int start = 1; |
49 | 62 | ||
50 | QString item; | 63 | QString item; |
51 | int end; | 64 | int end; |
52 | QString finditem; | 65 | QString finditem; |
53 | do | 66 | do |
54 | { | 67 | { |
55 | end = categories.find( "#", start ); | 68 | end = categories.find( "#", start ); |
56 | item = categories.mid( start, end - start ); | 69 | item = categories.mid( start, end - start ); |
57 | if ( item != "" ) | 70 | if ( item != "" ) |
58 | { | 71 | { |
59 | lstCategories->insertItem( item ); | 72 | lstCategories->insertItem( item ); |
60 | finditem = QString( "#%1#" ).arg( item ); | 73 | finditem = QString( "#%1#" ).arg( item ); |
61 | if ( selectedCategories.find( finditem ) != -1 ) | 74 | if ( selectedCategories.find( finditem ) != -1 ) |
62 | lstCategories->setSelected( lstCategories->count()-1, true ); | 75 | lstCategories->setSelected( lstCategories->count()-1, true ); |
63 | } | 76 | } |
64 | 77 | ||
65 | start = end + 1; | 78 | start = end + 1; |
66 | } while ( start < (int)categories.length() ); | 79 | } while ( start < (int)categories.length() ); |
67 | 80 | ||
68 | lstCategories->sort( true ); | 81 | lstCategories->sort( true ); |
69 | 82 | ||
70 | showMaximized(); | 83 | showMaximized(); |
71 | } | 84 | } |
72 | 85 | ||
73 | CategoryFilterImpl :: ~CategoryFilterImpl() | 86 | CategoryFilterImpl :: ~CategoryFilterImpl() |
74 | { | 87 | { |
75 | } | 88 | } |
76 | 89 | ||
77 | QString CategoryFilterImpl :: getSelectedFilter() | 90 | QString CategoryFilterImpl :: getSelectedFilter() |
78 | { | 91 | { |
79 | // Grab cetegories from listbox | 92 | // Grab cetegories from listbox |
80 | QString ret = "#"; | 93 | QString ret = "#"; |
81 | 94 | ||
82 | for ( int i = 0 ; i < (int)lstCategories->count() ; ++i ) | 95 | for ( int i = 0 ; i < (int)lstCategories->count() ; ++i ) |
83 | { | 96 | { |
84 | if ( lstCategories->isSelected( i ) ) | 97 | if ( lstCategories->isSelected( i ) ) |
85 | { | 98 | { |
86 | ret.append( lstCategories->text( i ) ); | 99 | ret.append( lstCategories->text( i ) ); |
87 | ret.append( "#" ); | 100 | ret.append( "#" ); |
88 | } | 101 | } |
89 | } | 102 | } |
90 | 103 | ||
91 | if ( ret == "#" ) | 104 | if ( ret == "#" ) |
92 | ret = ""; | 105 | ret = ""; |
93 | return ret; | 106 | return ret; |
94 | } | 107 | } |
diff --git a/noncore/settings/aqpkg/categoryfilterimpl.h b/noncore/settings/aqpkg/categoryfilterimpl.h index a85fce4..78d39db 100644 --- a/noncore/settings/aqpkg/categoryfilterimpl.h +++ b/noncore/settings/aqpkg/categoryfilterimpl.h | |||
@@ -1,43 +1,55 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | categoryfilterimpl.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Sun Nov 17 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
17 | 29 | ||
18 | #ifndef CATEGORYFILTERIMPL_H | 30 | #ifndef CATEGORYFILTERIMPL_H |
19 | #define CATEGORYFILTERIMPL_H | 31 | #define CATEGORYFILTERIMPL_H |
20 | 32 | ||
21 | #include <qdialog.h> | 33 | #include <qdialog.h> |
22 | 34 | ||
23 | class QListBox; | 35 | class QListBox; |
24 | 36 | ||
25 | /** | 37 | /** |
26 | *@author Andy Qua | 38 | *@author Andy Qua |
27 | */ | 39 | */ |
28 | 40 | ||
29 | class CategoryFilterImpl : public QDialog | 41 | class CategoryFilterImpl : public QDialog |
30 | { | 42 | { |
31 | Q_OBJECT | 43 | Q_OBJECT |
32 | public: | 44 | public: |
33 | CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent=0, const char *name=0); | 45 | CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent=0, const char *name=0); |
34 | ~CategoryFilterImpl(); | 46 | ~CategoryFilterImpl(); |
35 | 47 | ||
36 | QString getSelectedFilter(); | 48 | QString getSelectedFilter(); |
37 | 49 | ||
38 | private: | 50 | private: |
39 | QListBox *lstCategories; | 51 | QListBox *lstCategories; |
40 | 52 | ||
41 | }; | 53 | }; |
42 | 54 | ||
43 | #endif | 55 | #endif |
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp index 79f36e1..cd0c78f 100644 --- a/noncore/settings/aqpkg/datamgr.cpp +++ b/noncore/settings/aqpkg/datamgr.cpp | |||
@@ -1,291 +1,312 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | datamgr.cpp - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Thu Aug 29 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | #include <fstream> | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | #include <iostream> | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | using namespace std; | 19 | ..}^=.= = ; Public License for more details. |
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
20 | 29 | ||
21 | #ifdef QWS | 30 | #ifdef QWS |
22 | #include <qpe/config.h> | 31 | #include <qpe/config.h> |
23 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
24 | #else | 33 | #else |
25 | #include <qapplication.h> | 34 | #include <qapplication.h> |
26 | #endif | 35 | #endif |
27 | 36 | ||
28 | #include <stdio.h> | 37 | #include <qfile.h> |
38 | #include <qtextstream.h> | ||
29 | 39 | ||
30 | #include "datamgr.h" | 40 | #include "datamgr.h" |
31 | #include "global.h" | 41 | #include "global.h" |
32 | 42 | ||
33 | 43 | ||
34 | QString DataManager::availableCategories = ""; | 44 | QString DataManager::availableCategories = ""; |
35 | DataManager::DataManager() | 45 | DataManager::DataManager() |
36 | : QObject( 0x0, 0x0 ) | 46 | : QObject( 0x0, 0x0 ) |
37 | { | 47 | { |
38 | activeServer = ""; | 48 | activeServer = ""; |
39 | availableCategories = "#"; | 49 | availableCategories = "#"; |
40 | 50 | ||
41 | serverList.setAutoDelete( TRUE ); | 51 | serverList.setAutoDelete( TRUE ); |
42 | destList.setAutoDelete( TRUE ); | 52 | destList.setAutoDelete( TRUE ); |
43 | } | 53 | } |
44 | 54 | ||
45 | DataManager::~DataManager() | 55 | DataManager::~DataManager() |
46 | { | 56 | { |
47 | } | 57 | } |
48 | 58 | ||
49 | Server *DataManager :: getServer( const char *name ) | 59 | Server *DataManager :: getServer( const char *name ) |
50 | { | 60 | { |
51 | QListIterator<Server> it( serverList ); | 61 | QListIterator<Server> it( serverList ); |
52 | while ( it.current() && it.current()->getServerName() != name ) | 62 | while ( it.current() && it.current()->getServerName() != name ) |
53 | { | 63 | { |
54 | ++it; | 64 | ++it; |
55 | } | 65 | } |
56 | 66 | ||
57 | return it.current(); | 67 | return it.current(); |
58 | } | 68 | } |
59 | 69 | ||
60 | Destination *DataManager :: getDestination( const char *name ) | 70 | Destination *DataManager :: getDestination( const char *name ) |
61 | { | 71 | { |
62 | QListIterator<Destination> it( destList ); | 72 | QListIterator<Destination> it( destList ); |
63 | while ( it.current() && it.current()->getDestinationName() != name ) | 73 | while ( it.current() && it.current()->getDestinationName() != name ) |
64 | { | 74 | { |
65 | ++it; | 75 | ++it; |
66 | } | 76 | } |
67 | 77 | ||
68 | return it.current(); | 78 | return it.current(); |
69 | } | 79 | } |
70 | 80 | ||
71 | void DataManager :: loadServers() | 81 | void DataManager :: loadServers() |
72 | { | 82 | { |
73 | // First add our local server - not really a server but | 83 | // First add our local server - not really a server but |
74 | // the local config (which packages are installed) | 84 | // the local config (which packages are installed) |
75 | serverList.append( new Server( LOCAL_SERVER, "" ) ); | 85 | serverList.append( new Server( LOCAL_SERVER, "" ) ); |
76 | serverList.append( new Server( LOCAL_IPKGS, "" ) ); | 86 | serverList.append( new Server( LOCAL_IPKGS, "" ) ); |
77 | 87 | ||
78 | #ifdef QWS | 88 | #ifdef QWS |
79 | Config cfg( "aqpkg" ); | 89 | Config cfg( "aqpkg" ); |
80 | cfg.setGroup( "destinations" ); | 90 | cfg.setGroup( "destinations" ); |
81 | #endif | 91 | #endif |
82 | 92 | ||
83 | // Read file from /etc/ipkg.conf | 93 | // Read file from /etc/ipkg.conf |
84 | QString ipkg_conf = IPKG_CONF; | 94 | QString ipkg_conf = IPKG_CONF; |
85 | FILE *fp; | 95 | FILE *fp; |
86 | fp = fopen( ipkg_conf, "r" ); | 96 | fp = fopen( ipkg_conf, "r" ); |
87 | char line[130]; | 97 | char line[130]; |
88 | QString lineStr; | 98 | QString lineStr; |
89 | if ( fp == NULL ) | 99 | if ( fp == NULL ) |
90 | { | 100 | { |
91 | cout << "Couldn't open " << ipkg_conf << "! err = " << fp << endl; | ||
92 | return; | 101 | return; |
93 | } | 102 | } |
94 | else | 103 | else |
95 | { | 104 | { |
96 | while ( fgets( line, sizeof line, fp) != NULL ) | 105 | while ( fgets( line, sizeof line, fp) != NULL ) |
97 | { | 106 | { |
98 | lineStr = line; | 107 | lineStr = line; |
99 | if ( lineStr.startsWith( "src" ) || lineStr.startsWith( "#src" ) || lineStr.startsWith( "# src" ) ) | 108 | if ( lineStr.startsWith( "src" ) || lineStr.startsWith( "#src" ) || lineStr.startsWith( "# src" ) ) |
100 | { | 109 | { |
101 | char alias[20]; | 110 | char alias[20]; |
102 | char url[100]; | 111 | char url[100]; |
103 | 112 | ||
104 | // Looks a little wierd but read up to the r of src (throwing it away), | 113 | // Looks a little wierd but read up to the r of src (throwing it away), |
105 | // then read up to the next space and throw that away, the alias | 114 | // then read up to the next space and throw that away, the alias |
106 | // is next. | 115 | // is next. |
107 | // Should Handle #src, # src, src, and combinations of | 116 | // Should Handle #src, # src, src, and combinations of |
108 | sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url ); | 117 | sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url ); |
109 | Server *s = new Server( alias, url ); | 118 | Server *s = new Server( alias, url ); |
110 | if ( lineStr.startsWith( "src" ) ) | 119 | if ( lineStr.startsWith( "src" ) ) |
111 | s->setActive( true ); | 120 | s->setActive( true ); |
112 | else | 121 | else |
113 | s->setActive( false ); | 122 | s->setActive( false ); |
114 | 123 | ||
115 | serverList.append( s ); | 124 | serverList.append( s ); |
116 | 125 | ||
117 | } | 126 | } |
118 | else if ( lineStr.startsWith( "dest" ) ) | 127 | else if ( lineStr.startsWith( "dest" ) ) |
119 | { | 128 | { |
120 | char alias[20]; | 129 | char alias[20]; |
121 | char path[50]; | 130 | char path[50]; |
122 | sscanf( lineStr, "%*[^ ] %s %s", alias, path ); | 131 | sscanf( lineStr, "%*[^ ] %s %s", alias, path ); |
123 | Destination *d = new Destination( alias, path ); | 132 | Destination *d = new Destination( alias, path ); |
124 | bool linkToRoot = true; | 133 | bool linkToRoot = true; |
125 | #ifdef QWS | 134 | #ifdef QWS |
126 | QString key = alias; | 135 | QString key = alias; |
127 | key += "_linkToRoot"; | 136 | key += "_linkToRoot"; |
128 | linkToRoot = cfg.readBoolEntry( key, true ); | 137 | linkToRoot = cfg.readBoolEntry( key, true ); |
129 | #endif | 138 | #endif |
130 | d->linkToRoot( linkToRoot ); | 139 | d->linkToRoot( linkToRoot ); |
131 | 140 | ||
132 | destList.append( d ); | 141 | destList.append( d ); |
133 | } | 142 | } |
134 | else if ( lineStr.startsWith( "option" ) || lineStr.startsWith( "#option" ) ) | 143 | else if ( lineStr.startsWith( "option" ) || lineStr.startsWith( "#option" ) ) |
135 | { | 144 | { |
136 | char type[20]; | 145 | char type[20]; |
137 | char val[100]; | 146 | char val[100]; |
138 | sscanf( lineStr, "%*[^ ] %s %s", type, val ); | 147 | sscanf( lineStr, "%*[^ ] %s %s", type, val ); |
139 | if ( stricmp( type, "http_proxy" ) == 0 ) | 148 | if ( stricmp( type, "http_proxy" ) == 0 ) |
140 | { | 149 | { |
141 | httpProxy = val; | 150 | httpProxy = val; |
142 | if ( lineStr.startsWith( "#" ) ) | 151 | if ( lineStr.startsWith( "#" ) ) |
143 | httpProxyEnabled = false; | 152 | httpProxyEnabled = false; |
144 | else | 153 | else |
145 | httpProxyEnabled = true; | 154 | httpProxyEnabled = true; |
146 | } | 155 | } |
147 | if ( stricmp( type, "ftp_proxy" ) == 0 ) | 156 | if ( stricmp( type, "ftp_proxy" ) == 0 ) |
148 | { | 157 | { |
149 | ftpProxy = val; | 158 | ftpProxy = val; |
150 | if ( lineStr.startsWith( "#" ) ) | 159 | if ( lineStr.startsWith( "#" ) ) |
151 | ftpProxyEnabled = false; | 160 | ftpProxyEnabled = false; |
152 | else | 161 | else |
153 | ftpProxyEnabled = true; | 162 | ftpProxyEnabled = true; |
154 | } | 163 | } |
155 | if ( stricmp( type, "proxy_username" ) == 0 ) | 164 | if ( stricmp( type, "proxy_username" ) == 0 ) |
156 | proxyUsername = val; | 165 | proxyUsername = val; |
157 | if ( stricmp( type, "proxy_password" ) == 0 ) | 166 | if ( stricmp( type, "proxy_password" ) == 0 ) |
158 | proxyPassword = val; | 167 | proxyPassword = val; |
159 | } | 168 | } |
160 | } | 169 | } |
161 | } | 170 | } |
162 | fclose( fp ); | 171 | fclose( fp ); |
163 | 172 | ||
164 | reloadServerData( ); | 173 | reloadServerData( ); |
165 | } | 174 | } |
166 | 175 | ||
167 | void DataManager :: reloadServerData( ) | 176 | void DataManager :: reloadServerData( ) |
168 | { | 177 | { |
169 | emit progressSetSteps( serverList.count() ); | 178 | emit progressSetSteps( serverList.count() ); |
170 | emit progressSetMessage( tr( "Reading configuration..." ) ); | 179 | emit progressSetMessage( tr( "Reading configuration..." ) ); |
171 | 180 | ||
172 | QString serverName; | 181 | QString serverName; |
173 | int i = 0; | 182 | int i = 0; |
174 | 183 | ||
175 | Server *server; | 184 | Server *server; |
176 | QListIterator<Server> it( serverList ); | 185 | QListIterator<Server> it( serverList ); |
177 | for ( ; it.current(); ++it ) | 186 | for ( ; it.current(); ++it ) |
178 | { | 187 | { |
179 | server = it.current(); | 188 | server = it.current(); |
180 | serverName = server->getServerName(); | 189 | serverName = server->getServerName(); |
181 | i++; | 190 | i++; |
182 | emit progressUpdate( i ); | 191 | emit progressUpdate( i ); |
183 | qApp->processEvents(); | 192 | qApp->processEvents(); |
184 | 193 | ||
185 | // Now we've read the config file in we need to read the servers | 194 | // Now we've read the config file in we need to read the servers |
186 | // The local server is a special case. This holds the contents of the | 195 | // The local server is a special case. This holds the contents of the |
187 | // status files the number of which depends on how many destinations | 196 | // status files the number of which depends on how many destinations |
188 | // we've set up | 197 | // we've set up |
189 | // The other servers files hold the contents of the server package list | 198 | // The other servers files hold the contents of the server package list |
190 | if ( serverName == LOCAL_SERVER ) | 199 | if ( serverName == LOCAL_SERVER ) |
191 | server->readStatusFile( destList ); | 200 | server->readStatusFile( destList ); |
192 | else if ( serverName == LOCAL_IPKGS ) | 201 | else if ( serverName == LOCAL_IPKGS ) |
193 | server->readLocalIpks( getServer( LOCAL_SERVER ) ); | 202 | server->readLocalIpks( getServer( LOCAL_SERVER ) ); |
194 | else | 203 | else |
195 | server->readPackageFile( getServer( LOCAL_SERVER ) ); | 204 | server->readPackageFile( getServer( LOCAL_SERVER ) ); |
196 | } | 205 | } |
197 | } | 206 | } |
198 | 207 | ||
199 | void DataManager :: writeOutIpkgConf() | 208 | void DataManager :: writeOutIpkgConf() |
200 | { | 209 | { |
210 | QFile f( IPKG_CONF ); | ||
211 | if ( !f.open( IO_WriteOnly ) ) | ||
212 | { | ||
213 | return; | ||
214 | } | ||
215 | |||
216 | QTextStream t( &f ); | ||
217 | /* | ||
201 | QString ipkg_conf = IPKG_CONF; | 218 | QString ipkg_conf = IPKG_CONF; |
202 | ofstream out( ipkg_conf ); | 219 | ofstream out( ipkg_conf ); |
220 | */ | ||
221 | t << "# Written by AQPkg\n"; | ||
222 | t << "# Must have one or more source entries of the form:\n"; | ||
223 | t << "#\n"; | ||
224 | t << "# src <src-name> <source-url>\n"; | ||
225 | t << "#\n"; | ||
226 | t << "# and one or more destination entries of the form:\n"; | ||
227 | t << "#\n"; | ||
228 | t << "# dest <dest-name> <target-path>\n"; | ||
229 | t << "#\n"; | ||
230 | t << "# where <src-name> and <dest-names> are identifiers that\n"; | ||
231 | t << "# should match [a-zA-Z0-9._-]+, <source-url> should be a\n"; | ||
232 | t << "# URL that points to a directory containing a Familiar\n"; | ||
233 | t << "# Packages file, and <target-path> should be a directory\n"; | ||
234 | t << "# that exists on the target system.\n\n"; | ||
203 | 235 | ||
204 | out << "# Written by AQPkg" << endl; | ||
205 | out << "# Must have one or more source entries of the form:" << endl; | ||
206 | out << "#" << endl; | ||
207 | out << "# src <src-name> <source-url>" << endl; | ||
208 | out << "#" << endl; | ||
209 | out << "# and one or more destination entries of the form:" << endl; | ||
210 | out << "#" << endl; | ||
211 | out << "# dest <dest-name> <target-path>" << endl; | ||
212 | out << "#" << endl; | ||
213 | out << "# where <src-name> and <dest-names> are identifiers that" << endl; | ||
214 | out << "# should match [a-zA-Z0-9._-]+, <source-url> should be a" << endl; | ||
215 | out << "# URL that points to a directory containing a Familiar" << endl; | ||
216 | out << "# Packages file, and <target-path> should be a directory" << endl; | ||
217 | out << "# that exists on the target system." << endl << endl; | ||
218 | |||
219 | // Write out servers | 236 | // Write out servers |
220 | Server *server; | 237 | Server *server; |
221 | QListIterator<Server> it( serverList ); | 238 | QListIterator<Server> it( serverList ); |
222 | while ( it.current() ) | 239 | while ( it.current() ) |
223 | { | 240 | { |
224 | server = it.current(); | 241 | server = it.current(); |
225 | QString alias = server->getServerName(); | 242 | QString alias = server->getServerName(); |
226 | // Don't write out local as its a dummy | 243 | // Don't write out local as its a dummy |
227 | if ( alias != LOCAL_SERVER && alias != LOCAL_IPKGS ) | 244 | if ( alias != LOCAL_SERVER && alias != LOCAL_IPKGS ) |
228 | { | 245 | { |
229 | QString url = server->getServerUrl();; | 246 | QString url = server->getServerUrl();; |
230 | 247 | ||
231 | if ( !server->isServerActive() ) | 248 | if ( !server->isServerActive() ) |
232 | out << "#"; | 249 | t << "#"; |
233 | out << "src " << alias << " " << url << endl; | 250 | t << "src " << alias << " " << url << endl; |
234 | } | 251 | } |
235 | 252 | ||
236 | ++it; | 253 | ++it; |
237 | } | 254 | } |
238 | 255 | ||
239 | out << endl; | 256 | t << endl; |
240 | 257 | ||
241 | // Write out destinations | 258 | // Write out destinations |
242 | QListIterator<Destination> it2( destList ); | 259 | QListIterator<Destination> it2( destList ); |
243 | while ( it2.current() ) | 260 | while ( it2.current() ) |
244 | { | 261 | { |
245 | out << "dest " << it2.current()->getDestinationName() << " " << it2.current()->getDestinationPath() << endl; | 262 | t << "dest " << it2.current()->getDestinationName() << " " << it2.current()->getDestinationPath() << endl; |
246 | ++it2; | 263 | ++it2; |
247 | } | 264 | } |
248 | 265 | ||
249 | out << endl; | 266 | t << endl; |
250 | out << "# Proxy Support" << endl; | 267 | t << "# Proxy Support\n"; |
251 | 268 | ||
252 | if ( !httpProxyEnabled && httpProxy == "" ) | 269 | if ( !httpProxyEnabled && httpProxy == "" ) |
253 | out << "#option http_proxy http://proxy.tld:3128" << endl; | 270 | t << "#option http_proxy http://proxy.tld:3128\n"; |
254 | else | 271 | else |
255 | { | 272 | { |
256 | if ( !httpProxyEnabled ) | 273 | if ( !httpProxyEnabled ) |
257 | out << "#"; | 274 | t << "#"; |
258 | out << "option http_proxy " << httpProxy << endl; | 275 | t << "option http_proxy " << httpProxy << endl; |
259 | } | 276 | } |
260 | 277 | ||
261 | if ( !ftpProxyEnabled && ftpProxy == "" ) | 278 | if ( !ftpProxyEnabled && ftpProxy == "" ) |
262 | out << "#option ftp_proxy http://proxy.tld:3128" << endl; | 279 | t << "#option ftp_proxy http://proxy.tld:3128\n"; |
263 | else | 280 | else |
264 | { | 281 | { |
265 | if ( !ftpProxyEnabled ) | 282 | if ( !ftpProxyEnabled ) |
266 | out << "#"; | 283 | t << "#"; |
267 | out << "option ftp_proxy " << ftpProxy << endl; | 284 | t << "option ftp_proxy " << ftpProxy << endl; |
268 | } | 285 | } |
269 | if ( proxyUsername == "" || (!httpProxyEnabled && !ftpProxyEnabled) ) | 286 | if ( proxyUsername == "" || (!httpProxyEnabled && !ftpProxyEnabled) ) |
270 | out << "#option proxy_username <username>" << endl; | 287 | t << "#option proxy_username <username>\n"; |
271 | else | 288 | else |
272 | out << "option proxy_username " << proxyUsername << endl; | 289 | t << "option proxy_username " << proxyUsername << endl; |
273 | if ( proxyPassword == "" || (!httpProxyEnabled && !ftpProxyEnabled) ) | 290 | if ( proxyPassword == "" || (!httpProxyEnabled && !ftpProxyEnabled) ) |
274 | out << "#option proxy_password <password>" << endl << endl; | 291 | t << "#option proxy_password <password>\n\n"; |
275 | else | 292 | else |
276 | out << "option proxy_password " << proxyPassword << endl<< endl; | 293 | t << "option proxy_password " << proxyPassword << endl<< endl; |
277 | |||
278 | out << "# Offline mode (for use in constructing flash images offline)" << endl; | ||
279 | out << "#option offline_root target" << endl; | ||
280 | 294 | ||
295 | t << "# Offline mode (for use in constructing flash images offline)\n"; | ||
296 | t << "#option offline_root target\n"; | ||
281 | 297 | ||
282 | out.close(); | 298 | f.close(); |
283 | } | 299 | } |
284 | 300 | ||
285 | 301 | ||
286 | void DataManager :: setAvailableCategories( QString section ) | 302 | void DataManager :: setAvailableCategories( QString section ) |
287 | { | 303 | { |
288 | section = section.lower(); | 304 | QString sectstr = "#"; |
289 | if ( availableCategories.find( "#" + section + "#" ) == -1 ) | 305 | sectstr.append( section.lower() ); |
290 | availableCategories += section + "#"; | 306 | sectstr.append( "#" ); |
307 | if ( availableCategories.find( sectstr ) == -1 ) | ||
308 | { | ||
309 | availableCategories.append( section ); | ||
310 | availableCategories.append( "#" ); | ||
311 | } | ||
291 | } | 312 | } |
diff --git a/noncore/settings/aqpkg/datamgr.h b/noncore/settings/aqpkg/datamgr.h index 7fa42c1..32a1e57 100644 --- a/noncore/settings/aqpkg/datamgr.h +++ b/noncore/settings/aqpkg/datamgr.h | |||
@@ -1,99 +1,111 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | datamgr.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Thu Aug 29 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
17 | 29 | ||
18 | #ifndef DATAMGR_H | 30 | #ifndef DATAMGR_H |
19 | #define DATAMGR_H | 31 | #define DATAMGR_H |
20 | 32 | ||
21 | #include <map> | 33 | #include <map> |
22 | using namespace std; | 34 | using namespace std; |
23 | 35 | ||
24 | #include <qlist.h> | 36 | #include <qlist.h> |
25 | #include <qobject.h> | 37 | #include <qobject.h> |
26 | #include <qstring.h> | 38 | #include <qstring.h> |
27 | 39 | ||
28 | #include "server.h" | 40 | #include "server.h" |
29 | #include "destination.h" | 41 | #include "destination.h" |
30 | 42 | ||
31 | #define LOCAL_SERVER "Installed Pkgs" | 43 | #define LOCAL_SERVER "Installed Pkgs" |
32 | #define LOCAL_IPKGS "local IPKG" | 44 | #define LOCAL_IPKGS "local IPKG" |
33 | 45 | ||
34 | /** | 46 | /** |
35 | *@author Andy Qua | 47 | *@author Andy Qua |
36 | */ | 48 | */ |
37 | 49 | ||
38 | 50 | ||
39 | class DataManager : public QObject | 51 | class DataManager : public QObject |
40 | { | 52 | { |
41 | Q_OBJECT | 53 | Q_OBJECT |
42 | public: | 54 | public: |
43 | DataManager(); | 55 | DataManager(); |
44 | ~DataManager(); | 56 | ~DataManager(); |
45 | 57 | ||
46 | void setActiveServer( const QString &act ) { activeServer = act; } | 58 | void setActiveServer( const QString &act ) { activeServer = act; } |
47 | QString &getActiveServer( ) { return activeServer; } | 59 | QString &getActiveServer( ) { return activeServer; } |
48 | 60 | ||
49 | Server *getLocalServer() { return ( getServer( LOCAL_SERVER ) ); } | 61 | Server *getLocalServer() { return ( getServer( LOCAL_SERVER ) ); } |
50 | QList<Server> &getServerList() { return serverList; } | 62 | QList<Server> &getServerList() { return serverList; } |
51 | Server *getServer( const char *name ); | 63 | Server *getServer( const char *name ); |
52 | 64 | ||
53 | QList<Destination> &getDestinationList() { return destList; } | 65 | QList<Destination> &getDestinationList() { return destList; } |
54 | Destination *getDestination( const char *name ); | 66 | Destination *getDestination( const char *name ); |
55 | 67 | ||
56 | void loadServers(); | 68 | void loadServers(); |
57 | void reloadServerData( ); | 69 | void reloadServerData( ); |
58 | 70 | ||
59 | void writeOutIpkgConf(); | 71 | void writeOutIpkgConf(); |
60 | 72 | ||
61 | static QString getAvailableCategories() { return availableCategories; } | 73 | static QString getAvailableCategories() { return availableCategories; } |
62 | static void setAvailableCategories( QString section ); | 74 | static void setAvailableCategories( QString section ); |
63 | 75 | ||
64 | QString getHttpProxy() { return httpProxy; } | 76 | QString getHttpProxy() { return httpProxy; } |
65 | QString getFtpProxy() { return ftpProxy; } | 77 | QString getFtpProxy() { return ftpProxy; } |
66 | QString getProxyUsername() { return proxyUsername; } | 78 | QString getProxyUsername() { return proxyUsername; } |
67 | QString getProxyPassword() { return proxyPassword; } | 79 | QString getProxyPassword() { return proxyPassword; } |
68 | 80 | ||
69 | bool getHttpProxyEnabled() { return httpProxyEnabled; } | 81 | bool getHttpProxyEnabled() { return httpProxyEnabled; } |
70 | bool getFtpProxyEnabled() { return ftpProxyEnabled; } | 82 | bool getFtpProxyEnabled() { return ftpProxyEnabled; } |
71 | 83 | ||
72 | void setHttpProxy( QString proxy ) { httpProxy = proxy; } | 84 | void setHttpProxy( QString proxy ) { httpProxy = proxy; } |
73 | void setFtpProxy( QString proxy ) { ftpProxy = proxy; } | 85 | void setFtpProxy( QString proxy ) { ftpProxy = proxy; } |
74 | void setProxyUsername( QString name ) { proxyUsername = name; } | 86 | void setProxyUsername( QString name ) { proxyUsername = name; } |
75 | void setProxyPassword( QString pword ) { proxyPassword = pword; } | 87 | void setProxyPassword( QString pword ) { proxyPassword = pword; } |
76 | 88 | ||
77 | void setHttpProxyEnabled( bool val ) { httpProxyEnabled = val; } | 89 | void setHttpProxyEnabled( bool val ) { httpProxyEnabled = val; } |
78 | void setFtpProxyEnabled( bool val ) { ftpProxyEnabled = val; } | 90 | void setFtpProxyEnabled( bool val ) { ftpProxyEnabled = val; } |
79 | private: | 91 | private: |
80 | static QString availableCategories; | 92 | static QString availableCategories; |
81 | QString activeServer; | 93 | QString activeServer; |
82 | QString httpProxy; | 94 | QString httpProxy; |
83 | QString ftpProxy; | 95 | QString ftpProxy; |
84 | QString proxyUsername; | 96 | QString proxyUsername; |
85 | QString proxyPassword; | 97 | QString proxyPassword; |
86 | 98 | ||
87 | bool httpProxyEnabled; | 99 | bool httpProxyEnabled; |
88 | bool ftpProxyEnabled; | 100 | bool ftpProxyEnabled; |
89 | 101 | ||
90 | QList<Server> serverList; | 102 | QList<Server> serverList; |
91 | QList<Destination> destList; | 103 | QList<Destination> destList; |
92 | 104 | ||
93 | signals: | 105 | signals: |
94 | void progressSetSteps( int ); | 106 | void progressSetSteps( int ); |
95 | void progressSetMessage( const QString & ); | 107 | void progressSetMessage( const QString & ); |
96 | void progressUpdate( int ); | 108 | void progressUpdate( int ); |
97 | }; | 109 | }; |
98 | 110 | ||
99 | #endif | 111 | #endif |
diff --git a/noncore/settings/aqpkg/destination.cpp b/noncore/settings/aqpkg/destination.cpp index 45bdb48..6423894 100644 --- a/noncore/settings/aqpkg/destination.cpp +++ b/noncore/settings/aqpkg/destination.cpp | |||
@@ -1,30 +1,42 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | destination.cpp - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This file is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
8 | 27 | ||
9 | /*************************************************************************** | 28 | */ |
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | 29 | ||
18 | #include "destination.h" | 30 | #include "destination.h" |
19 | #include "global.h" | 31 | #include "global.h" |
20 | 32 | ||
21 | Destination::Destination( const char *name, const char *path ) | 33 | Destination::Destination( const char *name, const char *path ) |
22 | { | 34 | { |
23 | destName = name; | 35 | destName = name; |
24 | destPath = path; | 36 | destPath = path; |
25 | linkToRootDir = true; | 37 | linkToRootDir = true; |
26 | } | 38 | } |
27 | 39 | ||
28 | Destination::~Destination() | 40 | Destination::~Destination() |
29 | { | 41 | { |
30 | } | 42 | } |
diff --git a/noncore/settings/aqpkg/destination.h b/noncore/settings/aqpkg/destination.h index 646fae9..4a7f706 100644 --- a/noncore/settings/aqpkg/destination.h +++ b/noncore/settings/aqpkg/destination.h | |||
@@ -1,45 +1,58 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | destination.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | |||
17 | #ifndef DESTINATION_H | 30 | #ifndef DESTINATION_H |
18 | #define DESTINATION_H | 31 | #define DESTINATION_H |
19 | 32 | ||
20 | #include <qstring.h> | 33 | #include <qstring.h> |
21 | 34 | ||
22 | class Destination | 35 | class Destination |
23 | { | 36 | { |
24 | public: | 37 | public: |
25 | Destination() {} | 38 | Destination() {} |
26 | Destination( const char *name, const char *path ); | 39 | Destination( const char *name, const char *path ); |
27 | ~Destination(); | 40 | ~Destination(); |
28 | 41 | ||
29 | void setDestinationName( const QString &name ) { destName = name; } | 42 | void setDestinationName( const QString &name ) { destName = name; } |
30 | void setDestinationPath( const QString &path ) { destPath = path; } | 43 | void setDestinationPath( const QString &path ) { destPath = path; } |
31 | void linkToRoot( bool val ) { linkToRootDir = val; } | 44 | void linkToRoot( bool val ) { linkToRootDir = val; } |
32 | 45 | ||
33 | bool linkToRoot() { return linkToRootDir; } | 46 | bool linkToRoot() { return linkToRootDir; } |
34 | QString &getDestinationName() { return destName; } | 47 | QString &getDestinationName() { return destName; } |
35 | QString &getDestinationPath() { return destPath; } | 48 | QString &getDestinationPath() { return destPath; } |
36 | 49 | ||
37 | protected: | 50 | protected: |
38 | 51 | ||
39 | private: | 52 | private: |
40 | QString destName; | 53 | QString destName; |
41 | QString destPath; | 54 | QString destPath; |
42 | bool linkToRootDir; | 55 | bool linkToRootDir; |
43 | }; | 56 | }; |
44 | 57 | ||
45 | #endif | 58 | #endif |
diff --git a/noncore/settings/aqpkg/global.h b/noncore/settings/aqpkg/global.h index 920b090..4fdd51d 100644 --- a/noncore/settings/aqpkg/global.h +++ b/noncore/settings/aqpkg/global.h | |||
@@ -1,80 +1,92 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | global.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
17 | 29 | ||
18 | #ifndef __GLOBAL_H | 30 | #ifndef __GLOBAL_H |
19 | #define __GLOBAL_H | 31 | #define __GLOBAL_H |
20 | 32 | ||
21 | #define VERSION_TEXT "AQPkg Version 1.11" | 33 | #define VERSION_TEXT "AQPkg Version 1.11" |
22 | 34 | ||
23 | // Uncomment the below line to run on a Linux box rather than a Zaurus | 35 | // Uncomment the below line to run on a Linux box rather than a Zaurus |
24 | // box this allows you to change where root is, and where to load config files from | 36 | // box this allows you to change where root is, and where to load config files from |
25 | // #define X86 | 37 | // #define X86 |
26 | 38 | ||
27 | // Sets up location of ipkg.conf and root directory | 39 | // Sets up location of ipkg.conf and root directory |
28 | #ifdef QWS | 40 | #ifdef QWS |
29 | 41 | ||
30 | #ifndef X86 | 42 | #ifndef X86 |
31 | 43 | ||
32 | // Running QT/Embedded on an arm processor | 44 | // Running QT/Embedded on an arm processor |
33 | #define IPKG_CONF "/etc/ipkg.conf" | 45 | #define IPKG_CONF "/etc/ipkg.conf" |
34 | #define ROOT "/" | 46 | #define ROOT "/" |
35 | #define IPKG_DIR "/usr/lib/ipkg/" | 47 | #define IPKG_DIR "/usr/lib/ipkg/" |
36 | 48 | ||
37 | #else | 49 | #else |
38 | 50 | ||
39 | // Running QT/Embedded on a X86 linux box | 51 | // Running QT/Embedded on a X86 linux box |
40 | #define IPKG_CONF "/home/andy/projects/aqpkg/data/ipkg.conf" | 52 | #define IPKG_CONF "/home/andy/projects/aqpkg/data/ipkg.conf" |
41 | #define ROOT "/home/andy/projects/aqpkg/data/root" | 53 | #define ROOT "/home/andy/projects/aqpkg/data/root" |
42 | #define IPKG_DIR "/home/andy/projects/aqpkg/data/" | 54 | #define IPKG_DIR "/home/andy/projects/aqpkg/data/" |
43 | 55 | ||
44 | #endif | 56 | #endif |
45 | 57 | ||
46 | #else | 58 | #else |
47 | 59 | ||
48 | // Running QT on a X86 linux box | 60 | // Running QT on a X86 linux box |
49 | #define IPKG_CONF "/home/andy/projects/aqpkg/data/ipkg.conf" | 61 | #define IPKG_CONF "/home/andy/projects/aqpkg/data/ipkg.conf" |
50 | #define ROOT "/home/andy/projects/aqpkg/data/root" | 62 | #define ROOT "/home/andy/projects/aqpkg/data/root" |
51 | #define IPKG_DIR "/home/andy/projects/aqpkg/data/" | 63 | #define IPKG_DIR "/home/andy/projects/aqpkg/data/" |
52 | 64 | ||
53 | #endif | 65 | #endif |
54 | 66 | ||
55 | 67 | ||
56 | // Uncomment the below line to turn on memory checking | 68 | // Uncomment the below line to turn on memory checking |
57 | //#define _DEBUG 1 | 69 | //#define _DEBUG 1 |
58 | 70 | ||
59 | #ifndef __MEMFILE_C | 71 | #ifndef __MEMFILE_C |
60 | #ifdef _DEBUG | 72 | #ifdef _DEBUG |
61 | void * operator new(unsigned int size,const char *file, int line); | 73 | void * operator new(unsigned int size,const char *file, int line); |
62 | void operator delete(void *p); | 74 | void operator delete(void *p); |
63 | #endif | 75 | #endif |
64 | 76 | ||
65 | #ifdef _DEBUG | 77 | #ifdef _DEBUG |
66 | #define DEBUG_NEW new(__FILE__, __LINE__) | 78 | #define DEBUG_NEW new(__FILE__, __LINE__) |
67 | //#define DEBUG_NEW new | 79 | //#define DEBUG_NEW new |
68 | #else | 80 | #else |
69 | #define DEBUG_NEW new | 81 | #define DEBUG_NEW new |
70 | #endif | 82 | #endif |
71 | 83 | ||
72 | #define new DEBUG_NEW | 84 | #define new DEBUG_NEW |
73 | #endif | 85 | #endif |
74 | 86 | ||
75 | 87 | ||
76 | void AddTrack(long addr, long asize, const char *fname, long lnum); | 88 | void AddTrack(long addr, long asize, const char *fname, long lnum); |
77 | void RemoveTrack(long addr); | 89 | void RemoveTrack(long addr); |
78 | void DumpUnfreed(); | 90 | void DumpUnfreed(); |
79 | 91 | ||
80 | #endif | 92 | #endif |
diff --git a/noncore/settings/aqpkg/inputdlg.cpp b/noncore/settings/aqpkg/inputdlg.cpp index 724a891..06e934c 100644 --- a/noncore/settings/aqpkg/inputdlg.cpp +++ b/noncore/settings/aqpkg/inputdlg.cpp | |||
@@ -1,121 +1,134 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | inputdlg.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | |||
17 | #include <qlayout.h> | 30 | #include <qlayout.h> |
18 | #include <qlabel.h> | 31 | #include <qlabel.h> |
19 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
20 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
21 | #include <qspinbox.h> | 34 | #include <qspinbox.h> |
22 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
23 | #include <qwidgetstack.h> | 36 | #include <qwidgetstack.h> |
24 | #include <qvalidator.h> | 37 | #include <qvalidator.h> |
25 | #include <qapplication.h> | 38 | #include <qapplication.h> |
26 | 39 | ||
27 | #include "inputdlg.h" | 40 | #include "inputdlg.h" |
28 | #include "global.h" | 41 | #include "global.h" |
29 | 42 | ||
30 | 43 | ||
31 | InputDialog :: InputDialog( const QString &label, QWidget* parent, const char* name, | 44 | InputDialog :: InputDialog( const QString &label, QWidget* parent, const char* name, |
32 | bool modal ) | 45 | bool modal ) |
33 | : QDialog( parent, name, modal ) | 46 | : QDialog( parent, name, modal ) |
34 | { | 47 | { |
35 | lineEdit = 0; | 48 | lineEdit = 0; |
36 | 49 | ||
37 | QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 ); | 50 | QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 ); |
38 | 51 | ||
39 | QLabel* l = new QLabel( label, this ); | 52 | QLabel* l = new QLabel( label, this ); |
40 | vbox->addWidget( l ); | 53 | vbox->addWidget( l ); |
41 | 54 | ||
42 | lineEdit = new QLineEdit( this ); | 55 | lineEdit = new QLineEdit( this ); |
43 | vbox->addWidget( lineEdit ); | 56 | vbox->addWidget( lineEdit ); |
44 | 57 | ||
45 | QHBoxLayout *hbox = new QHBoxLayout( 6 ); | 58 | QHBoxLayout *hbox = new QHBoxLayout( 6 ); |
46 | vbox->addLayout( hbox, AlignRight ); | 59 | vbox->addLayout( hbox, AlignRight ); |
47 | 60 | ||
48 | ok = new QPushButton( tr( "&OK" ), this ); | 61 | ok = new QPushButton( tr( "&OK" ), this ); |
49 | ok->setDefault( TRUE ); | 62 | ok->setDefault( TRUE ); |
50 | QPushButton *cancel = new QPushButton( tr( "&Cancel" ), this ); | 63 | QPushButton *cancel = new QPushButton( tr( "&Cancel" ), this ); |
51 | 64 | ||
52 | QSize bs( ok->sizeHint() ); | 65 | QSize bs( ok->sizeHint() ); |
53 | if ( cancel->sizeHint().width() > bs.width() ) | 66 | if ( cancel->sizeHint().width() > bs.width() ) |
54 | bs.setWidth( cancel->sizeHint().width() ); | 67 | bs.setWidth( cancel->sizeHint().width() ); |
55 | 68 | ||
56 | ok->setFixedSize( bs ); | 69 | ok->setFixedSize( bs ); |
57 | cancel->setFixedSize( bs ); | 70 | cancel->setFixedSize( bs ); |
58 | 71 | ||
59 | hbox->addWidget( new QWidget( this ) ); | 72 | hbox->addWidget( new QWidget( this ) ); |
60 | hbox->addWidget( ok ); | 73 | hbox->addWidget( ok ); |
61 | hbox->addWidget( cancel ); | 74 | hbox->addWidget( cancel ); |
62 | 75 | ||
63 | connect( lineEdit, SIGNAL( returnPressed() ), | 76 | connect( lineEdit, SIGNAL( returnPressed() ), |
64 | this, SLOT( tryAccept() ) ); | 77 | this, SLOT( tryAccept() ) ); |
65 | connect( lineEdit, SIGNAL( textChanged( const QString & ) ), | 78 | connect( lineEdit, SIGNAL( textChanged( const QString & ) ), |
66 | this, SLOT( textChanged( const QString & ) ) ); | 79 | this, SLOT( textChanged( const QString & ) ) ); |
67 | 80 | ||
68 | connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) ); | 81 | connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) ); |
69 | connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); | 82 | connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); |
70 | 83 | ||
71 | resize( QMAX( sizeHint().width(), 240 ), sizeHint().height() ); | 84 | resize( QMAX( sizeHint().width(), 240 ), sizeHint().height() ); |
72 | } | 85 | } |
73 | 86 | ||
74 | /*! | 87 | /*! |
75 | Destructor. | 88 | Destructor. |
76 | */ | 89 | */ |
77 | 90 | ||
78 | InputDialog::~InputDialog() | 91 | InputDialog::~InputDialog() |
79 | { | 92 | { |
80 | } | 93 | } |
81 | 94 | ||
82 | void InputDialog :: setText( const QString &text ) | 95 | void InputDialog :: setText( const QString &text ) |
83 | { | 96 | { |
84 | lineEdit->setText( text ); | 97 | lineEdit->setText( text ); |
85 | lineEdit->selectAll(); | 98 | lineEdit->selectAll(); |
86 | } | 99 | } |
87 | 100 | ||
88 | QString InputDialog :: getText() | 101 | QString InputDialog :: getText() |
89 | { | 102 | { |
90 | return lineEdit->text(); | 103 | return lineEdit->text(); |
91 | } | 104 | } |
92 | 105 | ||
93 | QString InputDialog::getText( const QString &caption, const QString &label, | 106 | QString InputDialog::getText( const QString &caption, const QString &label, |
94 | const QString &text, bool *ok, QWidget *parent, | 107 | const QString &text, bool *ok, QWidget *parent, |
95 | const char *name ) | 108 | const char *name ) |
96 | { | 109 | { |
97 | InputDialog *dlg = new InputDialog( label, parent, name, true ); | 110 | InputDialog *dlg = new InputDialog( label, parent, name, true ); |
98 | dlg->setCaption( caption ); | 111 | dlg->setCaption( caption ); |
99 | dlg->setText( text ); | 112 | dlg->setText( text ); |
100 | 113 | ||
101 | QString result; | 114 | QString result; |
102 | *ok = dlg->exec() == QDialog::Accepted; | 115 | *ok = dlg->exec() == QDialog::Accepted; |
103 | if ( *ok ) | 116 | if ( *ok ) |
104 | result = dlg->getText(); | 117 | result = dlg->getText(); |
105 | 118 | ||
106 | delete dlg; | 119 | delete dlg; |
107 | return result; | 120 | return result; |
108 | } | 121 | } |
109 | 122 | ||
110 | 123 | ||
111 | 124 | ||
112 | void InputDialog :: textChanged( const QString &s ) | 125 | void InputDialog :: textChanged( const QString &s ) |
113 | { | 126 | { |
114 | ok->setEnabled( !s.isEmpty() ); | 127 | ok->setEnabled( !s.isEmpty() ); |
115 | } | 128 | } |
116 | 129 | ||
117 | void InputDialog :: tryAccept() | 130 | void InputDialog :: tryAccept() |
118 | { | 131 | { |
119 | if ( !lineEdit->text().isEmpty() ) | 132 | if ( !lineEdit->text().isEmpty() ) |
120 | accept(); | 133 | accept(); |
121 | } | 134 | } |
diff --git a/noncore/settings/aqpkg/inputdlg.h b/noncore/settings/aqpkg/inputdlg.h index 1e0c5bc..260201e 100644 --- a/noncore/settings/aqpkg/inputdlg.h +++ b/noncore/settings/aqpkg/inputdlg.h | |||
@@ -1,50 +1,62 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | inputdlg.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
17 | 29 | ||
18 | #ifndef INPUTDIALOG_H | 30 | #ifndef INPUTDIALOG_H |
19 | #define INPUTDIALOG_H | 31 | #define INPUTDIALOG_H |
20 | 32 | ||
21 | #include <qdialog.h> | 33 | #include <qdialog.h> |
22 | #include <qstring.h> | 34 | #include <qstring.h> |
23 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
24 | #include <qpushbutton.h> | 36 | #include <qpushbutton.h> |
25 | 37 | ||
26 | class InputDialog : public QDialog | 38 | class InputDialog : public QDialog |
27 | { | 39 | { |
28 | Q_OBJECT | 40 | Q_OBJECT |
29 | 41 | ||
30 | public: | 42 | public: |
31 | static QString getText( const QString &caption, const QString &label, const QString &text = QString::null, | 43 | static QString getText( const QString &caption, const QString &label, const QString &text = QString::null, |
32 | bool *ok = 0, QWidget *parent = 0, const char *name = 0 ); | 44 | bool *ok = 0, QWidget *parent = 0, const char *name = 0 ); |
33 | 45 | ||
34 | InputDialog( const QString &label, QWidget* parent = 0, const char* name = 0, | 46 | InputDialog( const QString &label, QWidget* parent = 0, const char* name = 0, |
35 | bool modal = TRUE ); | 47 | bool modal = TRUE ); |
36 | ~InputDialog(); | 48 | ~InputDialog(); |
37 | 49 | ||
38 | void setText( const QString &text ); | 50 | void setText( const QString &text ); |
39 | QString getText(); | 51 | QString getText(); |
40 | 52 | ||
41 | private slots: | 53 | private slots: |
42 | void textChanged( const QString &s ); | 54 | void textChanged( const QString &s ); |
43 | void tryAccept(); | 55 | void tryAccept(); |
44 | 56 | ||
45 | private: | 57 | private: |
46 | QLineEdit *lineEdit; | 58 | QLineEdit *lineEdit; |
47 | QPushButton *ok; | 59 | QPushButton *ok; |
48 | }; | 60 | }; |
49 | 61 | ||
50 | #endif // INPUTDIALOG_H | 62 | #endif // INPUTDIALOG_H |
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index 896e370..17f7b08 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp | |||
@@ -1,144 +1,156 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | installdlgimpl.cpp - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
17 | 29 | ||
18 | #include <stdio.h> | 30 | #include <stdio.h> |
19 | 31 | ||
20 | #include <opie/ofiledialog.h> | 32 | #include <opie/ofiledialog.h> |
21 | 33 | ||
22 | #ifdef QWS | 34 | #ifdef QWS |
23 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
24 | #include <qpe/fileselector.h> | 36 | #include <qpe/fileselector.h> |
25 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/resource.h> | 38 | #include <qpe/resource.h> |
27 | #include <qpe/storage.h> | 39 | #include <qpe/storage.h> |
28 | #endif | 40 | #endif |
29 | 41 | ||
30 | #include <qcheckbox.h> | 42 | #include <qcheckbox.h> |
31 | #include <qcombobox.h> | 43 | #include <qcombobox.h> |
32 | #include <qdialog.h> | 44 | #include <qdialog.h> |
33 | #include <qfileinfo.h> | 45 | #include <qfileinfo.h> |
34 | #include <qgroupbox.h> | 46 | #include <qgroupbox.h> |
35 | #include <qmultilineedit.h> | 47 | #include <qmultilineedit.h> |
36 | #include <qlabel.h> | 48 | #include <qlabel.h> |
37 | #include <qlayout.h> | 49 | #include <qlayout.h> |
38 | #include <qpushbutton.h> | 50 | #include <qpushbutton.h> |
39 | 51 | ||
40 | #include "datamgr.h" | 52 | #include "datamgr.h" |
41 | #include "destination.h" | 53 | #include "destination.h" |
42 | #include "instoptionsimpl.h" | 54 | #include "instoptionsimpl.h" |
43 | #include "installdlgimpl.h" | 55 | #include "installdlgimpl.h" |
44 | #include "ipkg.h" | 56 | #include "ipkg.h" |
45 | #include "utils.h" | 57 | #include "utils.h" |
46 | #include "global.h" | 58 | #include "global.h" |
47 | 59 | ||
48 | enum { | 60 | enum { |
49 | MAXLINES = 100, | 61 | MAXLINES = 100, |
50 | }; | 62 | }; |
51 | 63 | ||
52 | InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title ) | 64 | InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title ) |
53 | : QWidget( 0, 0, 0 ) | 65 | : QWidget( 0, 0, 0 ) |
54 | { | 66 | { |
55 | setCaption( title ); | 67 | setCaption( title ); |
56 | init( TRUE ); | 68 | init( TRUE ); |
57 | 69 | ||
58 | pIpkg = 0; | 70 | pIpkg = 0; |
59 | upgradePackages = false; | 71 | upgradePackages = false; |
60 | dataMgr = dataManager; | 72 | dataMgr = dataManager; |
61 | 73 | ||
62 | QString defaultDest = "root"; | 74 | QString defaultDest = "root"; |
63 | #ifdef QWS | 75 | #ifdef QWS |
64 | Config cfg( "aqpkg" ); | 76 | Config cfg( "aqpkg" ); |
65 | cfg.setGroup( "settings" ); | 77 | cfg.setGroup( "settings" ); |
66 | defaultDest = cfg.readEntry( "dest", "root" ); | 78 | defaultDest = cfg.readEntry( "dest", "root" ); |
67 | 79 | ||
68 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) | 80 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) |
69 | flags = cfg.readNumEntry( "installFlags", 0 ); | 81 | flags = cfg.readNumEntry( "installFlags", 0 ); |
70 | infoLevel = cfg.readNumEntry( "infoLevel", 1 ); | 82 | infoLevel = cfg.readNumEntry( "infoLevel", 1 ); |
71 | #else | 83 | #else |
72 | flags = 0; | 84 | flags = 0; |
73 | #endif | 85 | #endif |
74 | 86 | ||
75 | // Output text is read only | 87 | // Output text is read only |
76 | output->setReadOnly( true ); | 88 | output->setReadOnly( true ); |
77 | //QFont f( "helvetica" ); | 89 | //QFont f( "helvetica" ); |
78 | //f.setPointSize( 10 ); | 90 | //f.setPointSize( 10 ); |
79 | //output->setFont( f ); | 91 | //output->setFont( f ); |
80 | 92 | ||
81 | 93 | ||
82 | // setup destination data | 94 | // setup destination data |
83 | int defIndex = 0; | 95 | int defIndex = 0; |
84 | int i; | 96 | int i; |
85 | QListIterator<Destination> dit( dataMgr->getDestinationList() ); | 97 | QListIterator<Destination> dit( dataMgr->getDestinationList() ); |
86 | for ( i = 0; dit.current(); ++dit, ++i ) | 98 | for ( i = 0; dit.current(); ++dit, ++i ) |
87 | { | 99 | { |
88 | destination->insertItem( dit.current()->getDestinationName() ); | 100 | destination->insertItem( dit.current()->getDestinationName() ); |
89 | if ( dit.current()->getDestinationName() == defaultDest ) | 101 | if ( dit.current()->getDestinationName() == defaultDest ) |
90 | defIndex = i; | 102 | defIndex = i; |
91 | } | 103 | } |
92 | 104 | ||
93 | destination->setCurrentItem( defIndex ); | 105 | destination->setCurrentItem( defIndex ); |
94 | 106 | ||
95 | QListIterator<InstallData> it( packageList ); | 107 | QListIterator<InstallData> it( packageList ); |
96 | // setup package data | 108 | // setup package data |
97 | QString remove = tr( "Remove\n" ); | 109 | QString remove = tr( "Remove\n" ); |
98 | QString install = tr( "Install\n" ); | 110 | QString install = tr( "Install\n" ); |
99 | QString upgrade = tr( "Upgrade\n" ); | 111 | QString upgrade = tr( "Upgrade\n" ); |
100 | for ( ; it.current(); ++it ) | 112 | for ( ; it.current(); ++it ) |
101 | { | 113 | { |
102 | InstallData *item = it.current(); | 114 | InstallData *item = it.current(); |
103 | InstallData *newitem = new InstallData(); | 115 | InstallData *newitem = new InstallData(); |
104 | 116 | ||
105 | newitem->option = item->option; | 117 | newitem->option = item->option; |
106 | newitem->packageName = item->packageName; | 118 | newitem->packageName = item->packageName; |
107 | newitem->destination = item->destination; | 119 | newitem->destination = item->destination; |
108 | newitem->recreateLinks = item->recreateLinks; | 120 | newitem->recreateLinks = item->recreateLinks; |
109 | packages.append( newitem ); | 121 | packages.append( newitem ); |
110 | 122 | ||
111 | if ( item->option == "I" ) | 123 | if ( item->option == "I" ) |
112 | { | 124 | { |
113 | install.append( QString( " %1\n" ).arg( item->packageName ) ); | 125 | install.append( QString( " %1\n" ).arg( item->packageName ) ); |
114 | } | 126 | } |
115 | else if ( item->option == "D" ) | 127 | else if ( item->option == "D" ) |
116 | { | 128 | { |
117 | remove.append( QString( " %1\n" ).arg( item->packageName ) ); | 129 | remove.append( QString( " %1\n" ).arg( item->packageName ) ); |
118 | } | 130 | } |
119 | else if ( item->option == "U" || item->option == "R" ) | 131 | else if ( item->option == "U" || item->option == "R" ) |
120 | { | 132 | { |
121 | QString type; | 133 | QString type; |
122 | if ( item->option == "R" ) | 134 | if ( item->option == "R" ) |
123 | type = tr( "(ReInstall)" ); | 135 | type = tr( "(ReInstall)" ); |
124 | else | 136 | else |
125 | type = tr( "(Upgrade)" ); | 137 | type = tr( "(Upgrade)" ); |
126 | upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) ); | 138 | upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) ); |
127 | } | 139 | } |
128 | } | 140 | } |
129 | 141 | ||
130 | output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); | 142 | output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); |
131 | 143 | ||
132 | displayAvailableSpace( destination->currentText() ); | 144 | displayAvailableSpace( destination->currentText() ); |
133 | } | 145 | } |
134 | 146 | ||
135 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title ) | 147 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title ) |
136 | : QWidget( 0, 0, 0 ) | 148 | : QWidget( 0, 0, 0 ) |
137 | { | 149 | { |
138 | setCaption( title ); | 150 | setCaption( title ); |
139 | init( FALSE ); | 151 | init( FALSE ); |
140 | pIpkg = ipkg; | 152 | pIpkg = ipkg; |
141 | output->setText( initialText ); | 153 | output->setText( initialText ); |
142 | } | 154 | } |
143 | 155 | ||
144 | 156 | ||
@@ -338,129 +350,129 @@ void InstallDlgImpl :: installSelected() | |||
338 | pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); | 350 | pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); |
339 | pIpkg->setPackage( idata->packageName ); | 351 | pIpkg->setPackage( idata->packageName ); |
340 | 352 | ||
341 | int tmpFlags = flags; | 353 | int tmpFlags = flags; |
342 | if ( idata->destination->linkToRoot() && idata->recreateLinks ) | 354 | if ( idata->destination->linkToRoot() && idata->recreateLinks ) |
343 | tmpFlags |= MAKE_LINKS; | 355 | tmpFlags |= MAKE_LINKS; |
344 | pIpkg->setFlags( tmpFlags, infoLevel ); | 356 | pIpkg->setFlags( tmpFlags, infoLevel ); |
345 | pIpkg->runIpkg(); | 357 | pIpkg->runIpkg(); |
346 | } | 358 | } |
347 | 359 | ||
348 | delete pIpkg; | 360 | delete pIpkg; |
349 | pIpkg = 0; | 361 | pIpkg = 0; |
350 | */ | 362 | */ |
351 | } | 363 | } |
352 | } | 364 | } |
353 | 365 | ||
354 | 366 | ||
355 | void InstallDlgImpl :: displayText(const QString &text ) | 367 | void InstallDlgImpl :: displayText(const QString &text ) |
356 | { | 368 | { |
357 | QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); | 369 | QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); |
358 | 370 | ||
359 | /* Set a max line count for the QMultiLineEdit, as users have reported | 371 | /* Set a max line count for the QMultiLineEdit, as users have reported |
360 | * performance issues when line count gets extreme. | 372 | * performance issues when line count gets extreme. |
361 | */ | 373 | */ |
362 | if(output->numLines() >= MAXLINES) | 374 | if(output->numLines() >= MAXLINES) |
363 | output->removeLine(0); | 375 | output->removeLine(0); |
364 | output->setText( newtext ); | 376 | output->setText( newtext ); |
365 | output->setCursorPosition( output->numLines(), 0 ); | 377 | output->setCursorPosition( output->numLines(), 0 ); |
366 | } | 378 | } |
367 | 379 | ||
368 | 380 | ||
369 | void InstallDlgImpl :: displayAvailableSpace( const QString &text ) | 381 | void InstallDlgImpl :: displayAvailableSpace( const QString &text ) |
370 | { | 382 | { |
371 | Destination *d = dataMgr->getDestination( text ); | 383 | Destination *d = dataMgr->getDestination( text ); |
372 | QString destDir = d->getDestinationPath(); | 384 | QString destDir = d->getDestinationPath(); |
373 | 385 | ||
374 | long blockSize = 0; | 386 | long blockSize = 0; |
375 | long totalBlocks = 0; | 387 | long totalBlocks = 0; |
376 | long availBlocks = 0; | 388 | long availBlocks = 0; |
377 | QString space; | 389 | QString space; |
378 | if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) | 390 | if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) |
379 | { | 391 | { |
380 | long mult = blockSize / 1024; | 392 | long mult = blockSize / 1024; |
381 | long div = 1024 / blockSize; | 393 | long div = 1024 / blockSize; |
382 | 394 | ||
383 | if ( !mult ) mult = 1; | 395 | if ( !mult ) mult = 1; |
384 | if ( !div ) div = 1; | 396 | if ( !div ) div = 1; |
385 | // long total = totalBlocks * mult / div; | 397 | // long total = totalBlocks * mult / div; |
386 | long avail = availBlocks * mult / div; | 398 | long avail = availBlocks * mult / div; |
387 | // long used = total - avail; | 399 | // long used = total - avail; |
388 | 400 | ||
389 | space.sprintf( "%ld Kb", avail ); | 401 | space.sprintf( "%ld Kb", avail ); |
390 | } | 402 | } |
391 | else | 403 | else |
392 | space = tr( "Unknown" ); | 404 | space = tr( "Unknown" ); |
393 | 405 | ||
394 | if ( txtAvailableSpace ) | 406 | if ( txtAvailableSpace ) |
395 | txtAvailableSpace->setText( space ); | 407 | txtAvailableSpace->setText( space ); |
396 | } | 408 | } |
397 | 409 | ||
398 | void InstallDlgImpl :: ipkgFinished() | 410 | void InstallDlgImpl :: ipkgFinished() |
399 | { | 411 | { |
400 | InstallData *item; | 412 | InstallData *item; |
401 | if ( firstPackage ) | 413 | if ( firstPackage ) |
402 | item = packages.first(); | 414 | item = packages.first(); |
403 | else | 415 | else |
404 | { | 416 | { |
405 | // Create symlinks if necessary before moving on to next package | 417 | // Create symlinks if necessary before moving on to next package |
406 | pIpkg->createSymLinks(); | 418 | pIpkg->createSymLinks(); |
407 | 419 | ||
408 | item = packages.next(); | 420 | item = packages.next(); |
409 | } | 421 | } |
410 | 422 | ||
411 | firstPackage = FALSE; | 423 | firstPackage = FALSE; |
412 | if ( item ) | 424 | if ( item ) |
413 | { | 425 | { |
414 | pIpkg->setPackage( item->packageName ); | 426 | pIpkg->setPackage( item->packageName ); |
415 | int tmpFlags = flags; | 427 | int tmpFlags = flags; |
416 | 428 | ||
417 | if ( item->option == "I" ) | 429 | if ( item->option == "I" ) |
418 | { | 430 | { |
419 | pIpkg->setOption( "install" ); | 431 | pIpkg->setOption( "install" ); |
420 | Destination *d = dataMgr->getDestination( destination->currentText() ); | 432 | Destination *d = dataMgr->getDestination( destination->currentText() ); |
421 | pIpkg->setDestination( d->getDestinationName() ); | 433 | pIpkg->setDestination( d->getDestinationName() ); |
422 | pIpkg->setDestinationDir( d->getDestinationPath() ); | 434 | pIpkg->setDestinationDir( d->getDestinationPath() ); |
423 | 435 | ||
424 | if ( d->linkToRoot() ) | 436 | if ( d->linkToRoot() ) |
425 | tmpFlags |= MAKE_LINKS; | 437 | tmpFlags |= MAKE_LINKS; |
426 | } | 438 | } |
427 | else if ( item->option == "D" ) | 439 | else if ( item->option == "D" ) |
428 | { | 440 | { |
429 | pIpkg->setOption( "remove" ); | 441 | pIpkg->setOption( "remove" ); |
430 | pIpkg->setDestination( item->destination->getDestinationName() ); | 442 | pIpkg->setDestination( item->destination->getDestinationName() ); |
431 | pIpkg->setDestinationDir( item->destination->getDestinationPath() ); | 443 | pIpkg->setDestinationDir( item->destination->getDestinationPath() ); |
432 | 444 | ||
433 | if ( item->destination->linkToRoot() ) | 445 | if ( item->destination->linkToRoot() ) |
434 | tmpFlags |= MAKE_LINKS; | 446 | tmpFlags |= MAKE_LINKS; |
435 | } | 447 | } |
436 | else | 448 | else |
437 | { | 449 | { |
438 | if ( item->option == "R" ) | 450 | if ( item->option == "R" ) |
439 | pIpkg->setOption( "reinstall" ); | 451 | pIpkg->setOption( "reinstall" ); |
440 | else | 452 | else |
441 | pIpkg->setOption( "upgrade" ); | 453 | pIpkg->setOption( "upgrade" ); |
442 | 454 | ||
443 | pIpkg->setDestination( item->destination->getDestinationName() ); | 455 | pIpkg->setDestination( item->destination->getDestinationName() ); |
444 | pIpkg->setDestinationDir( item->destination->getDestinationPath() ); | 456 | pIpkg->setDestinationDir( item->destination->getDestinationPath() ); |
445 | pIpkg->setPackage( item->packageName ); | 457 | pIpkg->setPackage( item->packageName ); |
446 | 458 | ||
447 | tmpFlags |= FORCE_REINSTALL; | 459 | tmpFlags |= FORCE_REINSTALL; |
448 | if ( item->destination->linkToRoot() && item->recreateLinks ) | 460 | if ( item->destination->linkToRoot() && item->recreateLinks ) |
449 | tmpFlags |= MAKE_LINKS; | 461 | tmpFlags |= MAKE_LINKS; |
450 | } | 462 | } |
451 | pIpkg->setFlags( tmpFlags, infoLevel ); | 463 | pIpkg->setFlags( tmpFlags, infoLevel ); |
452 | pIpkg->runIpkg(); | 464 | pIpkg->runIpkg(); |
453 | } | 465 | } |
454 | else | 466 | else |
455 | { | 467 | { |
456 | btnOptions->setEnabled( true ); | 468 | btnOptions->setEnabled( true ); |
457 | btnInstall->setText( tr( "Close" ) ); | 469 | btnInstall->setText( tr( "Close" ) ); |
458 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); | 470 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); |
459 | 471 | ||
460 | btnOptions->setText( tr( "Save output" ) ); | 472 | btnOptions->setText( tr( "Save output" ) ); |
461 | btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); | 473 | btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); |
462 | 474 | ||
463 | if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) | 475 | if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) |
464 | displayAvailableSpace( destination->currentText() ); | 476 | displayAvailableSpace( destination->currentText() ); |
465 | } | 477 | } |
466 | } \ No newline at end of file | 478 | } |
diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h index 9a7dbff..894465a 100644 --- a/noncore/settings/aqpkg/installdlgimpl.h +++ b/noncore/settings/aqpkg/installdlgimpl.h | |||
@@ -1,86 +1,99 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | installdlgimpl.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This file is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
8 | 29 | ||
9 | /*************************************************************************** | ||
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | #ifndef INSTALLDLGIMPL_H | 30 | #ifndef INSTALLDLGIMPL_H |
18 | #define INSTALLDLGIMPL_H | 31 | #define INSTALLDLGIMPL_H |
19 | 32 | ||
20 | using namespace std; | 33 | using namespace std; |
21 | 34 | ||
22 | #include <qlist.h> | 35 | #include <qlist.h> |
23 | #include <qstring.h> | 36 | #include <qstring.h> |
24 | #include <qwidget.h> | 37 | #include <qwidget.h> |
25 | 38 | ||
26 | class QComboBox; | 39 | class QComboBox; |
27 | class QLabel; | 40 | class QLabel; |
28 | class QMultiLineEdit; | 41 | class QMultiLineEdit; |
29 | class QPushButton; | 42 | class QPushButton; |
30 | 43 | ||
31 | class DataManager; | 44 | class DataManager; |
32 | class Destination; | 45 | class Destination; |
33 | class Ipkg; | 46 | class Ipkg; |
34 | 47 | ||
35 | class InstallData | 48 | class InstallData |
36 | { | 49 | { |
37 | public: | 50 | public: |
38 | QString option; // I - install, D - delete, R- reinstall U - upgrade | 51 | QString option; // I - install, D - delete, R- reinstall U - upgrade |
39 | QString packageName; | 52 | QString packageName; |
40 | Destination *destination; | 53 | Destination *destination; |
41 | bool recreateLinks; | 54 | bool recreateLinks; |
42 | }; | 55 | }; |
43 | 56 | ||
44 | class InstallDlgImpl : public QWidget | 57 | class InstallDlgImpl : public QWidget |
45 | { | 58 | { |
46 | Q_OBJECT | 59 | Q_OBJECT |
47 | public: | 60 | public: |
48 | InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title = 0 ); | 61 | InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title = 0 ); |
49 | InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 ); | 62 | InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 ); |
50 | ~InstallDlgImpl(); | 63 | ~InstallDlgImpl(); |
51 | 64 | ||
52 | bool upgradeServer( QString &server ); | 65 | bool upgradeServer( QString &server ); |
53 | 66 | ||
54 | protected: | 67 | protected: |
55 | 68 | ||
56 | private: | 69 | private: |
57 | DataManager *dataMgr; | 70 | DataManager *dataMgr; |
58 | QList<InstallData> packages; | 71 | QList<InstallData> packages; |
59 | bool firstPackage; | 72 | bool firstPackage; |
60 | int flags; | 73 | int flags; |
61 | int infoLevel; | 74 | int infoLevel; |
62 | Ipkg *pIpkg; | 75 | Ipkg *pIpkg; |
63 | bool upgradePackages; | 76 | bool upgradePackages; |
64 | 77 | ||
65 | QComboBox *destination; | 78 | QComboBox *destination; |
66 | QPushButton *btnInstall; | 79 | QPushButton *btnInstall; |
67 | QPushButton *btnOptions; | 80 | QPushButton *btnOptions; |
68 | QMultiLineEdit *output; | 81 | QMultiLineEdit *output; |
69 | QLabel *txtAvailableSpace; | 82 | QLabel *txtAvailableSpace; |
70 | 83 | ||
71 | void init( bool ); | 84 | void init( bool ); |
72 | 85 | ||
73 | bool runIpkg( QString &option, const QString& package, const QString& dest, int flags ); | 86 | bool runIpkg( QString &option, const QString& package, const QString& dest, int flags ); |
74 | 87 | ||
75 | signals: | 88 | signals: |
76 | void reloadData( InstallDlgImpl * ); | 89 | void reloadData( InstallDlgImpl * ); |
77 | 90 | ||
78 | public slots: | 91 | public slots: |
79 | void optionsSelected(); | 92 | void optionsSelected(); |
80 | void installSelected(); | 93 | void installSelected(); |
81 | void displayText(const QString &text ); | 94 | void displayText(const QString &text ); |
82 | void displayAvailableSpace( const QString &text); | 95 | void displayAvailableSpace( const QString &text); |
83 | void ipkgFinished(); | 96 | void ipkgFinished(); |
84 | }; | 97 | }; |
85 | 98 | ||
86 | #endif | 99 | #endif |
diff --git a/noncore/settings/aqpkg/instoptionsimpl.cpp b/noncore/settings/aqpkg/instoptionsimpl.cpp index 72d794f..9d52013 100644 --- a/noncore/settings/aqpkg/instoptionsimpl.cpp +++ b/noncore/settings/aqpkg/instoptionsimpl.cpp | |||
@@ -1,116 +1,128 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | instoptionsimpl.cpp - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
17 | 29 | ||
18 | #ifdef QWS | 30 | #ifdef QWS |
19 | #include <qpe/config.h> | 31 | #include <qpe/config.h> |
20 | #endif | 32 | #endif |
21 | 33 | ||
22 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
23 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
24 | #include <qgroupbox.h> | 36 | #include <qgroupbox.h> |
25 | #include <qlabel.h> | 37 | #include <qlabel.h> |
26 | #include <qlayout.h> | 38 | #include <qlayout.h> |
27 | 39 | ||
28 | #include "global.h" | 40 | #include "global.h" |
29 | #include "instoptionsimpl.h" | 41 | #include "instoptionsimpl.h" |
30 | #include "ipkg.h" | 42 | #include "ipkg.h" |
31 | 43 | ||
32 | InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * parent, const char* name, bool modal, WFlags fl ) | 44 | InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * parent, const char* name, bool modal, WFlags fl ) |
33 | : QDialog( parent, name, modal, fl ) | 45 | : QDialog( parent, name, modal, fl ) |
34 | { | 46 | { |
35 | setCaption( tr( "Options" ) ); | 47 | setCaption( tr( "Options" ) ); |
36 | 48 | ||
37 | QVBoxLayout *layout = new QVBoxLayout( this ); | 49 | QVBoxLayout *layout = new QVBoxLayout( this ); |
38 | layout->setMargin( 2 ); | 50 | layout->setMargin( 2 ); |
39 | layout->setSpacing( 4 ); | 51 | layout->setSpacing( 4 ); |
40 | 52 | ||
41 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Options" ), this ); | 53 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Options" ), this ); |
42 | grpbox->layout()->setSpacing( 2 ); | 54 | grpbox->layout()->setSpacing( 2 ); |
43 | grpbox->layout()->setMargin( 4 ); | 55 | grpbox->layout()->setMargin( 4 ); |
44 | layout->addWidget( grpbox ); | 56 | layout->addWidget( grpbox ); |
45 | 57 | ||
46 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); | 58 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); |
47 | 59 | ||
48 | forceDepends = new QCheckBox( tr( "Force Depends" ), grpbox ); | 60 | forceDepends = new QCheckBox( tr( "Force Depends" ), grpbox ); |
49 | grplayout->addWidget( forceDepends ); | 61 | grplayout->addWidget( forceDepends ); |
50 | 62 | ||
51 | forceReinstall = new QCheckBox( tr( "Force Reinstall" ), grpbox ); | 63 | forceReinstall = new QCheckBox( tr( "Force Reinstall" ), grpbox ); |
52 | grplayout->addWidget( forceReinstall ); | 64 | grplayout->addWidget( forceReinstall ); |
53 | 65 | ||
54 | forceRemove = new QCheckBox( tr( "Force Remove" ), grpbox ); | 66 | forceRemove = new QCheckBox( tr( "Force Remove" ), grpbox ); |
55 | grplayout->addWidget( forceRemove ); | 67 | grplayout->addWidget( forceRemove ); |
56 | 68 | ||
57 | forceOverwrite = new QCheckBox( tr( "Force Overwrite" ), grpbox ); | 69 | forceOverwrite = new QCheckBox( tr( "Force Overwrite" ), grpbox ); |
58 | grplayout->addWidget( forceOverwrite ); | 70 | grplayout->addWidget( forceOverwrite ); |
59 | 71 | ||
60 | QLabel *l = new QLabel( tr( "Information Level" ), grpbox ); | 72 | QLabel *l = new QLabel( tr( "Information Level" ), grpbox ); |
61 | grplayout->addWidget( l ); | 73 | grplayout->addWidget( l ); |
62 | 74 | ||
63 | verboseIpkg = new QComboBox( grpbox ); | 75 | verboseIpkg = new QComboBox( grpbox ); |
64 | verboseIpkg->insertItem( tr( "Errors only" ) ); | 76 | verboseIpkg->insertItem( tr( "Errors only" ) ); |
65 | verboseIpkg->insertItem( tr( "Normal messages" ) ); | 77 | verboseIpkg->insertItem( tr( "Normal messages" ) ); |
66 | verboseIpkg->insertItem( tr( "Informative messages" ) ); | 78 | verboseIpkg->insertItem( tr( "Informative messages" ) ); |
67 | verboseIpkg->insertItem( tr( "Troubleshooting output" ) ); | 79 | verboseIpkg->insertItem( tr( "Troubleshooting output" ) ); |
68 | verboseIpkg->setCurrentItem( verb ); | 80 | verboseIpkg->setCurrentItem( verb ); |
69 | grplayout->addWidget( verboseIpkg ); | 81 | grplayout->addWidget( verboseIpkg ); |
70 | 82 | ||
71 | grplayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 83 | grplayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
72 | 84 | ||
73 | if ( flags & FORCE_DEPENDS ) | 85 | if ( flags & FORCE_DEPENDS ) |
74 | forceDepends->setChecked( true ); | 86 | forceDepends->setChecked( true ); |
75 | if ( flags & FORCE_REINSTALL ) | 87 | if ( flags & FORCE_REINSTALL ) |
76 | forceReinstall->setChecked( true ); | 88 | forceReinstall->setChecked( true ); |
77 | if ( flags & FORCE_REMOVE ) | 89 | if ( flags & FORCE_REMOVE ) |
78 | forceRemove->setChecked( true ); | 90 | forceRemove->setChecked( true ); |
79 | if ( flags & FORCE_OVERWRITE ) | 91 | if ( flags & FORCE_OVERWRITE ) |
80 | forceOverwrite->setChecked( true ); | 92 | forceOverwrite->setChecked( true ); |
81 | // if ( flags & VERBOSE_WGET ) | 93 | // if ( flags & VERBOSE_WGET ) |
82 | // verboseWget->setChecked( true ); | 94 | // verboseWget->setChecked( true ); |
83 | // if ( flags & MAKE_LINKS ) | 95 | // if ( flags & MAKE_LINKS ) |
84 | // makeLinks->setChecked( true ); | 96 | // makeLinks->setChecked( true ); |
85 | 97 | ||
86 | showMaximized(); | 98 | showMaximized(); |
87 | 99 | ||
88 | } | 100 | } |
89 | 101 | ||
90 | InstallOptionsDlgImpl::~InstallOptionsDlgImpl() | 102 | InstallOptionsDlgImpl::~InstallOptionsDlgImpl() |
91 | { | 103 | { |
92 | } | 104 | } |
93 | 105 | ||
94 | 106 | ||
95 | int InstallOptionsDlgImpl :: getFlags() | 107 | int InstallOptionsDlgImpl :: getFlags() |
96 | { | 108 | { |
97 | int flags = 0; | 109 | int flags = 0; |
98 | 110 | ||
99 | if ( forceDepends->isChecked() ) | 111 | if ( forceDepends->isChecked() ) |
100 | flags |= FORCE_DEPENDS; | 112 | flags |= FORCE_DEPENDS; |
101 | if ( forceReinstall->isChecked() ) | 113 | if ( forceReinstall->isChecked() ) |
102 | flags |= FORCE_REINSTALL; | 114 | flags |= FORCE_REINSTALL; |
103 | if ( forceRemove->isChecked() ) | 115 | if ( forceRemove->isChecked() ) |
104 | flags |= FORCE_REMOVE; | 116 | flags |= FORCE_REMOVE; |
105 | if ( forceOverwrite->isChecked() ) | 117 | if ( forceOverwrite->isChecked() ) |
106 | flags |= FORCE_OVERWRITE; | 118 | flags |= FORCE_OVERWRITE; |
107 | if ( verboseWget->isChecked() ) | 119 | if ( verboseWget->isChecked() ) |
108 | flags |= VERBOSE_WGET; | 120 | flags |= VERBOSE_WGET; |
109 | 121 | ||
110 | return flags; | 122 | return flags; |
111 | } | 123 | } |
112 | 124 | ||
113 | int InstallOptionsDlgImpl :: getInfoLevel() | 125 | int InstallOptionsDlgImpl :: getInfoLevel() |
114 | { | 126 | { |
115 | return verboseIpkg->currentItem(); | 127 | return verboseIpkg->currentItem(); |
116 | } | 128 | } |
diff --git a/noncore/settings/aqpkg/instoptionsimpl.h b/noncore/settings/aqpkg/instoptionsimpl.h index 1312afd..e68a3dc 100644 --- a/noncore/settings/aqpkg/instoptionsimpl.h +++ b/noncore/settings/aqpkg/instoptionsimpl.h | |||
@@ -1,43 +1,56 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | installoptionsimpl.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This file is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
8 | 29 | ||
9 | /*************************************************************************** | ||
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | #ifndef INSTALLOPTIONSIMPL_H | 30 | #ifndef INSTALLOPTIONSIMPL_H |
18 | #define INSTALLOPTIONSIMPL_H | 31 | #define INSTALLOPTIONSIMPL_H |
19 | 32 | ||
20 | #include <qdialog.h> | 33 | #include <qdialog.h> |
21 | 34 | ||
22 | class QCheckBox; | 35 | class QCheckBox; |
23 | class QComboBox; | 36 | class QComboBox; |
24 | 37 | ||
25 | class InstallOptionsDlgImpl : public QDialog | 38 | class InstallOptionsDlgImpl : public QDialog |
26 | { | 39 | { |
27 | Q_OBJECT | 40 | Q_OBJECT |
28 | public: | 41 | public: |
29 | InstallOptionsDlgImpl( int, int, QWidget * = 0, const char * = 0, bool = false, WFlags = 0 ); | 42 | InstallOptionsDlgImpl( int, int, QWidget * = 0, const char * = 0, bool = false, WFlags = 0 ); |
30 | ~InstallOptionsDlgImpl(); | 43 | ~InstallOptionsDlgImpl(); |
31 | int getFlags(); | 44 | int getFlags(); |
32 | int getInfoLevel(); | 45 | int getInfoLevel(); |
33 | 46 | ||
34 | private: | 47 | private: |
35 | QCheckBox* forceDepends; | 48 | QCheckBox* forceDepends; |
36 | QCheckBox* forceReinstall; | 49 | QCheckBox* forceReinstall; |
37 | QCheckBox* forceRemove; | 50 | QCheckBox* forceRemove; |
38 | QCheckBox* forceOverwrite; | 51 | QCheckBox* forceOverwrite; |
39 | QCheckBox* verboseWget; | 52 | QCheckBox* verboseWget; |
40 | QComboBox* verboseIpkg; | 53 | QComboBox* verboseIpkg; |
41 | }; | 54 | }; |
42 | 55 | ||
43 | #endif | 56 | #endif |
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp index 34999ad..08ae386 100644 --- a/noncore/settings/aqpkg/ipkg.cpp +++ b/noncore/settings/aqpkg/ipkg.cpp | |||
@@ -1,144 +1,156 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | ipkg.cpp - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Sat Aug 31 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
17 | 29 | ||
18 | #include <fstream> | 30 | #include <fstream> |
19 | #include <iostream> | 31 | #include <iostream> |
20 | #include <vector> | 32 | #include <vector> |
21 | using namespace std; | 33 | using namespace std; |
22 | 34 | ||
23 | #include <stdio.h> | 35 | #include <stdio.h> |
24 | #include <unistd.h> | 36 | #include <unistd.h> |
25 | 37 | ||
26 | #ifdef QWS | 38 | #ifdef QWS |
27 | #include <qpe/qpeapplication.h> | 39 | #include <qpe/qpeapplication.h> |
28 | #else | 40 | #else |
29 | #include <qapplication.h> | 41 | #include <qapplication.h> |
30 | #endif | 42 | #endif |
31 | #include <qdir.h> | 43 | #include <qdir.h> |
32 | #include <qtextstream.h> | 44 | #include <qtextstream.h> |
33 | 45 | ||
34 | #include <opie/oprocess.h> | 46 | #include <opie/oprocess.h> |
35 | 47 | ||
36 | #include "utils.h" | 48 | #include "utils.h" |
37 | #include "ipkg.h" | 49 | #include "ipkg.h" |
38 | #include "global.h" | 50 | #include "global.h" |
39 | 51 | ||
40 | Ipkg :: Ipkg() | 52 | Ipkg :: Ipkg() |
41 | { | 53 | { |
42 | proc = 0; | 54 | proc = 0; |
43 | } | 55 | } |
44 | 56 | ||
45 | Ipkg :: ~Ipkg() | 57 | Ipkg :: ~Ipkg() |
46 | { | 58 | { |
47 | } | 59 | } |
48 | 60 | ||
49 | // Option is what we are going to do - install, upgrade, download, reinstall | 61 | // Option is what we are going to do - install, upgrade, download, reinstall |
50 | // package is the package name to install - either a fully qualified path and ipk | 62 | // package is the package name to install - either a fully qualified path and ipk |
51 | // file (if stored locally) or just the name of the package (for a network package) | 63 | // file (if stored locally) or just the name of the package (for a network package) |
52 | // packageName is the package name - (for a network package this will be the same as | 64 | // packageName is the package name - (for a network package this will be the same as |
53 | // package parameter) | 65 | // package parameter) |
54 | // dest is the destination alias (from ipk.conf) | 66 | // dest is the destination alias (from ipk.conf) |
55 | // destDir is the dir that the destination alias points to (used to link to root) | 67 | // destDir is the dir that the destination alias points to (used to link to root) |
56 | // flags is the ipkg options flags | 68 | // flags is the ipkg options flags |
57 | // dir is the directory to run ipkg in (defaults to "") | 69 | // dir is the directory to run ipkg in (defaults to "") |
58 | void Ipkg :: runIpkg() | 70 | void Ipkg :: runIpkg() |
59 | { | 71 | { |
60 | error = false; | 72 | error = false; |
61 | QStringList commands; | 73 | QStringList commands; |
62 | 74 | ||
63 | QDir::setCurrent( "/tmp" ); | 75 | QDir::setCurrent( "/tmp" ); |
64 | 76 | ||
65 | if ( runtimeDir != "" ) | 77 | if ( runtimeDir != "" ) |
66 | { | 78 | { |
67 | commands << "cd "; | 79 | commands << "cd "; |
68 | commands << runtimeDir; | 80 | commands << runtimeDir; |
69 | commands << ";"; | 81 | commands << ";"; |
70 | } | 82 | } |
71 | commands << "ipkg" << "-V" << QString::number( infoLevel ) << "-force-defaults"; | 83 | commands << "ipkg" << "-V" << QString::number( infoLevel ) << "-force-defaults"; |
72 | 84 | ||
73 | // only set the destination for an install operation | 85 | // only set the destination for an install operation |
74 | if ( option == "install" ) | 86 | if ( option == "install" ) |
75 | commands << "-dest" << destination; | 87 | commands << "-dest" << destination; |
76 | 88 | ||
77 | 89 | ||
78 | if ( option != "update" && option != "download" ) | 90 | if ( option != "update" && option != "download" ) |
79 | { | 91 | { |
80 | if ( flags & FORCE_DEPENDS ) | 92 | if ( flags & FORCE_DEPENDS ) |
81 | commands << "-force-depends"; | 93 | commands << "-force-depends"; |
82 | if ( flags & FORCE_REINSTALL ) | 94 | if ( flags & FORCE_REINSTALL ) |
83 | commands << "-force-reinstall"; | 95 | commands << "-force-reinstall"; |
84 | if ( flags & FORCE_REMOVE ) | 96 | if ( flags & FORCE_REMOVE ) |
85 | commands << "-force-removal-of-essential-packages"; | 97 | commands << "-force-removal-of-essential-packages"; |
86 | if ( flags & FORCE_OVERWRITE ) | 98 | if ( flags & FORCE_OVERWRITE ) |
87 | commands << "-force-overwrite"; | 99 | commands << "-force-overwrite"; |
88 | if ( infoLevel == 3 ) | 100 | if ( infoLevel == 3 ) |
89 | commands << "-verbose_wget"; | 101 | commands << "-verbose_wget"; |
90 | 102 | ||
91 | // Handle make links | 103 | // Handle make links |
92 | // Rules - If make links is switched on, create links to root | 104 | // Rules - If make links is switched on, create links to root |
93 | // if destDir is NOT / | 105 | // if destDir is NOT / |
94 | if ( flags & MAKE_LINKS ) | 106 | if ( flags & MAKE_LINKS ) |
95 | { | 107 | { |
96 | // If destDir == / turn off make links as package is being insalled | 108 | // If destDir == / turn off make links as package is being insalled |
97 | // to root already. | 109 | // to root already. |
98 | if ( destDir == "/" ) | 110 | if ( destDir == "/" ) |
99 | flags ^= MAKE_LINKS; | 111 | flags ^= MAKE_LINKS; |
100 | } | 112 | } |
101 | } | 113 | } |
102 | 114 | ||
103 | #ifdef X86 | 115 | #ifdef X86 |
104 | commands << "-f"; | 116 | commands << "-f"; |
105 | commands << IPKG_CONF; | 117 | commands << IPKG_CONF; |
106 | #endif | 118 | #endif |
107 | 119 | ||
108 | 120 | ||
109 | if ( option == "reinstall" ) | 121 | if ( option == "reinstall" ) |
110 | commands << "install"; | 122 | commands << "install"; |
111 | else | 123 | else |
112 | commands << option; | 124 | commands << option; |
113 | if ( package != "" ) | 125 | if ( package != "" ) |
114 | commands << package; | 126 | commands << package; |
115 | 127 | ||
116 | 128 | ||
117 | if ( package != "" ) | 129 | if ( package != "" ) |
118 | emit outputText( QString( "Dealing with package " ) + package ); | 130 | emit outputText( QString( "Dealing with package " ) + package ); |
119 | 131 | ||
120 | qApp->processEvents(); | 132 | qApp->processEvents(); |
121 | 133 | ||
122 | // If we are removing, reinstalling or upgrading packages and make links option is selected | 134 | // If we are removing, reinstalling or upgrading packages and make links option is selected |
123 | // create the links | 135 | // create the links |
124 | if ( option == "remove" || option == "reinstall" || option == "upgrade" ) | 136 | if ( option == "remove" || option == "reinstall" || option == "upgrade" ) |
125 | { | 137 | { |
126 | createLinks = false; | 138 | createLinks = false; |
127 | if ( flags & MAKE_LINKS ) | 139 | if ( flags & MAKE_LINKS ) |
128 | { | 140 | { |
129 | emit outputText( QString( "Removing symbolic links...\n" ) ); | 141 | emit outputText( QString( "Removing symbolic links...\n" ) ); |
130 | linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); | 142 | linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); |
131 | emit outputText( QString( " " ) ); | 143 | emit outputText( QString( " " ) ); |
132 | } | 144 | } |
133 | } | 145 | } |
134 | 146 | ||
135 | // Execute command | 147 | // Execute command |
136 | dependantPackages = new QList<QString>; | 148 | dependantPackages = new QList<QString>; |
137 | dependantPackages->setAutoDelete( true ); | 149 | dependantPackages->setAutoDelete( true ); |
138 | 150 | ||
139 | executeIpkgCommand( commands, option ); | 151 | executeIpkgCommand( commands, option ); |
140 | 152 | ||
141 | } | 153 | } |
142 | 154 | ||
143 | void Ipkg :: createSymLinks() | 155 | void Ipkg :: createSymLinks() |
144 | { | 156 | { |
diff --git a/noncore/settings/aqpkg/ipkg.h b/noncore/settings/aqpkg/ipkg.h index a0d38e3..8f254f9 100644 --- a/noncore/settings/aqpkg/ipkg.h +++ b/noncore/settings/aqpkg/ipkg.h | |||
@@ -1,92 +1,104 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | ipkg.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Sat Aug 31 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This file is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
8 | 27 | ||
9 | /*************************************************************************** | 28 | */ |
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | 29 | ||
18 | #ifndef IPKG_H | 30 | #ifndef IPKG_H |
19 | #define IPKG_H | 31 | #define IPKG_H |
20 | 32 | ||
21 | 33 | ||
22 | /** | 34 | /** |
23 | *@author Andy Qua | 35 | *@author Andy Qua |
24 | */ | 36 | */ |
25 | 37 | ||
26 | #include <qobject.h> | 38 | #include <qobject.h> |
27 | #include <qstring.h> | 39 | #include <qstring.h> |
28 | #include <qstringlist.h> | 40 | #include <qstringlist.h> |
29 | #include <qlist.h> | 41 | #include <qlist.h> |
30 | 42 | ||
31 | #define FORCE_DEPENDS 0x0001 | 43 | #define FORCE_DEPENDS 0x0001 |
32 | #define FORCE_REMOVE 0x0002 | 44 | #define FORCE_REMOVE 0x0002 |
33 | #define FORCE_REINSTALL 0x0004 | 45 | #define FORCE_REINSTALL 0x0004 |
34 | #define FORCE_OVERWRITE 0x0008 | 46 | #define FORCE_OVERWRITE 0x0008 |
35 | #define MAKE_LINKS 0x0010 | 47 | #define MAKE_LINKS 0x0010 |
36 | #define VERBOSE_WGET 0x0020 | 48 | #define VERBOSE_WGET 0x0020 |
37 | 49 | ||
38 | class OProcess; | 50 | class OProcess; |
39 | 51 | ||
40 | class Ipkg : public QObject | 52 | class Ipkg : public QObject |
41 | { | 53 | { |
42 | Q_OBJECT | 54 | Q_OBJECT |
43 | public: | 55 | public: |
44 | Ipkg(); | 56 | Ipkg(); |
45 | ~Ipkg(); | 57 | ~Ipkg(); |
46 | void runIpkg(); | 58 | void runIpkg(); |
47 | void createSymLinks(); | 59 | void createSymLinks(); |
48 | 60 | ||
49 | void setOption( const char *opt ) { option = opt; } | 61 | void setOption( const char *opt ) { option = opt; } |
50 | void setPackage( const char *pkg ) { package = pkg; } | 62 | void setPackage( const char *pkg ) { package = pkg; } |
51 | void setDestination( const char *dest ) { destination = dest; } | 63 | void setDestination( const char *dest ) { destination = dest; } |
52 | void setDestinationDir( const char *dir ) { destDir = dir; } | 64 | void setDestinationDir( const char *dir ) { destDir = dir; } |
53 | void setFlags( int fl, int il ) { flags = fl; infoLevel = il; } | 65 | void setFlags( int fl, int il ) { flags = fl; infoLevel = il; } |
54 | void setRuntimeDirectory( const char *dir ) { runtimeDir = dir; } | 66 | void setRuntimeDirectory( const char *dir ) { runtimeDir = dir; } |
55 | 67 | ||
56 | signals: | 68 | signals: |
57 | void outputText( const QString &text ); | 69 | void outputText( const QString &text ); |
58 | void ipkgFinished(); | 70 | void ipkgFinished(); |
59 | 71 | ||
60 | public slots: | 72 | public slots: |
61 | void commandStdout(OProcess*, char *buffer, int buflen); | 73 | void commandStdout(OProcess*, char *buffer, int buflen); |
62 | void commandStderr(OProcess*, char *buffer, int buflen); | 74 | void commandStderr(OProcess*, char *buffer, int buflen); |
63 | void processFinished(); | 75 | void processFinished(); |
64 | void abort(); | 76 | void abort(); |
65 | 77 | ||
66 | 78 | ||
67 | private: | 79 | private: |
68 | bool createLinks; | 80 | bool createLinks; |
69 | bool aborted; | 81 | bool aborted; |
70 | bool error; | 82 | bool error; |
71 | QString option; | 83 | QString option; |
72 | QString package; | 84 | QString package; |
73 | QString destination; | 85 | QString destination; |
74 | QString destDir; | 86 | QString destDir; |
75 | QString runtimeDir; | 87 | QString runtimeDir; |
76 | OProcess *proc; | 88 | OProcess *proc; |
77 | int flags; | 89 | int flags; |
78 | int infoLevel; | 90 | int infoLevel; |
79 | bool finished; | 91 | bool finished; |
80 | 92 | ||
81 | QList<QString> *dependantPackages; | 93 | QList<QString> *dependantPackages; |
82 | 94 | ||
83 | int executeIpkgCommand( QStringList &cmd, const QString option ); | 95 | int executeIpkgCommand( QStringList &cmd, const QString option ); |
84 | void removeStatusEntry(); | 96 | void removeStatusEntry(); |
85 | void linkPackage( const QString &packFileName, const QString &dest, const QString &destDir ); | 97 | void linkPackage( const QString &packFileName, const QString &dest, const QString &destDir ); |
86 | QStringList* getList( const QString &packageFilename, const QString &destDir ); | 98 | QStringList* getList( const QString &packageFilename, const QString &destDir ); |
87 | void processFileList( const QStringList *fileList, const QString &destDir ); | 99 | void processFileList( const QStringList *fileList, const QString &destDir ); |
88 | void processLinkDir( const QString &file, const QString &baseDir, const QString &destDir ); | 100 | void processLinkDir( const QString &file, const QString &baseDir, const QString &destDir ); |
89 | 101 | ||
90 | }; | 102 | }; |
91 | 103 | ||
92 | #endif | 104 | #endif |
diff --git a/noncore/settings/aqpkg/letterpushbutton.cpp b/noncore/settings/aqpkg/letterpushbutton.cpp index ca96c6c..c8b43e9 100644 --- a/noncore/settings/aqpkg/letterpushbutton.cpp +++ b/noncore/settings/aqpkg/letterpushbutton.cpp | |||
@@ -1,34 +1,46 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | letterpushbutton.cpp - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Wed Oct 16 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This file is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
8 | 27 | ||
9 | /*************************************************************************** | 28 | */ |
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | 29 | ||
18 | #include "letterpushbutton.h" | 30 | #include "letterpushbutton.h" |
19 | 31 | ||
20 | LetterPushButton :: LetterPushButton( const QString &text, QWidget *parent, const char *name ) | 32 | LetterPushButton :: LetterPushButton( const QString &text, QWidget *parent, const char *name ) |
21 | : QPushButton( text, parent, name ) | 33 | : QPushButton( text, parent, name ) |
22 | { | 34 | { |
23 | connect( this, SIGNAL(released()), this, SLOT(released_emmitor()) ); | 35 | connect( this, SIGNAL(released()), this, SLOT(released_emmitor()) ); |
24 | } | 36 | } |
25 | 37 | ||
26 | LetterPushButton :: ~LetterPushButton() | 38 | LetterPushButton :: ~LetterPushButton() |
27 | { | 39 | { |
28 | } | 40 | } |
29 | 41 | ||
30 | void LetterPushButton :: released_emmitor() | 42 | void LetterPushButton :: released_emmitor() |
31 | { | 43 | { |
32 | emit released( text() ); | 44 | emit released( text() ); |
33 | } | 45 | } |
34 | 46 | ||
diff --git a/noncore/settings/aqpkg/letterpushbutton.h b/noncore/settings/aqpkg/letterpushbutton.h index e45b89d..452d68e 100644 --- a/noncore/settings/aqpkg/letterpushbutton.h +++ b/noncore/settings/aqpkg/letterpushbutton.h | |||
@@ -1,41 +1,53 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | letterpushbutton.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Wed Oct 16 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
17 | 29 | ||
18 | #ifndef LETTERPUSHBUTTON_H | 30 | #ifndef LETTERPUSHBUTTON_H |
19 | #define LETTERPUSHBUTTON_H | 31 | #define LETTERPUSHBUTTON_H |
20 | 32 | ||
21 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
22 | 34 | ||
23 | /** | 35 | /** |
24 | *@author Andy Qua | 36 | *@author Andy Qua |
25 | */ | 37 | */ |
26 | 38 | ||
27 | class LetterPushButton : public QPushButton | 39 | class LetterPushButton : public QPushButton |
28 | { | 40 | { |
29 | Q_OBJECT | 41 | Q_OBJECT |
30 | public: | 42 | public: |
31 | LetterPushButton( const QString & text, QWidget * parent, const char * name=0 ); | 43 | LetterPushButton( const QString & text, QWidget * parent, const char * name=0 ); |
32 | ~LetterPushButton(); | 44 | ~LetterPushButton(); |
33 | 45 | ||
34 | public slots: | 46 | public slots: |
35 | void released_emmitor(); | 47 | void released_emmitor(); |
36 | 48 | ||
37 | signals: | 49 | signals: |
38 | void released( QString text ); | 50 | void released( QString text ); |
39 | }; | 51 | }; |
40 | 52 | ||
41 | #endif | 53 | #endif |
diff --git a/noncore/settings/aqpkg/main.cpp b/noncore/settings/aqpkg/main.cpp index 15ef9d6..066d79f 100644 --- a/noncore/settings/aqpkg/main.cpp +++ b/noncore/settings/aqpkg/main.cpp | |||
@@ -1,62 +1,71 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | main.cpp - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 13:32:30 BST 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
17 | 29 | ||
18 | #ifdef QWS | 30 | #ifdef QWS |
19 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
20 | #include <qpe/qcopenvelope_qws.h> | 32 | #include <qpe/qcopenvelope_qws.h> |
21 | #else | 33 | #else |
22 | #include <qapplication.h> | 34 | #include <qapplication.h> |
23 | #endif | 35 | #endif |
24 | 36 | ||
25 | #include <qobjectdefs.h> | 37 | #include <qobjectdefs.h> |
26 | 38 | ||
27 | #include "mainwin.h" | 39 | #include "mainwin.h" |
28 | #include "server.h" | 40 | #include "server.h" |
29 | 41 | ||
30 | #include "global.h" | 42 | #include "global.h" |
31 | 43 | ||
32 | 44 | ||
33 | int main(int argc, char *argv[]) | 45 | int main(int argc, char *argv[]) |
34 | { | 46 | { |
35 | // cout << "Root dir = " << ROOT << endl; | ||
36 | #ifdef QWS | 47 | #ifdef QWS |
37 | QPEApplication a( argc, argv ); | 48 | QPEApplication a( argc, argv ); |
38 | #else | 49 | #else |
39 | QApplication a( argc, argv ); | 50 | QApplication a( argc, argv ); |
40 | #endif | 51 | #endif |
41 | 52 | ||
42 | #ifdef QWS | 53 | #ifdef QWS |
43 | // Disable suspend mode | 54 | // Disable suspend mode |
44 | // cout << "Disabling suspend mode" << endl; | ||
45 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; | 55 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; |
46 | #endif | 56 | #endif |
47 | 57 | ||
48 | MainWindow *win = new MainWindow(); | 58 | MainWindow *win = new MainWindow(); |
49 | a.setMainWidget(win); | 59 | a.setMainWidget(win); |
50 | win->showMaximized(); | 60 | win->showMaximized(); |
51 | 61 | ||
52 | a.exec(); | 62 | a.exec(); |
53 | 63 | ||
54 | #ifdef QWS | 64 | #ifdef QWS |
55 | // Reenable suspend mode | 65 | // Reenable suspend mode |
56 | // cout << "Enabling suspend mode" << endl; | ||
57 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 66 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
58 | #endif | 67 | #endif |
59 | #ifdef _DEBUG | 68 | #ifdef _DEBUG |
60 | DumpUnfreed(); | 69 | DumpUnfreed(); |
61 | #endif | 70 | #endif |
62 | } | 71 | } |
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index f0e8e48..0102292 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -1,144 +1,156 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | mainwin.cpp - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 13:32:30 BST 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
17 | 29 | ||
18 | #include <linux/limits.h> | 30 | #include <linux/limits.h> |
19 | #include <unistd.h> | 31 | #include <unistd.h> |
20 | 32 | ||
21 | #include <qpe/qcopenvelope_qws.h> | 33 | #include <qpe/qcopenvelope_qws.h> |
22 | #include <qmenubar.h> | 34 | #include <qmenubar.h> |
23 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
24 | #include <qtoolbar.h> | 36 | #include <qtoolbar.h> |
25 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
26 | #include <qpe/resource.h> | 38 | #include <qpe/resource.h> |
27 | 39 | ||
28 | #include <qaction.h> | 40 | #include <qaction.h> |
29 | #include <qcombobox.h> | 41 | #include <qcombobox.h> |
30 | #include <qfile.h> | 42 | #include <qfile.h> |
31 | #include <qlabel.h> | 43 | #include <qlabel.h> |
32 | #include <qlayout.h> | 44 | #include <qlayout.h> |
33 | #include <qlineedit.h> | 45 | #include <qlineedit.h> |
34 | #include <qlistview.h> | 46 | #include <qlistview.h> |
35 | #include <qmenubar.h> | 47 | #include <qmenubar.h> |
36 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
37 | #include <qpopupmenu.h> | 49 | #include <qpopupmenu.h> |
38 | #include <qprogressbar.h> | 50 | #include <qprogressbar.h> |
39 | #include <qtimer.h> | 51 | #include <qtimer.h> |
40 | #include <qwhatsthis.h> | 52 | #include <qwhatsthis.h> |
41 | #include <qwidgetstack.h> | 53 | #include <qwidgetstack.h> |
42 | 54 | ||
43 | #include "categoryfilterimpl.h" | 55 | #include "categoryfilterimpl.h" |
44 | #include "datamgr.h" | 56 | #include "datamgr.h" |
45 | #include "global.h" | 57 | #include "global.h" |
46 | #include "inputdlg.h" | 58 | #include "inputdlg.h" |
47 | #include "ipkg.h" | 59 | #include "ipkg.h" |
48 | #include "installdlgimpl.h" | 60 | #include "installdlgimpl.h" |
49 | #include "letterpushbutton.h" | 61 | #include "letterpushbutton.h" |
50 | #include "mainwin.h" | 62 | #include "mainwin.h" |
51 | #include "packagewin.h" | 63 | #include "packagewin.h" |
52 | #include "settingsimpl.h" | 64 | #include "settingsimpl.h" |
53 | #include "utils.h" | 65 | #include "utils.h" |
54 | 66 | ||
55 | extern int compareVersions( const char *v1, const char *v2 ); | 67 | extern int compareVersions( const char *v1, const char *v2 ); |
56 | 68 | ||
57 | MainWindow :: MainWindow() | 69 | MainWindow :: MainWindow() |
58 | :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) | 70 | :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) |
59 | { | 71 | { |
60 | setCaption( tr( "AQPkg - Package Manager" ) ); | 72 | setCaption( tr( "AQPkg - Package Manager" ) ); |
61 | 73 | ||
62 | // Create UI widgets | 74 | // Create UI widgets |
63 | initMainWidget(); | 75 | initMainWidget(); |
64 | initProgressWidget(); | 76 | initProgressWidget(); |
65 | 77 | ||
66 | // Build menu and tool bars | 78 | // Build menu and tool bars |
67 | setToolBarsMovable( FALSE ); | 79 | setToolBarsMovable( FALSE ); |
68 | 80 | ||
69 | QToolBar *bar = new QToolBar( this ); | 81 | QToolBar *bar = new QToolBar( this ); |
70 | bar->setHorizontalStretchable( TRUE ); | 82 | bar->setHorizontalStretchable( TRUE ); |
71 | QMenuBar *mb = new QMenuBar( bar ); | 83 | QMenuBar *mb = new QMenuBar( bar ); |
72 | mb->setMargin( 0 ); | 84 | mb->setMargin( 0 ); |
73 | bar = new QToolBar( this ); | 85 | bar = new QToolBar( this ); |
74 | 86 | ||
75 | // Find toolbar | 87 | // Find toolbar |
76 | findBar = new QToolBar( this ); | 88 | findBar = new QToolBar( this ); |
77 | addToolBar( findBar, QMainWindow::Top, true ); | 89 | addToolBar( findBar, QMainWindow::Top, true ); |
78 | findBar->setHorizontalStretchable( true ); | 90 | findBar->setHorizontalStretchable( true ); |
79 | findEdit = new QLineEdit( findBar ); | 91 | findEdit = new QLineEdit( findBar ); |
80 | QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); | 92 | QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); |
81 | findBar->setStretchableWidget( findEdit ); | 93 | findBar->setStretchableWidget( findEdit ); |
82 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); | 94 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); |
83 | 95 | ||
84 | // Quick jump toolbar | 96 | // Quick jump toolbar |
85 | jumpBar = new QToolBar( this ); | 97 | jumpBar = new QToolBar( this ); |
86 | addToolBar( jumpBar, QMainWindow::Top, true ); | 98 | addToolBar( jumpBar, QMainWindow::Top, true ); |
87 | jumpBar->setHorizontalStretchable( true ); | 99 | jumpBar->setHorizontalStretchable( true ); |
88 | QWidget *w = new QWidget( jumpBar ); | 100 | QWidget *w = new QWidget( jumpBar ); |
89 | jumpBar->setStretchableWidget( w ); | 101 | jumpBar->setStretchableWidget( w ); |
90 | 102 | ||
91 | QGridLayout *layout = new QGridLayout( w ); | 103 | QGridLayout *layout = new QGridLayout( w ); |
92 | 104 | ||
93 | char text[2]; | 105 | char text[2]; |
94 | text[1] = '\0'; | 106 | text[1] = '\0'; |
95 | for ( int i = 0 ; i < 26 ; ++i ) | 107 | for ( int i = 0 ; i < 26 ; ++i ) |
96 | { | 108 | { |
97 | text[0] = 'A' + i; | 109 | text[0] = 'A' + i; |
98 | LetterPushButton *b = new LetterPushButton( text, w ); | 110 | LetterPushButton *b = new LetterPushButton( text, w ); |
99 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); | 111 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); |
100 | layout->addWidget( b, i / 13, i % 13); | 112 | layout->addWidget( b, i / 13, i % 13); |
101 | } | 113 | } |
102 | 114 | ||
103 | QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); | 115 | QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); |
104 | a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); | 116 | a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); |
105 | connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); | 117 | connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); |
106 | a->addTo( jumpBar ); | 118 | a->addTo( jumpBar ); |
107 | jumpBar->hide(); | 119 | jumpBar->hide(); |
108 | 120 | ||
109 | // Packages menu | 121 | // Packages menu |
110 | QPopupMenu *popup = new QPopupMenu( this ); | 122 | QPopupMenu *popup = new QPopupMenu( this ); |
111 | 123 | ||
112 | a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); | 124 | a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); |
113 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); | 125 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); |
114 | connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); | 126 | connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); |
115 | a->addTo( popup ); | 127 | a->addTo( popup ); |
116 | a->addTo( bar ); | 128 | a->addTo( bar ); |
117 | 129 | ||
118 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); | 130 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); |
119 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); | 131 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); |
120 | connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); | 132 | connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); |
121 | actionUpgrade->addTo( popup ); | 133 | actionUpgrade->addTo( popup ); |
122 | actionUpgrade->addTo( bar ); | 134 | actionUpgrade->addTo( bar ); |
123 | 135 | ||
124 | iconDownload = Resource::loadPixmap( "aqpkg/download" ); | 136 | iconDownload = Resource::loadPixmap( "aqpkg/download" ); |
125 | iconRemove = Resource::loadPixmap( "aqpkg/remove" ); | 137 | iconRemove = Resource::loadPixmap( "aqpkg/remove" ); |
126 | actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); | 138 | actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); |
127 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); | 139 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); |
128 | connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); | 140 | connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); |
129 | actionDownload->addTo( popup ); | 141 | actionDownload->addTo( popup ); |
130 | actionDownload->addTo( bar ); | 142 | actionDownload->addTo( bar ); |
131 | 143 | ||
132 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); | 144 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); |
133 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); | 145 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); |
134 | connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); | 146 | connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); |
135 | a->addTo( popup ); | 147 | a->addTo( popup ); |
136 | a->addTo( bar ); | 148 | a->addTo( bar ); |
137 | 149 | ||
138 | popup->insertSeparator(); | 150 | popup->insertSeparator(); |
139 | 151 | ||
140 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); | 152 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); |
141 | a->setWhatsThis( tr( "Click here to configure this application." ) ); | 153 | a->setWhatsThis( tr( "Click here to configure this application." ) ); |
142 | connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); | 154 | connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); |
143 | a->addTo( popup ); | 155 | a->addTo( popup ); |
144 | mb->insertItem( tr( "Actions" ), popup ); | 156 | mb->insertItem( tr( "Actions" ), popup ); |
@@ -177,684 +189,675 @@ MainWindow :: MainWindow() | |||
177 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); | 189 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); |
178 | a->addTo( popup ); | 190 | a->addTo( popup ); |
179 | 191 | ||
180 | popup->insertSeparator(); | 192 | popup->insertSeparator(); |
181 | 193 | ||
182 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 194 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
183 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); | 195 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); |
184 | connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); | 196 | connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); |
185 | a->addTo( popup ); | 197 | a->addTo( popup ); |
186 | 198 | ||
187 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); | 199 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); |
188 | actionFindNext->setEnabled( FALSE ); | 200 | actionFindNext->setEnabled( FALSE ); |
189 | actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); | 201 | actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); |
190 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); | 202 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); |
191 | actionFindNext->addTo( popup ); | 203 | actionFindNext->addTo( popup ); |
192 | actionFindNext->addTo( findBar ); | 204 | actionFindNext->addTo( findBar ); |
193 | 205 | ||
194 | 206 | ||
195 | popup->insertSeparator(); | 207 | popup->insertSeparator(); |
196 | 208 | ||
197 | a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); | 209 | a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); |
198 | a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); | 210 | a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); |
199 | connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); | 211 | connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); |
200 | a->addTo( popup ); | 212 | a->addTo( popup ); |
201 | 213 | ||
202 | mb->insertItem( tr( "View" ), popup ); | 214 | mb->insertItem( tr( "View" ), popup ); |
203 | 215 | ||
204 | // Finish find toolbar creation | 216 | // Finish find toolbar creation |
205 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 217 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
206 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); | 218 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); |
207 | connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); | 219 | connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); |
208 | a->addTo( findBar ); | 220 | a->addTo( findBar ); |
209 | findBar->hide(); | 221 | findBar->hide(); |
210 | 222 | ||
211 | // Create widget stack and add UI widgets | 223 | // Create widget stack and add UI widgets |
212 | stack = new QWidgetStack( this ); | 224 | stack = new QWidgetStack( this ); |
213 | stack->addWidget( progressWindow, 2 ); | 225 | stack->addWidget( progressWindow, 2 ); |
214 | stack->addWidget( networkPkgWindow, 1 ); | 226 | stack->addWidget( networkPkgWindow, 1 ); |
215 | setCentralWidget( stack ); | 227 | setCentralWidget( stack ); |
216 | stack->raiseWidget( progressWindow ); | 228 | stack->raiseWidget( progressWindow ); |
217 | 229 | ||
218 | // Delayed call to finish initialization | 230 | // Delayed call to finish initialization |
219 | QTimer::singleShot( 100, this, SLOT( init() ) ); | 231 | QTimer::singleShot( 100, this, SLOT( init() ) ); |
220 | } | 232 | } |
221 | 233 | ||
222 | MainWindow :: ~MainWindow() | 234 | MainWindow :: ~MainWindow() |
223 | { | 235 | { |
224 | delete mgr; | 236 | delete mgr; |
225 | } | 237 | } |
226 | 238 | ||
227 | void MainWindow :: initMainWidget() | 239 | void MainWindow :: initMainWidget() |
228 | { | 240 | { |
229 | networkPkgWindow = new QWidget( this ); | 241 | networkPkgWindow = new QWidget( this ); |
230 | 242 | ||
231 | QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); | 243 | QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); |
232 | 244 | ||
233 | serversList = new QComboBox( networkPkgWindow ); | 245 | serversList = new QComboBox( networkPkgWindow ); |
234 | connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) ); | 246 | connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) ); |
235 | QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); | 247 | QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); |
236 | 248 | ||
237 | installedIcon = Resource::loadPixmap( "installed" ); | 249 | installedIcon = Resource::loadPixmap( "installed" ); |
238 | updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); | 250 | updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); |
239 | 251 | ||
240 | packagesList = new QListView( networkPkgWindow ); | 252 | packagesList = new QListView( networkPkgWindow ); |
241 | packagesList->addColumn( tr( "Packages" ), 225 ); | 253 | packagesList->addColumn( tr( "Packages" ), 225 ); |
242 | QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); | 254 | QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); |
243 | QPEApplication::setStylusOperation( packagesList->viewport(), QPEApplication::RightOnHold ); | 255 | QPEApplication::setStylusOperation( packagesList->viewport(), QPEApplication::RightOnHold ); |
244 | connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), | 256 | connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), |
245 | this, SLOT(slotDisplayPackage(QListViewItem *)) ); | 257 | this, SLOT(slotDisplayPackage(QListViewItem *)) ); |
246 | 258 | ||
247 | QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); | 259 | QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); |
248 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); | 260 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); |
249 | hbox1->addWidget( l ); | 261 | hbox1->addWidget( l ); |
250 | hbox1->addWidget( serversList ); | 262 | hbox1->addWidget( serversList ); |
251 | 263 | ||
252 | vbox->addWidget( packagesList ); | 264 | vbox->addWidget( packagesList ); |
253 | 265 | ||
254 | downloadEnabled = TRUE; | 266 | downloadEnabled = TRUE; |
255 | } | 267 | } |
256 | 268 | ||
257 | void MainWindow :: initProgressWidget() | 269 | void MainWindow :: initProgressWidget() |
258 | { | 270 | { |
259 | progressWindow = new QWidget( this ); | 271 | progressWindow = new QWidget( this ); |
260 | 272 | ||
261 | QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); | 273 | QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); |
262 | 274 | ||
263 | m_status = new QLabel( progressWindow ); | 275 | m_status = new QLabel( progressWindow ); |
264 | m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); | 276 | m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); |
265 | layout->addWidget( m_status ); | 277 | layout->addWidget( m_status ); |
266 | 278 | ||
267 | m_progress = new QProgressBar( progressWindow ); | 279 | m_progress = new QProgressBar( progressWindow ); |
268 | layout->addWidget( m_progress ); | 280 | layout->addWidget( m_progress ); |
269 | } | 281 | } |
270 | 282 | ||
271 | void MainWindow :: init() | 283 | void MainWindow :: init() |
272 | { | 284 | { |
273 | #ifdef QWS | 285 | #ifdef QWS |
274 | // read download directory from config file | 286 | // read download directory from config file |
275 | Config cfg( "aqpkg" ); | 287 | Config cfg( "aqpkg" ); |
276 | cfg.setGroup( "settings" ); | 288 | cfg.setGroup( "settings" ); |
277 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); | 289 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); |
278 | // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); | 290 | // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); |
279 | 291 | ||
280 | #endif | 292 | #endif |
281 | 293 | ||
282 | stack->raiseWidget( progressWindow ); | 294 | stack->raiseWidget( progressWindow ); |
283 | 295 | ||
284 | mgr = new DataManager(); | 296 | mgr = new DataManager(); |
285 | connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); | 297 | connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); |
286 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), | 298 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), |
287 | this, SLOT( setProgressMessage( const QString & ) ) ); | 299 | this, SLOT( setProgressMessage( const QString & ) ) ); |
288 | connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); | 300 | connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); |
289 | mgr->loadServers(); | 301 | mgr->loadServers(); |
290 | 302 | ||
291 | showUninstalledPkgs = false; | 303 | showUninstalledPkgs = false; |
292 | showInstalledPkgs = false; | 304 | showInstalledPkgs = false; |
293 | showUpgradedPkgs = false; | 305 | showUpgradedPkgs = false; |
294 | categoryFilterEnabled = false; | 306 | categoryFilterEnabled = false; |
295 | 307 | ||
296 | updateData(); | 308 | updateData(); |
297 | 309 | ||
298 | stack->raiseWidget( networkPkgWindow ); | 310 | stack->raiseWidget( networkPkgWindow ); |
299 | } | 311 | } |
300 | 312 | ||
301 | void MainWindow :: setDocument( const QString &doc ) | 313 | void MainWindow :: setDocument( const QString &doc ) |
302 | { | 314 | { |
303 | // Remove path from package | 315 | // Remove path from package |
304 | QString package = Utils::getPackageNameFromIpkFilename( doc ); | 316 | QString package = Utils::getPackageNameFromIpkFilename( doc ); |
305 | // std::cout << "Selecting package " << package << std::endl; | ||
306 | 317 | ||
307 | // First select local server | 318 | // First select local server |
308 | for ( int i = 0 ; i < serversList->count() ; ++i ) | 319 | for ( int i = 0 ; i < serversList->count() ; ++i ) |
309 | { | 320 | { |
310 | if ( serversList->text( i ) == LOCAL_IPKGS ) | 321 | if ( serversList->text( i ) == LOCAL_IPKGS ) |
311 | { | 322 | { |
312 | serversList->setCurrentItem( i ); | 323 | serversList->setCurrentItem( i ); |
313 | break; | 324 | break; |
314 | } | 325 | } |
315 | } | 326 | } |
316 | serverSelected( 0 ); | 327 | serverSelected( 0 ); |
317 | 328 | ||
318 | // Now set the check box of the selected package | 329 | // Now set the check box of the selected package |
319 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 330 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
320 | item != 0 ; | 331 | item != 0 ; |
321 | item = (QCheckListItem *)item->nextSibling() ) | 332 | item = (QCheckListItem *)item->nextSibling() ) |
322 | { | 333 | { |
323 | if ( item->text().startsWith( package ) ) | 334 | if ( item->text().startsWith( package ) ) |
324 | { | 335 | { |
325 | item->setOn( true ); | 336 | item->setOn( true ); |
326 | break; | 337 | break; |
327 | } | 338 | } |
328 | } | 339 | } |
329 | } | 340 | } |
330 | 341 | ||
331 | void MainWindow :: displaySettings() | 342 | void MainWindow :: displaySettings() |
332 | { | 343 | { |
333 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); | 344 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); |
334 | if ( dlg->showDlg() ) | 345 | if ( dlg->showDlg() ) |
335 | { | 346 | { |
336 | stack->raiseWidget( progressWindow ); | 347 | stack->raiseWidget( progressWindow ); |
337 | updateData(); | 348 | updateData(); |
338 | stack->raiseWidget( networkPkgWindow ); | 349 | stack->raiseWidget( networkPkgWindow ); |
339 | } | 350 | } |
340 | delete dlg; | 351 | delete dlg; |
341 | } | 352 | } |
342 | 353 | ||
343 | void MainWindow :: closeEvent( QCloseEvent *e ) | 354 | void MainWindow :: closeEvent( QCloseEvent *e ) |
344 | { | 355 | { |
345 | // If install dialog is visible, return to main view, otherwise close app | 356 | // If install dialog is visible, return to main view, otherwise close app |
346 | QWidget *widget = stack->visibleWidget(); | 357 | QWidget *widget = stack->visibleWidget(); |
347 | 358 | ||
348 | if ( widget != networkPkgWindow && widget != progressWindow ) | 359 | if ( widget != networkPkgWindow && widget != progressWindow ) |
349 | { | 360 | { |
350 | if ( widget ) delete widget; | 361 | if ( widget ) delete widget; |
351 | stack->raiseWidget( networkPkgWindow ); | 362 | stack->raiseWidget( networkPkgWindow ); |
352 | e->ignore(); | 363 | e->ignore(); |
353 | } | 364 | } |
354 | else | 365 | else |
355 | { | 366 | { |
356 | e->accept(); | 367 | e->accept(); |
357 | } | 368 | } |
358 | } | 369 | } |
359 | 370 | ||
360 | void MainWindow :: displayFindBar() | 371 | void MainWindow :: displayFindBar() |
361 | { | 372 | { |
362 | findBar->show(); | 373 | findBar->show(); |
363 | findEdit->setFocus(); | 374 | findEdit->setFocus(); |
364 | } | 375 | } |
365 | 376 | ||
366 | void MainWindow :: displayJumpBar() | 377 | void MainWindow :: displayJumpBar() |
367 | { | 378 | { |
368 | jumpBar->show(); | 379 | jumpBar->show(); |
369 | } | 380 | } |
370 | 381 | ||
371 | void MainWindow :: repeatFind() | 382 | void MainWindow :: repeatFind() |
372 | { | 383 | { |
373 | searchForPackage( findEdit->text() ); | 384 | searchForPackage( findEdit->text() ); |
374 | } | 385 | } |
375 | 386 | ||
376 | void MainWindow :: findPackage( const QString &text ) | 387 | void MainWindow :: findPackage( const QString &text ) |
377 | { | 388 | { |
378 | actionFindNext->setEnabled( !text.isEmpty() ); | 389 | actionFindNext->setEnabled( !text.isEmpty() ); |
379 | searchForPackage( text ); | 390 | searchForPackage( text ); |
380 | } | 391 | } |
381 | 392 | ||
382 | void MainWindow :: hideFindBar() | 393 | void MainWindow :: hideFindBar() |
383 | { | 394 | { |
384 | findBar->hide(); | 395 | findBar->hide(); |
385 | } | 396 | } |
386 | 397 | ||
387 | void MainWindow :: hideJumpBar() | 398 | void MainWindow :: hideJumpBar() |
388 | { | 399 | { |
389 | jumpBar->hide(); | 400 | jumpBar->hide(); |
390 | } | 401 | } |
391 | 402 | ||
392 | void MainWindow :: filterUninstalledPackages() | 403 | void MainWindow :: filterUninstalledPackages() |
393 | { | 404 | { |
394 | showUninstalledPkgs = actionUninstalled->isOn(); | 405 | showUninstalledPkgs = actionUninstalled->isOn(); |
395 | if ( showUninstalledPkgs ) | 406 | if ( showUninstalledPkgs ) |
396 | { | 407 | { |
397 | showInstalledPkgs = FALSE; | 408 | showInstalledPkgs = FALSE; |
398 | showUpgradedPkgs = FALSE; | 409 | showUpgradedPkgs = FALSE; |
399 | } | 410 | } |
400 | serverSelected( -1 ); | 411 | serverSelected( -1 ); |
401 | 412 | ||
402 | actionInstalled->setOn( FALSE ); | 413 | actionInstalled->setOn( FALSE ); |
403 | actionUpdated->setOn( FALSE ); | 414 | actionUpdated->setOn( FALSE ); |
404 | } | 415 | } |
405 | 416 | ||
406 | void MainWindow :: filterInstalledPackages() | 417 | void MainWindow :: filterInstalledPackages() |
407 | { | 418 | { |
408 | showInstalledPkgs = actionInstalled->isOn(); | 419 | showInstalledPkgs = actionInstalled->isOn(); |
409 | if ( showInstalledPkgs ) | 420 | if ( showInstalledPkgs ) |
410 | { | 421 | { |
411 | showUninstalledPkgs = FALSE; | 422 | showUninstalledPkgs = FALSE; |
412 | showUpgradedPkgs = FALSE; | 423 | showUpgradedPkgs = FALSE; |
413 | } | 424 | } |
414 | serverSelected( -1 ); | 425 | serverSelected( -1 ); |
415 | 426 | ||
416 | actionUninstalled->setOn( FALSE ); | 427 | actionUninstalled->setOn( FALSE ); |
417 | actionUpdated->setOn( FALSE ); | 428 | actionUpdated->setOn( FALSE ); |
418 | } | 429 | } |
419 | 430 | ||
420 | void MainWindow :: filterUpgradedPackages() | 431 | void MainWindow :: filterUpgradedPackages() |
421 | { | 432 | { |
422 | showUpgradedPkgs = actionUpdated->isOn(); | 433 | showUpgradedPkgs = actionUpdated->isOn(); |
423 | if ( showUpgradedPkgs ) | 434 | if ( showUpgradedPkgs ) |
424 | { | 435 | { |
425 | showUninstalledPkgs = FALSE; | 436 | showUninstalledPkgs = FALSE; |
426 | showInstalledPkgs = FALSE; | 437 | showInstalledPkgs = FALSE; |
427 | } | 438 | } |
428 | serverSelected( -1 ); | 439 | serverSelected( -1 ); |
429 | 440 | ||
430 | actionUninstalled->setOn( FALSE ); | 441 | actionUninstalled->setOn( FALSE ); |
431 | actionInstalled->setOn( FALSE ); | 442 | actionInstalled->setOn( FALSE ); |
432 | } | 443 | } |
433 | 444 | ||
434 | bool MainWindow :: setFilterCategory() | 445 | bool MainWindow :: setFilterCategory() |
435 | { | 446 | { |
436 | // Get categories; | 447 | // Get categories; |
437 | CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this ); | 448 | CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this ); |
438 | if ( dlg.exec() == QDialog::Accepted ) | 449 | if ( dlg.exec() == QDialog::Accepted ) |
439 | { | 450 | { |
440 | categoryFilter = dlg.getSelectedFilter(); | 451 | categoryFilter = dlg.getSelectedFilter(); |
441 | 452 | ||
442 | if ( categoryFilter == "" ) | 453 | if ( categoryFilter == "" ) |
443 | return false; | 454 | return false; |
444 | 455 | ||
445 | categoryFilterEnabled = true; | 456 | categoryFilterEnabled = true; |
446 | serverSelected( -1 ); | 457 | serverSelected( -1 ); |
447 | actionFilter->setOn( TRUE ); | 458 | actionFilter->setOn( TRUE ); |
448 | return true; | 459 | return true; |
449 | } | 460 | } |
450 | 461 | ||
451 | return false; | 462 | return false; |
452 | } | 463 | } |
453 | 464 | ||
454 | void MainWindow :: filterCategory() | 465 | void MainWindow :: filterCategory() |
455 | { | 466 | { |
456 | if ( !actionFilter->isOn() ) | 467 | if ( !actionFilter->isOn() ) |
457 | { | 468 | { |
458 | filterByCategory( FALSE ); | 469 | filterByCategory( FALSE ); |
459 | } | 470 | } |
460 | else | 471 | else |
461 | { | 472 | { |
462 | actionFilter->setOn( filterByCategory( TRUE ) ); | 473 | actionFilter->setOn( filterByCategory( TRUE ) ); |
463 | } | 474 | } |
464 | } | 475 | } |
465 | 476 | ||
466 | bool MainWindow :: filterByCategory( bool val ) | 477 | bool MainWindow :: filterByCategory( bool val ) |
467 | { | 478 | { |
468 | if ( val ) | 479 | if ( val ) |
469 | { | 480 | { |
470 | if ( categoryFilter == "" ) | 481 | if ( categoryFilter == "" ) |
471 | { | 482 | { |
472 | if ( !setFilterCategory() ) | 483 | if ( !setFilterCategory() ) |
473 | return false; | 484 | return false; |
474 | } | 485 | } |
475 | 486 | ||
476 | categoryFilterEnabled = true; | 487 | categoryFilterEnabled = true; |
477 | serverSelected( -1 ); | 488 | serverSelected( -1 ); |
478 | return true; | 489 | return true; |
479 | } | 490 | } |
480 | else | 491 | else |
481 | { | 492 | { |
482 | // Turn off filter | 493 | // Turn off filter |
483 | categoryFilterEnabled = false; | 494 | categoryFilterEnabled = false; |
484 | serverSelected( -1 ); | 495 | serverSelected( -1 ); |
485 | return false; | 496 | return false; |
486 | } | 497 | } |
487 | } | 498 | } |
488 | 499 | ||
489 | void MainWindow :: raiseMainWidget() | 500 | void MainWindow :: raiseMainWidget() |
490 | { | 501 | { |
491 | stack->raiseWidget( networkPkgWindow ); | 502 | stack->raiseWidget( networkPkgWindow ); |
492 | } | 503 | } |
493 | 504 | ||
494 | void MainWindow :: raiseProgressWidget() | 505 | void MainWindow :: raiseProgressWidget() |
495 | { | 506 | { |
496 | stack->raiseWidget( progressWindow ); | 507 | stack->raiseWidget( progressWindow ); |
497 | } | 508 | } |
498 | 509 | ||
499 | void MainWindow :: enableUpgrade( bool enabled ) | 510 | void MainWindow :: enableUpgrade( bool enabled ) |
500 | { | 511 | { |
501 | actionUpgrade->setEnabled( enabled ); | 512 | actionUpgrade->setEnabled( enabled ); |
502 | } | 513 | } |
503 | 514 | ||
504 | void MainWindow :: enableDownload( bool enabled ) | 515 | void MainWindow :: enableDownload( bool enabled ) |
505 | { | 516 | { |
506 | if ( enabled ) | 517 | if ( enabled ) |
507 | { | 518 | { |
508 | actionDownload->setIconSet( iconDownload ); | 519 | actionDownload->setIconSet( iconDownload ); |
509 | actionDownload->setText( tr( "Download" ) ); | 520 | actionDownload->setText( tr( "Download" ) ); |
510 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); | 521 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); |
511 | } | 522 | } |
512 | else | 523 | else |
513 | { | 524 | { |
514 | actionDownload->setIconSet( iconRemove ); | 525 | actionDownload->setIconSet( iconRemove ); |
515 | actionDownload->setText( tr( "Remove" ) ); | 526 | actionDownload->setText( tr( "Remove" ) ); |
516 | actionDownload->setWhatsThis( tr( "Click here to uninstall the currently selected package(s)." ) ); | 527 | actionDownload->setWhatsThis( tr( "Click here to uninstall the currently selected package(s)." ) ); |
517 | } | 528 | } |
518 | } | 529 | } |
519 | 530 | ||
520 | void MainWindow :: setProgressSteps( int numsteps ) | 531 | void MainWindow :: setProgressSteps( int numsteps ) |
521 | { | 532 | { |
522 | m_progress->setTotalSteps( numsteps ); | 533 | m_progress->setTotalSteps( numsteps ); |
523 | } | 534 | } |
524 | 535 | ||
525 | void MainWindow :: setProgressMessage( const QString &msg ) | 536 | void MainWindow :: setProgressMessage( const QString &msg ) |
526 | { | 537 | { |
527 | m_status->setText( msg ); | 538 | m_status->setText( msg ); |
528 | } | 539 | } |
529 | 540 | ||
530 | void MainWindow :: updateProgress( int progress ) | 541 | void MainWindow :: updateProgress( int progress ) |
531 | { | 542 | { |
532 | m_progress->setProgress( progress ); | 543 | m_progress->setProgress( progress ); |
533 | } | 544 | } |
534 | 545 | ||
535 | void MainWindow :: updateData() | 546 | void MainWindow :: updateData() |
536 | { | 547 | { |
537 | m_progress->setTotalSteps( mgr->getServerList().count() ); | 548 | m_progress->setTotalSteps( mgr->getServerList().count() ); |
538 | 549 | ||
539 | serversList->clear(); | 550 | serversList->clear(); |
540 | packagesList->clear(); | 551 | packagesList->clear(); |
541 | 552 | ||
542 | int activeItem = -1; | 553 | int activeItem = -1; |
543 | int i = 0; | 554 | int i = 0; |
544 | QString serverName; | 555 | QString serverName; |
545 | 556 | ||
546 | QListIterator<Server> it( mgr->getServerList() ); | 557 | QListIterator<Server> it( mgr->getServerList() ); |
547 | Server *server; | 558 | Server *server; |
548 | 559 | ||
549 | for ( ; it.current(); ++it, ++i ) | 560 | for ( ; it.current(); ++it, ++i ) |
550 | { | 561 | { |
551 | server = it.current(); | 562 | server = it.current(); |
552 | serverName = server->getServerName(); | 563 | serverName = server->getServerName(); |
553 | m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) ); | 564 | m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) ); |
554 | m_progress->setProgress( i ); | 565 | m_progress->setProgress( i ); |
555 | qApp->processEvents(); | 566 | qApp->processEvents(); |
556 | 567 | ||
557 | // cout << "Adding " << it->getServerName() << " to combobox" << endl; | ||
558 | if ( !server->isServerActive() ) | 568 | if ( !server->isServerActive() ) |
559 | { | 569 | { |
560 | // cout << serverName << " is not active" << endl; | ||
561 | i--; | 570 | i--; |
562 | continue; | 571 | continue; |
563 | } | 572 | } |
564 | 573 | ||
565 | serversList->insertItem( serverName ); | 574 | serversList->insertItem( serverName ); |
566 | if ( serverName == currentlySelectedServer ) | 575 | if ( serverName == currentlySelectedServer ) |
567 | activeItem = i; | 576 | activeItem = i; |
568 | } | 577 | } |
569 | 578 | ||
570 | // set selected server to be active server | 579 | // set selected server to be active server |
571 | if ( activeItem != -1 ) | 580 | if ( activeItem != -1 ) |
572 | serversList->setCurrentItem( activeItem ); | 581 | serversList->setCurrentItem( activeItem ); |
573 | serverSelected( 0, FALSE ); | 582 | serverSelected( 0, FALSE ); |
574 | } | 583 | } |
575 | 584 | ||
576 | void MainWindow :: serverSelected( int index ) | 585 | void MainWindow :: serverSelected( int index ) |
577 | { | 586 | { |
578 | serverSelected( index, TRUE ); | 587 | serverSelected( index, TRUE ); |
579 | } | 588 | } |
580 | 589 | ||
581 | void MainWindow :: serverSelected( int, bool raiseProgress ) | 590 | void MainWindow :: serverSelected( int, bool raiseProgress ) |
582 | { | 591 | { |
583 | QPixmap nullIcon( installedIcon.size() ); | 592 | QPixmap nullIcon( installedIcon.size() ); |
584 | nullIcon.fill( colorGroup().base() ); | 593 | nullIcon.fill( colorGroup().base() ); |
585 | 594 | ||
586 | // display packages | 595 | // display packages |
587 | QString serverName = serversList->currentText(); | 596 | QString serverName = serversList->currentText(); |
588 | currentlySelectedServer = serverName; | 597 | currentlySelectedServer = serverName; |
589 | 598 | ||
590 | Server *s = mgr->getServer( serverName ); | 599 | Server *s = mgr->getServer( serverName ); |
591 | 600 | ||
592 | QList<Package> &list = s->getPackageList(); | 601 | QList<Package> &list = s->getPackageList(); |
593 | QListIterator<Package> it( list ); | 602 | QListIterator<Package> it( list ); |
594 | 603 | ||
595 | // Display progress widget while loading list | 604 | // Display progress widget while loading list |
596 | bool doProgress = ( list.count() > 200 ); | 605 | bool doProgress = ( list.count() > 200 ); |
597 | if ( doProgress ) | 606 | if ( doProgress ) |
598 | { | 607 | { |
599 | if ( raiseProgress ) | 608 | if ( raiseProgress ) |
600 | { | 609 | { |
601 | stack->raiseWidget( progressWindow ); | 610 | stack->raiseWidget( progressWindow ); |
602 | } | 611 | } |
603 | m_progress->setTotalSteps( list.count() ); | 612 | m_progress->setTotalSteps( list.count() ); |
604 | m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); | 613 | m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); |
605 | } | 614 | } |
606 | 615 | ||
607 | packagesList->clear(); | 616 | packagesList->clear(); |
608 | 617 | ||
609 | #ifdef QWS | 618 | #ifdef QWS |
610 | // read download directory from config file | 619 | // read download directory from config file |
611 | Config cfg( "aqpkg" ); | 620 | Config cfg( "aqpkg" ); |
612 | cfg.setGroup( "settings" ); | 621 | cfg.setGroup( "settings" ); |
613 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); | 622 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); |
614 | #endif | 623 | #endif |
615 | 624 | ||
616 | int i = 0; | 625 | int i = 0; |
617 | Package *package; | 626 | Package *package; |
618 | for ( ; it.current(); ++it ) | 627 | for ( ; it.current(); ++it ) |
619 | { | 628 | { |
620 | // Update progress after every 100th package (arbitrary value, seems to give good balance) | 629 | // Update progress after every 100th package (arbitrary value, seems to give good balance) |
621 | i++; | 630 | i++; |
622 | if ( ( i % 100 ) == 0 ) | 631 | if ( ( i % 100 ) == 0 ) |
623 | { | 632 | { |
624 | if ( doProgress ) | 633 | if ( doProgress ) |
625 | { | 634 | { |
626 | m_progress->setProgress( i ); | 635 | m_progress->setProgress( i ); |
627 | } | 636 | } |
628 | qApp->processEvents(); | 637 | qApp->processEvents(); |
629 | } | 638 | } |
630 | 639 | ||
631 | QString text = ""; | 640 | QString text = ""; |
632 | 641 | ||
633 | package = it.current(); | 642 | package = it.current(); |
634 | 643 | ||
635 | // Apply show only uninstalled packages filter | 644 | // Apply show only uninstalled packages filter |
636 | if ( showUninstalledPkgs && package->isInstalled() ) | 645 | if ( showUninstalledPkgs && package->isInstalled() ) |
637 | continue; | 646 | continue; |
638 | 647 | ||
639 | // Apply show only installed packages filter | 648 | // Apply show only installed packages filter |
640 | if ( showInstalledPkgs && !package->isInstalled() ) | 649 | if ( showInstalledPkgs && !package->isInstalled() ) |
641 | continue; | 650 | continue; |
642 | 651 | ||
643 | // Apply show only new installed packages filter | 652 | // Apply show only new installed packages filter |
644 | if ( showUpgradedPkgs ) | 653 | if ( showUpgradedPkgs ) |
645 | { | 654 | { |
646 | if ( !package->isInstalled() || !package->getNewVersionAvailable() ) | 655 | if ( !package->isInstalled() || !package->getNewVersionAvailable() ) |
647 | continue; | 656 | continue; |
648 | } | 657 | } |
649 | 658 | ||
650 | // Apply the section filter | 659 | // Apply the section filter |
651 | if ( categoryFilterEnabled && categoryFilter != "" ) | 660 | if ( categoryFilterEnabled && categoryFilter != "" ) |
652 | { | 661 | { |
653 | if ( package->getSection() == "" || categoryFilter.find( package->getSection().lower() ) == -1 ) | 662 | if ( package->getSection() == "" || categoryFilter.find( package->getSection().lower() ) == -1 ) |
654 | continue; | 663 | continue; |
655 | } | 664 | } |
656 | 665 | ||
657 | // If the local server, only display installed packages | 666 | // If the local server, only display installed packages |
658 | if ( serverName == LOCAL_SERVER && !package->isInstalled() ) | 667 | if ( serverName == LOCAL_SERVER && !package->isInstalled() ) |
659 | continue; | 668 | continue; |
660 | 669 | ||
661 | 670 | ||
662 | QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(), | 671 | QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(), |
663 | QCheckListItem::CheckBox ); | 672 | QCheckListItem::CheckBox ); |
664 | 673 | ||
665 | if ( package->isInstalled() ) | 674 | if ( package->isInstalled() ) |
666 | { | 675 | { |
667 | // If a different version of package is available, show update available icon | 676 | // If a different version of package is available, show update available icon |
668 | // Otherwise, show installed icon | 677 | // Otherwise, show installed icon |
669 | if ( package->getNewVersionAvailable()) | 678 | if ( package->getNewVersionAvailable()) |
670 | { | 679 | { |
671 | 680 | ||
672 | item->setPixmap( 0, updatedIcon ); | 681 | item->setPixmap( 0, updatedIcon ); |
673 | } | 682 | } |
674 | else | 683 | else |
675 | { | 684 | { |
676 | item->setPixmap( 0, installedIcon ); | 685 | item->setPixmap( 0, installedIcon ); |
677 | } | 686 | } |
678 | } | 687 | } |
679 | else | 688 | else |
680 | { | 689 | { |
681 | item->setPixmap( 0, nullIcon ); | 690 | item->setPixmap( 0, nullIcon ); |
682 | } | 691 | } |
683 | 692 | ||
684 | packagesList->insertItem( item ); | 693 | packagesList->insertItem( item ); |
685 | } | 694 | } |
686 | 695 | ||
687 | // If the local server or the local ipkgs server disable the download button | 696 | // If the local server or the local ipkgs server disable the download button |
688 | if ( serverName == LOCAL_SERVER ) | 697 | if ( serverName == LOCAL_SERVER ) |
689 | { | 698 | { |
690 | downloadEnabled = TRUE; | 699 | downloadEnabled = TRUE; |
691 | actionUpgrade->setEnabled( FALSE ); | 700 | actionUpgrade->setEnabled( FALSE ); |
692 | } | 701 | } |
693 | else if ( serverName == LOCAL_IPKGS ) | 702 | else if ( serverName == LOCAL_IPKGS ) |
694 | { | 703 | { |
695 | downloadEnabled = FALSE; | 704 | downloadEnabled = FALSE; |
696 | actionUpgrade->setEnabled( FALSE ); | 705 | actionUpgrade->setEnabled( FALSE ); |
697 | } | 706 | } |
698 | else | 707 | else |
699 | { | 708 | { |
700 | downloadEnabled = TRUE; | 709 | downloadEnabled = TRUE; |
701 | actionUpgrade->setEnabled( TRUE ); | 710 | actionUpgrade->setEnabled( TRUE ); |
702 | } | 711 | } |
703 | enableDownload( downloadEnabled ); | 712 | enableDownload( downloadEnabled ); |
704 | 713 | ||
705 | // Display this widget once everything is done | 714 | // Display this widget once everything is done |
706 | if ( doProgress && raiseProgress ) | 715 | if ( doProgress && raiseProgress ) |
707 | { | 716 | { |
708 | stack->raiseWidget( networkPkgWindow ); | 717 | stack->raiseWidget( networkPkgWindow ); |
709 | } | 718 | } |
710 | } | 719 | } |
711 | 720 | ||
712 | void MainWindow :: searchForPackage( const QString &text ) | 721 | void MainWindow :: searchForPackage( const QString &text ) |
713 | { | 722 | { |
714 | if ( !text.isEmpty() ) | 723 | if ( !text.isEmpty() ) |
715 | { | 724 | { |
716 | // cout << "searching for " << text << endl; | ||
717 | // look through package list for text startng at current position | 725 | // look through package list for text startng at current position |
718 | // vector<InstallData> workingPackages; | ||
719 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 726 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
720 | // if ( start != 0 ) | ||
721 | // start = (QCheckListItem *)start->nextSibling(); | ||
722 | 727 | ||
723 | if ( start == 0 ) | 728 | if ( start == 0 ) |
724 | start = (QCheckListItem *)packagesList->firstChild(); | 729 | start = (QCheckListItem *)packagesList->firstChild(); |
725 | 730 | ||
726 | for ( QCheckListItem *item = start; item != 0 ; | 731 | for ( QCheckListItem *item = start; item != 0 ; |
727 | item = (QCheckListItem *)item->nextSibling() ) | 732 | item = (QCheckListItem *)item->nextSibling() ) |
728 | { | 733 | { |
729 | // cout << "checking " << item->text().lower() << endl; | ||
730 | if ( item->text().lower().find( text ) != -1 ) | 734 | if ( item->text().lower().find( text ) != -1 ) |
731 | { | 735 | { |
732 | // cout << "matched " << item->text() << endl; | ||
733 | packagesList->ensureItemVisible( item ); | 736 | packagesList->ensureItemVisible( item ); |
734 | packagesList->setCurrentItem( item ); | 737 | packagesList->setCurrentItem( item ); |
735 | break; | 738 | break; |
736 | } | 739 | } |
737 | } | 740 | } |
738 | } | 741 | } |
739 | } | 742 | } |
740 | 743 | ||
741 | void MainWindow :: updateServer() | 744 | void MainWindow :: updateServer() |
742 | { | 745 | { |
743 | QString serverName = serversList->currentText(); | 746 | QString serverName = serversList->currentText(); |
744 | 747 | ||
745 | // Update the current server | 748 | // Update the current server |
746 | // Display dialog | 749 | // Display dialog |
747 | 750 | ||
748 | // Disable buttons to stop silly people clicking lots on them :) | 751 | // Disable buttons to stop silly people clicking lots on them :) |
749 | 752 | ||
750 | // First, write out ipkg_conf file so that ipkg can use it | 753 | // First, write out ipkg_conf file so that ipkg can use it |
751 | mgr->writeOutIpkgConf(); | 754 | mgr->writeOutIpkgConf(); |
752 | 755 | ||
753 | Ipkg *ipkg = new Ipkg; | 756 | Ipkg *ipkg = new Ipkg; |
754 | ipkg->setOption( "update" ); | 757 | ipkg->setOption( "update" ); |
755 | 758 | ||
756 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), | 759 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), |
757 | tr( "Update lists" ) ); | 760 | tr( "Update lists" ) ); |
758 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | 761 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
759 | reloadDocuments = FALSE; | 762 | reloadDocuments = FALSE; |
760 | stack->addWidget( dlg, 3 ); | 763 | stack->addWidget( dlg, 3 ); |
761 | stack->raiseWidget( dlg ); | 764 | stack->raiseWidget( dlg ); |
762 | 765 | ||
763 | // delete progDlg; | 766 | // delete progDlg; |
764 | } | 767 | } |
765 | 768 | ||
766 | void MainWindow :: upgradePackages() | 769 | void MainWindow :: upgradePackages() |
767 | { | 770 | { |
768 | // We're gonna do an upgrade of all packages | 771 | // We're gonna do an upgrade of all packages |
769 | // First warn user that this isn't recommended | 772 | // First warn user that this isn't recommended |
770 | // TODO - ODevice???? | 773 | // TODO - ODevice???? |
771 | QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); | 774 | QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); |
772 | QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, | 775 | QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, |
773 | QMessageBox::Yes, | 776 | QMessageBox::Yes, |
774 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , | 777 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , |
775 | 0, this ); | 778 | 0, this ); |
776 | warn.adjustSize(); | 779 | warn.adjustSize(); |
777 | 780 | ||
778 | if ( warn.exec() == QMessageBox::Yes ) | 781 | if ( warn.exec() == QMessageBox::Yes ) |
779 | { | 782 | { |
780 | // First, write out ipkg_conf file so that ipkg can use it | 783 | // First, write out ipkg_conf file so that ipkg can use it |
781 | mgr->writeOutIpkgConf(); | 784 | mgr->writeOutIpkgConf(); |
782 | 785 | ||
783 | // Now run upgrade | 786 | // Now run upgrade |
784 | Ipkg *ipkg = new Ipkg; | 787 | Ipkg *ipkg = new Ipkg; |
785 | ipkg->setOption( "upgrade" ); | 788 | ipkg->setOption( "upgrade" ); |
786 | 789 | ||
787 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), | 790 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), |
788 | tr ( "Upgrade" ) ); | 791 | tr ( "Upgrade" ) ); |
789 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | 792 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
790 | reloadDocuments = TRUE; | 793 | reloadDocuments = TRUE; |
791 | stack->addWidget( dlg, 3 ); | 794 | stack->addWidget( dlg, 3 ); |
792 | stack->raiseWidget( dlg ); | 795 | stack->raiseWidget( dlg ); |
793 | } | 796 | } |
794 | } | 797 | } |
795 | 798 | ||
796 | void MainWindow :: downloadPackage() | 799 | void MainWindow :: downloadPackage() |
797 | { | 800 | { |
798 | bool doUpdate = true; | 801 | bool doUpdate = true; |
799 | if ( downloadEnabled ) | 802 | if ( downloadEnabled ) |
800 | { | 803 | { |
801 | // See if any packages are selected | 804 | // See if any packages are selected |
802 | bool found = false; | 805 | bool found = false; |
803 | if ( serversList->currentText() != LOCAL_SERVER ) | 806 | if ( serversList->currentText() != LOCAL_SERVER ) |
804 | { | 807 | { |
805 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 808 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
806 | item != 0 && !found; | 809 | item != 0 && !found; |
807 | item = (QCheckListItem *)item->nextSibling() ) | 810 | item = (QCheckListItem *)item->nextSibling() ) |
808 | { | 811 | { |
809 | if ( item->isOn() ) | 812 | if ( item->isOn() ) |
810 | found = true; | 813 | found = true; |
811 | } | 814 | } |
812 | } | 815 | } |
813 | 816 | ||
814 | // If user selected some packages then download the and store the locally | 817 | // If user selected some packages then download the and store the locally |
815 | // otherwise, display dialog asking user what package to download from an http server | 818 | // otherwise, display dialog asking user what package to download from an http server |
816 | // and whether to install it | 819 | // and whether to install it |
817 | if ( found ) | 820 | if ( found ) |
818 | downloadSelectedPackages(); | 821 | downloadSelectedPackages(); |
819 | else | 822 | else |
820 | downloadRemotePackage(); | 823 | downloadRemotePackage(); |
821 | 824 | ||
822 | } | 825 | } |
823 | else | 826 | else |
824 | { | 827 | { |
825 | doUpdate = false; | 828 | doUpdate = false; |
826 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 829 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
827 | item != 0 ; | 830 | item != 0 ; |
828 | item = (QCheckListItem *)item->nextSibling() ) | 831 | item = (QCheckListItem *)item->nextSibling() ) |
829 | { | 832 | { |
830 | if ( item->isOn() ) | 833 | if ( item->isOn() ) |
831 | { | 834 | { |
832 | QString name = item->text(); | 835 | QString name = item->text(); |
833 | int pos = name.find( "*" ); | 836 | int pos = name.find( "*" ); |
834 | name.truncate( pos ); | 837 | name.truncate( pos ); |
835 | 838 | ||
836 | // if (there is a (installed), remove it | 839 | // if (there is a (installed), remove it |
837 | pos = name.find( "(installed)" ); | 840 | pos = name.find( "(installed)" ); |
838 | if ( pos > 0 ) | 841 | if ( pos > 0 ) |
839 | name.truncate( pos - 1 ); | 842 | name.truncate( pos - 1 ); |
840 | 843 | ||
841 | Package *p = mgr->getServer( serversList->currentText() )->getPackage( name ); | 844 | Package *p = mgr->getServer( serversList->currentText() )->getPackage( name ); |
842 | 845 | ||
843 | QString msgtext; | 846 | QString msgtext; |
844 | msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() ); | 847 | msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() ); |
845 | if ( QMessageBox::information( this, tr( "Are you sure?" ), | 848 | if ( QMessageBox::information( this, tr( "Are you sure?" ), |
846 | msgtext, tr( "No" ), tr( "Yes" ) ) == 1 ) | 849 | msgtext, tr( "No" ), tr( "Yes" ) ) == 1 ) |
847 | { | 850 | { |
848 | doUpdate = true; | 851 | doUpdate = true; |
849 | QFile f( p->getFilename() ); | 852 | QFile f( p->getFilename() ); |
850 | f.remove(); | 853 | f.remove(); |
851 | } | 854 | } |
852 | } | 855 | } |
853 | } | 856 | } |
854 | } | 857 | } |
855 | 858 | ||
856 | if ( doUpdate ) | 859 | if ( doUpdate ) |
857 | { | 860 | { |
858 | reloadData( 0x0 ); | 861 | reloadData( 0x0 ); |
859 | } | 862 | } |
860 | } | 863 | } |
@@ -888,258 +891,256 @@ void MainWindow :: downloadSelectedPackages() | |||
888 | // Get starting directory | 891 | // Get starting directory |
889 | char initDir[PATH_MAX]; | 892 | char initDir[PATH_MAX]; |
890 | getcwd( initDir, PATH_MAX ); | 893 | getcwd( initDir, PATH_MAX ); |
891 | 894 | ||
892 | // Download each package | 895 | // Download each package |
893 | Ipkg ipkg; | 896 | Ipkg ipkg; |
894 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | 897 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
895 | 898 | ||
896 | ipkg.setOption( "download" ); | 899 | ipkg.setOption( "download" ); |
897 | ipkg.setRuntimeDirectory( dir ); | 900 | ipkg.setRuntimeDirectory( dir ); |
898 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 901 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
899 | item != 0 ; | 902 | item != 0 ; |
900 | item = (QCheckListItem *)item->nextSibling() ) | 903 | item = (QCheckListItem *)item->nextSibling() ) |
901 | { | 904 | { |
902 | if ( item->isOn() ) | 905 | if ( item->isOn() ) |
903 | { | 906 | { |
904 | ipkg.setPackage( item->text() ); | 907 | ipkg.setPackage( item->text() ); |
905 | ipkg.runIpkg( ); | 908 | ipkg.runIpkg( ); |
906 | } | 909 | } |
907 | } | 910 | } |
908 | } | 911 | } |
909 | 912 | ||
910 | void MainWindow :: downloadRemotePackage() | 913 | void MainWindow :: downloadRemotePackage() |
911 | { | 914 | { |
912 | // Display dialog | 915 | // Display dialog |
913 | bool ok; | 916 | bool ok; |
914 | QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this ); | 917 | QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this ); |
915 | if ( !ok || package.isEmpty() ) | 918 | if ( !ok || package.isEmpty() ) |
916 | return; | 919 | return; |
917 | // DownloadRemoteDlgImpl dlg( this, "Install", true ); | 920 | // DownloadRemoteDlgImpl dlg( this, "Install", true ); |
918 | // if ( dlg.exec() == QDialog::Rejected ) | 921 | // if ( dlg.exec() == QDialog::Rejected ) |
919 | // return; | 922 | // return; |
920 | 923 | ||
921 | // grab details from dialog | 924 | // grab details from dialog |
922 | // QString package = dlg.getPackageLocation(); | 925 | // QString package = dlg.getPackageLocation(); |
923 | 926 | ||
924 | InstallData *item = new InstallData(); | 927 | InstallData *item = new InstallData(); |
925 | item->option = "I"; | 928 | item->option = "I"; |
926 | item->packageName = package; | 929 | item->packageName = package; |
927 | QList<InstallData> workingPackages; | 930 | QList<InstallData> workingPackages; |
928 | workingPackages.setAutoDelete( TRUE ); | 931 | workingPackages.setAutoDelete( TRUE ); |
929 | workingPackages.append( item ); | 932 | workingPackages.append( item ); |
930 | 933 | ||
931 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); | 934 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); |
932 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | 935 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
933 | reloadDocuments = TRUE; | 936 | reloadDocuments = TRUE; |
934 | stack->addWidget( dlg, 3 ); | 937 | stack->addWidget( dlg, 3 ); |
935 | stack->raiseWidget( dlg ); | 938 | stack->raiseWidget( dlg ); |
936 | } | 939 | } |
937 | 940 | ||
938 | 941 | ||
939 | void MainWindow :: applyChanges() | 942 | void MainWindow :: applyChanges() |
940 | { | 943 | { |
941 | stickyOption = ""; | 944 | stickyOption = ""; |
942 | 945 | ||
943 | // First, write out ipkg_conf file so that ipkg can use it | 946 | // First, write out ipkg_conf file so that ipkg can use it |
944 | mgr->writeOutIpkgConf(); | 947 | mgr->writeOutIpkgConf(); |
945 | 948 | ||
946 | // Now for each selected item | 949 | // Now for each selected item |
947 | // deal with it | 950 | // deal with it |
948 | 951 | ||
949 | QList<InstallData> workingPackages; | 952 | QList<InstallData> workingPackages; |
950 | workingPackages.setAutoDelete( TRUE ); | 953 | workingPackages.setAutoDelete( TRUE ); |
951 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 954 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
952 | item != 0 ; | 955 | item != 0 ; |
953 | item = (QCheckListItem *)item->nextSibling() ) | 956 | item = (QCheckListItem *)item->nextSibling() ) |
954 | { | 957 | { |
955 | if ( item->isOn() ) | 958 | if ( item->isOn() ) |
956 | { | 959 | { |
957 | workingPackages.append( dealWithItem( item ) ); | 960 | workingPackages.append( dealWithItem( item ) ); |
958 | } | 961 | } |
959 | } | 962 | } |
960 | 963 | ||
961 | if ( workingPackages.count() == 0 ) | 964 | if ( workingPackages.count() == 0 ) |
962 | { | 965 | { |
963 | // Nothing to do | 966 | // Nothing to do |
964 | QMessageBox::information( this, tr( "Nothing to do" ), | 967 | QMessageBox::information( this, tr( "Nothing to do" ), |
965 | tr( "No packages selected" ), tr( "OK" ) ); | 968 | tr( "No packages selected" ), tr( "OK" ) ); |
966 | 969 | ||
967 | return; | 970 | return; |
968 | } | 971 | } |
969 | 972 | ||
970 | // do the stuff | 973 | // do the stuff |
971 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); | 974 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); |
972 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | 975 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
973 | reloadDocuments = TRUE; | 976 | reloadDocuments = TRUE; |
974 | stack->addWidget( dlg, 3 ); | 977 | stack->addWidget( dlg, 3 ); |
975 | stack->raiseWidget( dlg ); | 978 | stack->raiseWidget( dlg ); |
976 | } | 979 | } |
977 | 980 | ||
978 | // decide what to do - either remove, upgrade or install | 981 | // decide what to do - either remove, upgrade or install |
979 | // Current rules: | 982 | // Current rules: |
980 | // If not installed - install | 983 | // If not installed - install |
981 | // If installed and different version available - upgrade | 984 | // If installed and different version available - upgrade |
982 | // If installed and version up to date - remove | 985 | // If installed and version up to date - remove |
983 | InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) | 986 | InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) |
984 | { | 987 | { |
985 | QString name = item->text(); | 988 | QString name = item->text(); |
986 | 989 | ||
987 | // Get package | 990 | // Get package |
988 | Server *s = mgr->getServer( serversList->currentText() ); | 991 | Server *s = mgr->getServer( serversList->currentText() ); |
989 | Package *p = s->getPackage( name ); | 992 | Package *p = s->getPackage( name ); |
990 | 993 | ||
991 | // If the package has a filename then it is a local file | 994 | // If the package has a filename then it is a local file |
992 | if ( p->isPackageStoredLocally() ) | 995 | if ( p->isPackageStoredLocally() ) |
993 | name = p->getFilename(); | 996 | name = p->getFilename(); |
994 | 997 | ||
995 | QString option; | 998 | QString option; |
996 | QString dest = "root"; | 999 | QString dest = "root"; |
997 | if ( !p->isInstalled() ) | 1000 | if ( !p->isInstalled() ) |
998 | { | 1001 | { |
999 | InstallData *newitem = new InstallData(); | 1002 | InstallData *newitem = new InstallData(); |
1000 | newitem->option = "I"; | 1003 | newitem->option = "I"; |
1001 | newitem->packageName = name; | 1004 | newitem->packageName = name; |
1002 | return newitem; | 1005 | return newitem; |
1003 | } | 1006 | } |
1004 | else | 1007 | else |
1005 | { | 1008 | { |
1006 | InstallData *newitem = new InstallData(); | 1009 | InstallData *newitem = new InstallData(); |
1007 | newitem->option = "D"; | 1010 | newitem->option = "D"; |
1008 | if ( !p->isPackageStoredLocally() ) | 1011 | if ( !p->isPackageStoredLocally() ) |
1009 | newitem->packageName = p->getInstalledPackageName(); | 1012 | newitem->packageName = p->getInstalledPackageName(); |
1010 | else | 1013 | else |
1011 | newitem->packageName = name; | 1014 | newitem->packageName = name; |
1012 | 1015 | ||
1013 | if ( p->getInstalledTo() ) | 1016 | if ( p->getInstalledTo() ) |
1014 | { | 1017 | { |
1015 | newitem->destination = p->getInstalledTo(); | 1018 | newitem->destination = p->getInstalledTo(); |
1016 | // cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; | ||
1017 | // cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; | ||
1018 | } | 1019 | } |
1019 | else | 1020 | else |
1020 | { | 1021 | { |
1021 | newitem->destination = p->getLocalPackage()->getInstalledTo(); | 1022 | newitem->destination = p->getLocalPackage()->getInstalledTo(); |
1022 | } | 1023 | } |
1023 | 1024 | ||
1024 | // Now see if version is newer or not | 1025 | // Now see if version is newer or not |
1025 | int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); | 1026 | int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); |
1026 | 1027 | ||
1027 | // If the version requested is older and user selected a local ipk file, then reinstall the file | 1028 | // If the version requested is older and user selected a local ipk file, then reinstall the file |
1028 | if ( p->isPackageStoredLocally() && val == -1 ) | 1029 | if ( p->isPackageStoredLocally() && val == -1 ) |
1029 | val = 0; | 1030 | val = 0; |
1030 | 1031 | ||
1031 | if ( val == -2 ) | 1032 | if ( val == -2 ) |
1032 | { | 1033 | { |
1033 | // Error - should handle | 1034 | // Error - should handle |
1034 | } | 1035 | } |
1035 | else if ( val == -1 ) | 1036 | else if ( val == -1 ) |
1036 | { | 1037 | { |
1037 | // Version available is older - remove only | 1038 | // Version available is older - remove only |
1038 | newitem->option = "D"; | 1039 | newitem->option = "D"; |
1039 | } | 1040 | } |
1040 | else | 1041 | else |
1041 | { | 1042 | { |
1042 | QString caption; | 1043 | QString caption; |
1043 | QString text; | 1044 | QString text; |
1044 | QString secondButton; | 1045 | QString secondButton; |
1045 | QString secondOption; | 1046 | QString secondOption; |
1046 | if ( val == 0 ) | 1047 | if ( val == 0 ) |
1047 | { | 1048 | { |
1048 | // Version available is the same - option to remove or reinstall | 1049 | // Version available is the same - option to remove or reinstall |
1049 | caption = tr( "Do you wish to remove or reinstall\n%1?" ); | 1050 | caption = tr( "Do you wish to remove or reinstall\n%1?" ); |
1050 | text = tr( "Remove or ReInstall" ); | 1051 | text = tr( "Remove or ReInstall" ); |
1051 | secondButton = tr( "ReInstall" ); | 1052 | secondButton = tr( "ReInstall" ); |
1052 | secondOption = tr( "R" ); | 1053 | secondOption = tr( "R" ); |
1053 | } | 1054 | } |
1054 | else if ( val == 1 ) | 1055 | else if ( val == 1 ) |
1055 | { | 1056 | { |
1056 | // Version available is newer - option to remove or upgrade | 1057 | // Version available is newer - option to remove or upgrade |
1057 | caption = tr( "Do you wish to remove or upgrade\n%1?" ); | 1058 | caption = tr( "Do you wish to remove or upgrade\n%1?" ); |
1058 | text = tr( "Remove or Upgrade" ); | 1059 | text = tr( "Remove or Upgrade" ); |
1059 | secondButton = tr( "Upgrade" ); | 1060 | secondButton = tr( "Upgrade" ); |
1060 | secondOption = tr( "U" ); | 1061 | secondOption = tr( "U" ); |
1061 | } | 1062 | } |
1062 | 1063 | ||
1063 | // Sticky option not implemented yet, but will eventually allow | 1064 | // Sticky option not implemented yet, but will eventually allow |
1064 | // the user to say something like 'remove all' | 1065 | // the user to say something like 'remove all' |
1065 | if ( stickyOption == "" ) | 1066 | if ( stickyOption == "" ) |
1066 | { | 1067 | { |
1067 | QString msgtext; | 1068 | QString msgtext; |
1068 | msgtext = caption.arg( ( const char * )name ); | 1069 | msgtext = caption.arg( ( const char * )name ); |
1069 | switch( QMessageBox::information( this, text, | 1070 | switch( QMessageBox::information( this, text, |
1070 | msgtext, tr( "Remove" ), secondButton ) ) | 1071 | msgtext, tr( "Remove" ), secondButton ) ) |
1071 | { | 1072 | { |
1072 | case 0: // Try again or Enter | 1073 | case 0: // Try again or Enter |
1073 | // option 0 = Remove | 1074 | // option 0 = Remove |
1074 | newitem->option = "D"; | 1075 | newitem->option = "D"; |
1075 | break; | 1076 | break; |
1076 | case 1: // Quit or Escape | 1077 | case 1: // Quit or Escape |
1077 | newitem->option = secondOption; | 1078 | newitem->option = secondOption; |
1078 | break; | 1079 | break; |
1079 | } | 1080 | } |
1080 | } | 1081 | } |
1081 | else | 1082 | else |
1082 | { | 1083 | { |
1083 | // newitem->option = stickyOption; | 1084 | // newitem->option = stickyOption; |
1084 | } | 1085 | } |
1085 | } | 1086 | } |
1086 | 1087 | ||
1087 | 1088 | ||
1088 | // Check if we are reinstalling the same version | 1089 | // Check if we are reinstalling the same version |
1089 | if ( newitem->option != "R" ) | 1090 | if ( newitem->option != "R" ) |
1090 | newitem->recreateLinks = true; | 1091 | newitem->recreateLinks = true; |
1091 | else | 1092 | else |
1092 | newitem->recreateLinks = false; | 1093 | newitem->recreateLinks = false; |
1093 | 1094 | ||
1094 | // User hit cancel (on dlg - assume remove) | 1095 | // User hit cancel (on dlg - assume remove) |
1095 | return newitem; | 1096 | return newitem; |
1096 | } | 1097 | } |
1097 | } | 1098 | } |
1098 | 1099 | ||
1099 | void MainWindow :: reloadData( InstallDlgImpl *dlg ) | 1100 | void MainWindow :: reloadData( InstallDlgImpl *dlg ) |
1100 | { | 1101 | { |
1101 | stack->raiseWidget( progressWindow ); | 1102 | stack->raiseWidget( progressWindow ); |
1102 | 1103 | ||
1103 | if ( dlg ) | 1104 | if ( dlg ) |
1104 | { | 1105 | { |
1105 | dlg->close(); | 1106 | dlg->close(); |
1106 | delete dlg; | 1107 | delete dlg; |
1107 | } | 1108 | } |
1108 | 1109 | ||
1109 | mgr->reloadServerData(); | 1110 | mgr->reloadServerData(); |
1110 | serverSelected( -1, FALSE ); | 1111 | serverSelected( -1, FALSE ); |
1111 | 1112 | ||
1112 | #ifdef QWS | 1113 | #ifdef QWS |
1113 | if ( reloadDocuments ) | 1114 | if ( reloadDocuments ) |
1114 | { | 1115 | { |
1115 | m_status->setText( tr( "Updating Launcher..." ) ); | 1116 | m_status->setText( tr( "Updating Launcher..." ) ); |
1116 | 1117 | ||
1117 | // Finally let the main system update itself | 1118 | // Finally let the main system update itself |
1118 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 1119 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
1119 | QString lf = QString::null; | 1120 | QString lf = QString::null; |
1120 | e << lf; | 1121 | e << lf; |
1121 | } | 1122 | } |
1122 | #endif | 1123 | #endif |
1123 | 1124 | ||
1124 | stack->raiseWidget( networkPkgWindow ); | 1125 | stack->raiseWidget( networkPkgWindow ); |
1125 | } | 1126 | } |
1126 | 1127 | ||
1127 | void MainWindow :: letterPushed( QString t ) | 1128 | void MainWindow :: letterPushed( QString t ) |
1128 | { | 1129 | { |
1129 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); | 1130 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); |
1130 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 1131 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
1131 | if ( packagesList->firstChild() == 0 ) | 1132 | if ( packagesList->firstChild() == 0 ) |
1132 | return; | 1133 | return; |
1133 | 1134 | ||
1134 | QCheckListItem *item; | 1135 | QCheckListItem *item; |
1135 | if ( start == 0 ) | 1136 | if ( start == 0 ) |
1136 | { | 1137 | { |
1137 | item = (QCheckListItem *)packagesList->firstChild(); | 1138 | item = (QCheckListItem *)packagesList->firstChild(); |
1138 | start = top; | 1139 | start = top; |
1139 | } | 1140 | } |
1140 | else | 1141 | else |
1141 | item = (QCheckListItem *)start->nextSibling(); | 1142 | item = (QCheckListItem *)start->nextSibling(); |
1142 | 1143 | ||
1143 | if ( item == 0 ) | 1144 | if ( item == 0 ) |
1144 | item = (QCheckListItem *)packagesList->firstChild(); | 1145 | item = (QCheckListItem *)packagesList->firstChild(); |
1145 | do | 1146 | do |
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index f95c332..9f48321 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h | |||
@@ -1,142 +1,154 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | mainwin.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 13:32:30 BST 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This file is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
8 | 27 | ||
9 | /*************************************************************************** | 28 | */ |
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | 29 | ||
18 | #ifndef MAINWIN_H | 30 | #ifndef MAINWIN_H |
19 | #define MAINWIN_H | 31 | #define MAINWIN_H |
20 | 32 | ||
21 | #include <qmainwindow.h> | 33 | #include <qmainwindow.h> |
22 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
23 | 35 | ||
24 | class DataManager; | 36 | class DataManager; |
25 | class InstallData; | 37 | class InstallData; |
26 | class InstallDlgImpl; | 38 | class InstallDlgImpl; |
27 | 39 | ||
28 | class QAction; | 40 | class QAction; |
29 | class QCheckListItem; | 41 | class QCheckListItem; |
30 | class QComboBox; | 42 | class QComboBox; |
31 | class QLabel; | 43 | class QLabel; |
32 | class QLineEdit; | 44 | class QLineEdit; |
33 | class QListView; | 45 | class QListView; |
34 | class QListViewItem; | 46 | class QListViewItem; |
35 | class QToolBar; | 47 | class QToolBar; |
36 | class QProgressBar; | 48 | class QProgressBar; |
37 | class QWidgetStack; | 49 | class QWidgetStack; |
38 | 50 | ||
39 | class MainWindow :public QMainWindow | 51 | class MainWindow :public QMainWindow |
40 | { | 52 | { |
41 | Q_OBJECT | 53 | Q_OBJECT |
42 | public: | 54 | public: |
43 | 55 | ||
44 | MainWindow(); | 56 | MainWindow(); |
45 | ~MainWindow(); | 57 | ~MainWindow(); |
46 | 58 | ||
47 | protected: | 59 | protected: |
48 | void closeEvent( QCloseEvent* e ); | 60 | void closeEvent( QCloseEvent* e ); |
49 | 61 | ||
50 | private: | 62 | private: |
51 | DataManager *mgr; | 63 | DataManager *mgr; |
52 | 64 | ||
53 | QWidgetStack *stack; | 65 | QWidgetStack *stack; |
54 | 66 | ||
55 | QToolBar *findBar; | 67 | QToolBar *findBar; |
56 | QToolBar *jumpBar; | 68 | QToolBar *jumpBar; |
57 | QLineEdit *findEdit; | 69 | QLineEdit *findEdit; |
58 | QAction *actionFindNext; | 70 | QAction *actionFindNext; |
59 | QAction *actionFilter; | 71 | QAction *actionFilter; |
60 | QAction *actionUpgrade; | 72 | QAction *actionUpgrade; |
61 | QAction *actionDownload; | 73 | QAction *actionDownload; |
62 | QAction *actionUninstalled; | 74 | QAction *actionUninstalled; |
63 | QAction *actionInstalled; | 75 | QAction *actionInstalled; |
64 | QAction *actionUpdated; | 76 | QAction *actionUpdated; |
65 | 77 | ||
66 | QPixmap iconDownload; | 78 | QPixmap iconDownload; |
67 | QPixmap iconRemove; | 79 | QPixmap iconRemove; |
68 | 80 | ||
69 | int mnuShowUninstalledPkgsId; | 81 | int mnuShowUninstalledPkgsId; |
70 | int mnuShowInstalledPkgsId; | 82 | int mnuShowInstalledPkgsId; |
71 | int mnuShowUpgradedPkgsId; | 83 | int mnuShowUpgradedPkgsId; |
72 | int mnuFilterByCategory; | 84 | int mnuFilterByCategory; |
73 | int mnuSetFilterCategory; | 85 | int mnuSetFilterCategory; |
74 | 86 | ||
75 | // Main package list widget | 87 | // Main package list widget |
76 | QWidget *networkPkgWindow; | 88 | QWidget *networkPkgWindow; |
77 | QComboBox *serversList; | 89 | QComboBox *serversList; |
78 | QListView *packagesList; | 90 | QListView *packagesList; |
79 | QPixmap installedIcon; | 91 | QPixmap installedIcon; |
80 | QPixmap updatedIcon; | 92 | QPixmap updatedIcon; |
81 | QString currentlySelectedServer; | 93 | QString currentlySelectedServer; |
82 | QString categoryFilter; | 94 | QString categoryFilter; |
83 | QString stickyOption; | 95 | QString stickyOption; |
84 | 96 | ||
85 | bool categoryFilterEnabled; | 97 | bool categoryFilterEnabled; |
86 | bool showJumpTo; | 98 | bool showJumpTo; |
87 | bool showUninstalledPkgs; | 99 | bool showUninstalledPkgs; |
88 | bool showInstalledPkgs; | 100 | bool showInstalledPkgs; |
89 | bool showUpgradedPkgs; | 101 | bool showUpgradedPkgs; |
90 | bool downloadEnabled; | 102 | bool downloadEnabled; |
91 | bool reloadDocuments; | 103 | bool reloadDocuments; |
92 | 104 | ||
93 | void initMainWidget(); | 105 | void initMainWidget(); |
94 | void updateData(); | 106 | void updateData(); |
95 | void serverSelected( int index, bool showProgress ); | 107 | void serverSelected( int index, bool showProgress ); |
96 | void searchForPackage( const QString & ); | 108 | void searchForPackage( const QString & ); |
97 | bool filterByCategory( bool val ); | 109 | bool filterByCategory( bool val ); |
98 | void downloadSelectedPackages(); | 110 | void downloadSelectedPackages(); |
99 | void downloadRemotePackage(); | 111 | void downloadRemotePackage(); |
100 | InstallData *dealWithItem( QCheckListItem *item ); | 112 | InstallData *dealWithItem( QCheckListItem *item ); |
101 | 113 | ||
102 | // Progress widget | 114 | // Progress widget |
103 | QWidget *progressWindow; | 115 | QWidget *progressWindow; |
104 | QLabel *m_status; | 116 | QLabel *m_status; |
105 | QProgressBar *m_progress; | 117 | QProgressBar *m_progress; |
106 | 118 | ||
107 | void initProgressWidget(); | 119 | void initProgressWidget(); |
108 | 120 | ||
109 | public slots: | 121 | public slots: |
110 | void setDocument( const QString &doc ); | 122 | void setDocument( const QString &doc ); |
111 | void displayFindBar(); | 123 | void displayFindBar(); |
112 | void displayJumpBar(); | 124 | void displayJumpBar(); |
113 | void repeatFind(); | 125 | void repeatFind(); |
114 | void findPackage( const QString & ); | 126 | void findPackage( const QString & ); |
115 | void hideFindBar(); | 127 | void hideFindBar(); |
116 | void hideJumpBar(); | 128 | void hideJumpBar(); |
117 | void displaySettings(); | 129 | void displaySettings(); |
118 | void filterUninstalledPackages(); | 130 | void filterUninstalledPackages(); |
119 | void filterInstalledPackages(); | 131 | void filterInstalledPackages(); |
120 | void filterUpgradedPackages(); | 132 | void filterUpgradedPackages(); |
121 | void filterCategory(); | 133 | void filterCategory(); |
122 | bool setFilterCategory(); | 134 | bool setFilterCategory(); |
123 | void raiseMainWidget(); | 135 | void raiseMainWidget(); |
124 | void raiseProgressWidget(); | 136 | void raiseProgressWidget(); |
125 | void enableUpgrade( bool ); | 137 | void enableUpgrade( bool ); |
126 | void enableDownload( bool ); | 138 | void enableDownload( bool ); |
127 | void reloadData( InstallDlgImpl * ); | 139 | void reloadData( InstallDlgImpl * ); |
128 | 140 | ||
129 | private slots: | 141 | private slots: |
130 | void init(); | 142 | void init(); |
131 | void setProgressSteps( int ); | 143 | void setProgressSteps( int ); |
132 | void setProgressMessage( const QString & ); | 144 | void setProgressMessage( const QString & ); |
133 | void updateProgress( int ); | 145 | void updateProgress( int ); |
134 | void serverSelected( int index ); | 146 | void serverSelected( int index ); |
135 | void updateServer(); | 147 | void updateServer(); |
136 | void upgradePackages(); | 148 | void upgradePackages(); |
137 | void downloadPackage(); | 149 | void downloadPackage(); |
138 | void applyChanges(); | 150 | void applyChanges(); |
139 | void letterPushed( QString t ); | 151 | void letterPushed( QString t ); |
140 | void slotDisplayPackage( QListViewItem * ); | 152 | void slotDisplayPackage( QListViewItem * ); |
141 | }; | 153 | }; |
142 | #endif | 154 | #endif |
diff --git a/noncore/settings/aqpkg/mem.cpp b/noncore/settings/aqpkg/mem.cpp index 405aada..5f32a26 100644 --- a/noncore/settings/aqpkg/mem.cpp +++ b/noncore/settings/aqpkg/mem.cpp | |||
@@ -1,106 +1,110 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | mem.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | #include <stdio.h> | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | #include <fstream> | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | #include <iostream> | 19 | ..}^=.= = ; Public License for more details. |
20 | #include <list> | 20 | ++= -. .` .: |
21 | using namespace std; | 21 | : = ...= . :.=- You should have received a copy of the GNU |
22 | 22 | -. .:....=;==+<; General Public License along with this file; | |
23 | #define __MEMFILE_C | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
24 | #include "global.h" | 24 | -- :-=` Free Software Foundation, Inc., |
25 | 25 | 59 Temple Place - Suite 330, | |
26 | #ifdef _DEBUG | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | void __cdecl *operator new( unsigned int size, const char *file, int line ) | 28 | */ |
29 | { | 29 | |
30 | void *ptr = (void *)malloc(size); | 30 | #include <stdio.h> |
31 | AddTrack((long)ptr, size, file, line); | 31 | #include <list> |
32 | return(ptr); | 32 | using namespace std; |
33 | } | 33 | |
34 | 34 | #define __MEMFILE_C | |
35 | void operator delete(void *p) | 35 | #include "global.h" |
36 | { | 36 | |
37 | RemoveTrack((long)p); | 37 | #ifdef _DEBUG |
38 | free(p); | 38 | |
39 | } | 39 | void __cdecl *operator new( unsigned int size, const char *file, int line ) |
40 | 40 | { | |
41 | #endif | 41 | void *ptr = (void *)malloc(size); |
42 | 42 | AddTrack((long)ptr, size, file, line); | |
43 | 43 | return(ptr); | |
44 | typedef struct { | 44 | } |
45 | longaddress; | 45 | |
46 | longsize; | 46 | void operator delete(void *p) |
47 | charfile[64]; | 47 | { |
48 | longline; | 48 | RemoveTrack((long)p); |
49 | } ALLOC_INFO; | 49 | free(p); |
50 | 50 | } | |
51 | typedef list<ALLOC_INFO*> AllocList; | 51 | |
52 | 52 | #endif | |
53 | AllocList allocList; | 53 | |
54 | 54 | ||
55 | 55 | typedef struct { | |
56 | 56 | longaddress; | |
57 | void AddTrack(long addr, long asize, const char *fname, long lnum) | 57 | longsize; |
58 | { | 58 | charfile[64]; |
59 | ALLOC_INFO *info; | 59 | longline; |
60 | 60 | } ALLOC_INFO; | |
61 | 61 | ||
62 | info = (ALLOC_INFO *)malloc(sizeof( ALLOC_INFO )); | 62 | typedef list<ALLOC_INFO*> AllocList; |
63 | info->address = addr; | 63 | |
64 | strncpy(info->file, fname, 63); | 64 | AllocList allocList; |
65 | info->line = lnum; | 65 | |
66 | info->size = asize; | 66 | |
67 | allocList.insert(allocList.begin(), info); | 67 | |
68 | }; | 68 | void AddTrack(long addr, long asize, const char *fname, long lnum) |
69 | 69 | { | |
70 | void RemoveTrack(long addr) | 70 | ALLOC_INFO *info; |
71 | { | 71 | |
72 | AllocList::iterator i; | 72 | |
73 | 73 | info = (ALLOC_INFO *)malloc(sizeof( ALLOC_INFO )); | |
74 | bool found = false; | 74 | info->address = addr; |
75 | for(i = allocList.begin(); i != allocList.end(); i++) | 75 | strncpy(info->file, fname, 63); |
76 | { | 76 | info->line = lnum; |
77 | if((*i)->address == addr) | 77 | info->size = asize; |
78 | { | 78 | allocList.insert(allocList.begin(), info); |
79 | allocList.remove((*i)); | 79 | }; |
80 | found = true; | 80 | |
81 | break; | 81 | void RemoveTrack(long addr) |
82 | } | 82 | { |
83 | } | 83 | AllocList::iterator i; |
84 | } | 84 | |
85 | 85 | bool found = false; | |
86 | void DumpUnfreed() | 86 | for(i = allocList.begin(); i != allocList.end(); i++) |
87 | { | 87 | { |
88 | AllocList::iterator i; | 88 | if((*i)->address == addr) |
89 | long totalSize = 0; | 89 | { |
90 | char buf[1024]; | 90 | allocList.remove((*i)); |
91 | 91 | found = true; | |
92 | 92 | break; | |
93 | // if(!allocList) | 93 | } |
94 | // return; | 94 | } |
95 | 95 | } | |
96 | for(i = allocList.begin(); i != allocList.end(); i++) { | 96 | |
97 | sprintf(buf, "%-15s: LINE %ld, ADDRESS %ld %ld unfreed", | 97 | void DumpUnfreed() |
98 | (*i)->file, (*i)->line, (*i)->address, (*i)->size); | 98 | { |
99 | cout <<buf << endl; | 99 | AllocList::iterator i; |
100 | totalSize += (*i)->size; | 100 | long totalSize = 0; |
101 | } | 101 | char buf[1024]; |
102 | sprintf(buf, "-----------------------------------------------------------\n"); | 102 | |
103 | cout <<buf << endl; | 103 | for(i = allocList.begin(); i != allocList.end(); i++) { |
104 | sprintf(buf, "Total Unfreed: %ld bytes\n", totalSize); | 104 | sprintf(buf, "%-15s: LINE %ld, ADDRESS %ld %ld unfreed", |
105 | cout <<buf << endl; | 105 | (*i)->file, (*i)->line, (*i)->address, (*i)->size); |
106 | }; | 106 | totalSize += (*i)->size; |
107 | } | ||
108 | sprintf(buf, "-----------------------------------------------------------\n"); | ||
109 | sprintf(buf, "Total Unfreed: %ld bytes\n", totalSize); | ||
110 | }; | ||
diff --git a/noncore/settings/aqpkg/package.cpp b/noncore/settings/aqpkg/package.cpp index 3395870..4c27c65 100644 --- a/noncore/settings/aqpkg/package.cpp +++ b/noncore/settings/aqpkg/package.cpp | |||
@@ -1,144 +1,156 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | package.cpp - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
17 | 29 | ||
18 | #include "package.h" | 30 | #include "package.h" |
19 | #include "global.h" | 31 | #include "global.h" |
20 | 32 | ||
21 | Package::Package( QString &name ) | 33 | Package::Package( QString &name ) |
22 | { | 34 | { |
23 | packageName = name; | 35 | packageName = name; |
24 | 36 | ||
25 | version = "N/A"; | 37 | version = "N/A"; |
26 | description = "N/A"; | 38 | description = "N/A"; |
27 | packageSize = "N/A"; | 39 | packageSize = "N/A"; |
28 | section = "N/A"; | 40 | section = "N/A"; |
29 | 41 | ||
30 | localPackage = 0; | 42 | localPackage = 0; |
31 | installed = false; | 43 | installed = false; |
32 | packageStoredLocally = false; | 44 | packageStoredLocally = false; |
33 | installedToRoot = false; | 45 | installedToRoot = false; |
34 | installed = false; | 46 | installed = false; |
35 | installedTo = 0; | 47 | installedTo = 0; |
36 | } | 48 | } |
37 | 49 | ||
38 | Package::Package( char *name ) | 50 | Package::Package( char *name ) |
39 | { | 51 | { |
40 | packageName = name; | 52 | packageName = name; |
41 | 53 | ||
42 | version = "N/A"; | 54 | version = "N/A"; |
43 | description = "N/A"; | 55 | description = "N/A"; |
44 | packageSize = "N/A"; | 56 | packageSize = "N/A"; |
45 | section = "N/A"; | 57 | section = "N/A"; |
46 | 58 | ||
47 | localPackage = 0; | 59 | localPackage = 0; |
48 | installed = false; | 60 | installed = false; |
49 | packageStoredLocally = false; | 61 | packageStoredLocally = false; |
50 | installedToRoot = false; | 62 | installedToRoot = false; |
51 | installed = false; | 63 | installed = false; |
52 | installedTo = 0; | 64 | installedTo = 0; |
53 | differentVersionAvailable = false; | 65 | differentVersionAvailable = false; |
54 | } | 66 | } |
55 | 67 | ||
56 | Package::~Package() | 68 | Package::~Package() |
57 | { | 69 | { |
58 | } | 70 | } |
59 | 71 | ||
60 | QString Package :: toString() | 72 | QString Package :: toString() |
61 | { | 73 | { |
62 | QString ret = "Package - " + getPackageName() + | 74 | QString ret = "Package - " + getPackageName() + |
63 | "\n version - " + getVersion(); | 75 | "\n version - " + getVersion(); |
64 | 76 | ||
65 | if ( localPackage ) | 77 | if ( localPackage ) |
66 | ret += "\n inst version - " + localPackage->getVersion(); | 78 | ret += "\n inst version - " + localPackage->getVersion(); |
67 | 79 | ||
68 | 80 | ||
69 | return ret; | 81 | return ret; |
70 | } | 82 | } |
71 | 83 | ||
72 | void Package :: setStatus( const QString &s ) | 84 | void Package :: setStatus( const QString &s ) |
73 | { | 85 | { |
74 | QString state_status; | 86 | QString state_status; |
75 | int two, three; | 87 | int two, three; |
76 | 88 | ||
77 | status = s.simplifyWhiteSpace( ); | 89 | status = s.simplifyWhiteSpace( ); |
78 | 90 | ||
79 | two = status.find( " " ); // find second column | 91 | two = status.find( " " ); // find second column |
80 | three = status.find( " ", two + 1 ); // find third column | 92 | three = status.find( " ", two + 1 ); // find third column |
81 | 93 | ||
82 | state_status = status.mid( three ).stripWhiteSpace( ); | 94 | state_status = status.mid( three ).stripWhiteSpace( ); |
83 | 95 | ||
84 | if ( state_status == "installed" ) | 96 | if ( state_status == "installed" ) |
85 | installed = true; | 97 | installed = true; |
86 | } | 98 | } |
87 | 99 | ||
88 | void Package :: setLocalPackage( Package *p ) | 100 | void Package :: setLocalPackage( Package *p ) |
89 | { | 101 | { |
90 | localPackage = p; | 102 | localPackage = p; |
91 | 103 | ||
92 | if ( localPackage ) | 104 | if ( localPackage ) |
93 | if ( localPackage->getVersion() < getVersion() && !installed ) | 105 | if ( localPackage->getVersion() < getVersion() && !installed ) |
94 | differentVersionAvailable = true; | 106 | differentVersionAvailable = true; |
95 | else | 107 | else |
96 | differentVersionAvailable = false; | 108 | differentVersionAvailable = false; |
97 | } | 109 | } |
98 | 110 | ||
99 | void Package :: setVersion( const QString &v ) | 111 | void Package :: setVersion( const QString &v ) |
100 | { | 112 | { |
101 | version = v; | 113 | version = v; |
102 | 114 | ||
103 | if ( localPackage ) | 115 | if ( localPackage ) |
104 | if ( localPackage->getVersion() < getVersion() && !installed ) | 116 | if ( localPackage->getVersion() < getVersion() && !installed ) |
105 | differentVersionAvailable = true; | 117 | differentVersionAvailable = true; |
106 | else | 118 | else |
107 | differentVersionAvailable = false; | 119 | differentVersionAvailable = false; |
108 | } | 120 | } |
109 | 121 | ||
110 | void Package :: setPackageName( const QString &name ) | 122 | void Package :: setPackageName( const QString &name ) |
111 | { | 123 | { |
112 | packageName = name; | 124 | packageName = name; |
113 | } | 125 | } |
114 | 126 | ||
115 | void Package :: setDescription( const QString &d ) | 127 | void Package :: setDescription( const QString &d ) |
116 | { | 128 | { |
117 | description = d; | 129 | description = d; |
118 | } | 130 | } |
119 | 131 | ||
120 | void Package :: setFilename( const QString &f ) | 132 | void Package :: setFilename( const QString &f ) |
121 | { | 133 | { |
122 | filename = f; | 134 | filename = f; |
123 | } | 135 | } |
124 | 136 | ||
125 | 137 | ||
126 | QString Package :: getInstalledVersion() | 138 | QString Package :: getInstalledVersion() |
127 | { | 139 | { |
128 | if ( localPackage ) | 140 | if ( localPackage ) |
129 | return localPackage->getVersion(); | 141 | return localPackage->getVersion(); |
130 | else | 142 | else |
131 | return getVersion(); | 143 | return getVersion(); |
132 | } | 144 | } |
133 | 145 | ||
134 | QString Package :: getInstalledPackageName() | 146 | QString Package :: getInstalledPackageName() |
135 | { | 147 | { |
136 | if ( localPackage ) | 148 | if ( localPackage ) |
137 | return localPackage->getPackageName(); | 149 | return localPackage->getPackageName(); |
138 | else | 150 | else |
139 | return getPackageName(); | 151 | return getPackageName(); |
140 | } | 152 | } |
141 | 153 | ||
142 | bool Package :: isInstalled() | 154 | bool Package :: isInstalled() |
143 | { | 155 | { |
144 | return installed || ( localPackage && localPackage->isInstalled() ); | 156 | return installed || ( localPackage && localPackage->isInstalled() ); |
diff --git a/noncore/settings/aqpkg/package.h b/noncore/settings/aqpkg/package.h index 110ae91..c72f8b3 100644 --- a/noncore/settings/aqpkg/package.h +++ b/noncore/settings/aqpkg/package.h | |||
@@ -1,90 +1,102 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | package.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This file is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
8 | 27 | ||
9 | /*************************************************************************** | 28 | */ |
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | 29 | ||
18 | #ifndef PACKAGE_H | 30 | #ifndef PACKAGE_H |
19 | #define PACKAGE_H | 31 | #define PACKAGE_H |
20 | 32 | ||
21 | #include <stdlib.h> | 33 | #include <stdlib.h> |
22 | 34 | ||
23 | /** | 35 | /** |
24 | *@author Andy Qua | 36 | *@author Andy Qua |
25 | */ | 37 | */ |
26 | 38 | ||
27 | #include <qstring.h> | 39 | #include <qstring.h> |
28 | #include "destination.h" | 40 | #include "destination.h" |
29 | 41 | ||
30 | class Package | 42 | class Package |
31 | { | 43 | { |
32 | public: | 44 | public: |
33 | Package( QString &name ); | 45 | Package( QString &name ); |
34 | Package( char *name ); | 46 | Package( char *name ); |
35 | ~Package(); | 47 | ~Package(); |
36 | 48 | ||
37 | void setLocalPackage( Package *p ); | 49 | void setLocalPackage( Package *p ); |
38 | void setPackageName( const QString &name ); | 50 | void setPackageName( const QString &name ); |
39 | void setVersion( const QString &v ); | 51 | void setVersion( const QString &v ); |
40 | void setStatus( const QString &s ); | 52 | void setStatus( const QString &s ); |
41 | void setDescription( const QString &d ); | 53 | void setDescription( const QString &d ); |
42 | void setFilename( const QString &f ); | 54 | void setFilename( const QString &f ); |
43 | void setPackageStoredLocally( bool local ){ packageStoredLocally = local; } | 55 | void setPackageStoredLocally( bool local ){ packageStoredLocally = local; } |
44 | void setInstalledToRoot( bool root ) { installedToRoot = root; } | 56 | void setInstalledToRoot( bool root ) { installedToRoot = root; } |
45 | void setInstalledTo( Destination *d ) { installedTo = d; } | 57 | void setInstalledTo( Destination *d ) { installedTo = d; } |
46 | void setDependancies( QString &deps ) { dependancies = deps; } | 58 | void setDependancies( QString &deps ) { dependancies = deps; } |
47 | void setPackageSize( const QString &size ) { packageSize = size; } | 59 | void setPackageSize( const QString &size ) { packageSize = size; } |
48 | void setSection( const QString §) { section = sect; } | 60 | void setSection( const QString §) { section = sect; } |
49 | 61 | ||
50 | Package *getLocalPackage() { return localPackage; } | 62 | Package *getLocalPackage() { return localPackage; } |
51 | QString getPackageName() { return packageName; } | 63 | QString getPackageName() { return packageName; } |
52 | QString getVersion() { return version; } | 64 | QString getVersion() { return version; } |
53 | QString getStatus() { return status; } | 65 | QString getStatus() { return status; } |
54 | QString getDescription() { return description; } | 66 | QString getDescription() { return description; } |
55 | QString getFilename() { return filename; } | 67 | QString getFilename() { return filename; } |
56 | QString getDependancies() { return dependancies; } | 68 | QString getDependancies() { return dependancies; } |
57 | QString getPackageSize() { return packageSize; } | 69 | QString getPackageSize() { return packageSize; } |
58 | QString getSection() { return section; } | 70 | QString getSection() { return section; } |
59 | bool getNewVersionAvailable() { return differentVersionAvailable; } | 71 | bool getNewVersionAvailable() { return differentVersionAvailable; } |
60 | 72 | ||
61 | bool isInstalled(); | 73 | bool isInstalled(); |
62 | bool isPackageStoredLocally(){ return packageStoredLocally; } | 74 | bool isPackageStoredLocally(){ return packageStoredLocally; } |
63 | bool isInstalledToRoot() { return installedToRoot; } | 75 | bool isInstalledToRoot() { return installedToRoot; } |
64 | QString getInstalledVersion(); | 76 | QString getInstalledVersion(); |
65 | QString getInstalledPackageName(); | 77 | QString getInstalledPackageName(); |
66 | Destination *getInstalledTo() { return installedTo; } | 78 | Destination *getInstalledTo() { return installedTo; } |
67 | 79 | ||
68 | QString toString(); | 80 | QString toString(); |
69 | 81 | ||
70 | 82 | ||
71 | private: | 83 | private: |
72 | Package *localPackage; | 84 | Package *localPackage; |
73 | 85 | ||
74 | QString packageName; | 86 | QString packageName; |
75 | QString version; | 87 | QString version; |
76 | QString status; | 88 | QString status; |
77 | QString description; | 89 | QString description; |
78 | QString filename; | 90 | QString filename; |
79 | bool packageStoredLocally; | 91 | bool packageStoredLocally; |
80 | bool installedToRoot; | 92 | bool installedToRoot; |
81 | bool installed; | 93 | bool installed; |
82 | bool differentVersionAvailable; | 94 | bool differentVersionAvailable; |
83 | QString dependancies; | 95 | QString dependancies; |
84 | QString packageSize; | 96 | QString packageSize; |
85 | QString section; | 97 | QString section; |
86 | 98 | ||
87 | Destination *installedTo; | 99 | Destination *installedTo; |
88 | }; | 100 | }; |
89 | 101 | ||
90 | #endif | 102 | #endif |
diff --git a/noncore/settings/aqpkg/packagewin.cpp b/noncore/settings/aqpkg/packagewin.cpp index 7971ccc..9553cd1 100644 --- a/noncore/settings/aqpkg/packagewin.cpp +++ b/noncore/settings/aqpkg/packagewin.cpp | |||
@@ -1,119 +1,118 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. | 3 | |
4 | .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | .=l. Dan Williams <drw@handhelds.org> | ||
5 | .>+-= | 6 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 13 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 19 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 20 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
26 | 27 | ||
27 | */ | 28 | */ |
28 | 29 | ||
29 | #include "packagewin.h" | 30 | #include "packagewin.h" |
30 | #include "package.h" | 31 | #include "package.h" |
31 | #include "datamgr.h" | 32 | #include "datamgr.h" |
32 | 33 | ||
33 | #include <qpe/resource.h> | 34 | #include <qpe/resource.h> |
34 | 35 | ||
35 | #include <qlayout.h> | 36 | #include <qlayout.h> |
36 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
37 | #include <qstring.h> | 38 | #include <qstring.h> |
38 | #include <qtextview.h> | 39 | #include <qtextview.h> |
39 | 40 | ||
40 | PackageWindow::PackageWindow( Package *package, const QString &server ) | 41 | PackageWindow::PackageWindow( Package *package, const QString &server ) |
41 | : QWidget( 0, 0, 0 ) | 42 | : QWidget( 0, 0, 0 ) |
42 | { | 43 | { |
43 | QString str; | 44 | QString str; |
44 | if ( package ) | 45 | if ( package ) |
45 | { | 46 | { |
46 | setCaption( package->getPackageName() ); | 47 | setCaption( package->getPackageName() ); |
47 | QString destName; | 48 | QString destName; |
48 | if ( package->getLocalPackage() ) | 49 | if ( package->getLocalPackage() ) |
49 | { | 50 | { |
50 | if ( package->getLocalPackage()->getInstalledTo() ) | 51 | if ( package->getLocalPackage()->getInstalledTo() ) |
51 | destName = package->getLocalPackage()->getInstalledTo()->getDestinationName(); | 52 | destName = package->getLocalPackage()->getInstalledTo()->getDestinationName(); |
52 | } | 53 | } |
53 | else | 54 | else |
54 | { | 55 | { |
55 | if ( package->getInstalledTo() ) | 56 | if ( package->getInstalledTo() ) |
56 | destName = package->getInstalledTo()->getDestinationName(); | 57 | destName = package->getInstalledTo()->getDestinationName(); |
57 | } | 58 | } |
58 | 59 | ||
59 | if ( !package->isPackageStoredLocally() ) | 60 | if ( !package->isPackageStoredLocally() ) |
60 | { | 61 | { |
61 | str.append( tr( "<b>Description</b> - " ) ); | 62 | str.append( tr( "<b>Description</b> - " ) ); |
62 | str.append( package->getDescription() ); | 63 | str.append( package->getDescription() ); |
63 | if ( !destName.isNull() ) | 64 | if ( !destName.isNull() ) |
64 | { | 65 | { |
65 | str.append( tr( "<p><b>Installed To</b> - " ) ); | 66 | str.append( tr( "<p><b>Installed To</b> - " ) ); |
66 | str.append( destName ); | 67 | str.append( destName ); |
67 | } | 68 | } |
68 | str.append( tr( "<p><b>Size</b> - " ) ); | 69 | str.append( tr( "<p><b>Size</b> - " ) ); |
69 | str.append( package->getPackageSize() ); | 70 | str.append( package->getPackageSize() ); |
70 | str.append( tr( "<p><b>Section</b> - " ) ); | 71 | str.append( tr( "<p><b>Section</b> - " ) ); |
71 | str.append( package->getSection() ); | 72 | str.append( package->getSection() ); |
72 | } | 73 | } |
73 | else | 74 | else |
74 | { | 75 | { |
75 | str.append( tr( "<p><b>Filename</b> - " ) ); | 76 | str.append( tr( "<p><b>Filename</b> - " ) ); |
76 | str.append( package->getFilename() ); | 77 | str.append( package->getFilename() ); |
77 | } | 78 | } |
78 | 79 | ||
79 | if ( server == LOCAL_SERVER ) | 80 | if ( server == LOCAL_SERVER ) |
80 | { | 81 | { |
81 | str.append( tr( "<p><b>Version Installed</b> - " ) ); | 82 | str.append( tr( "<p><b>Version Installed</b> - " ) ); |
82 | str.append( package->getVersion() ); | 83 | str.append( package->getVersion() ); |
83 | } | 84 | } |
84 | else | 85 | else |
85 | { | 86 | { |
86 | str.append( tr( "<p><b>Version Available</b> - " ) ); | 87 | str.append( tr( "<p><b>Version Available</b> - " ) ); |
87 | str.append( package->getVersion() ); | 88 | str.append( package->getVersion() ); |
88 | if ( package->getLocalPackage() ) | 89 | if ( package->getLocalPackage() ) |
89 | { | 90 | { |
90 | if ( package->isInstalled() ) | 91 | if ( package->isInstalled() ) |
91 | { | 92 | { |
92 | str.append( tr( "<p><b>Version Installed</b> - " ) ); | 93 | str.append( tr( "<p><b>Version Installed</b> - " ) ); |
93 | str.append( package->getInstalledVersion() ); | 94 | str.append( package->getInstalledVersion() ); |
94 | } | 95 | } |
95 | } | 96 | } |
96 | } | 97 | } |
97 | } | 98 | } |
98 | else | 99 | else |
99 | { | 100 | { |
100 | setCaption( tr( "Package Information" ) ); | 101 | setCaption( tr( "Package Information" ) ); |
101 | str = tr( "Package information is unavailable" ); | 102 | str = tr( "Package information is unavailable" ); |
102 | } | 103 | } |
103 | 104 | ||
104 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 4 ); | 105 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 4 ); |
105 | 106 | ||
106 | QTextView *l = new QTextView( str, QString::null, this ); | 107 | QTextView *l = new QTextView( str, QString::null, this ); |
107 | //l->setTextFormat( Qt::RichText ); | ||
108 | //l->setAlignment( Qt::AlignLeft | Qt::AlignVCenter | Qt::WordBreak ); | ||
109 | layout->addWidget( l ); | 108 | layout->addWidget( l ); |
110 | 109 | ||
111 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "enter" ), tr( "Close" ), this ); | 110 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "enter" ), tr( "Close" ), this ); |
112 | layout->addWidget( btn ); | 111 | layout->addWidget( btn ); |
113 | connect( btn, SIGNAL( clicked() ), this, SLOT( close() ) ); | 112 | connect( btn, SIGNAL( clicked() ), this, SLOT( close() ) ); |
114 | 113 | ||
115 | } | 114 | } |
116 | 115 | ||
117 | PackageWindow::~PackageWindow() | 116 | PackageWindow::~PackageWindow() |
118 | { | 117 | { |
119 | } | 118 | } |
diff --git a/noncore/settings/aqpkg/packagewin.h b/noncore/settings/aqpkg/packagewin.h index b4fdcad..83f3849 100644 --- a/noncore/settings/aqpkg/packagewin.h +++ b/noncore/settings/aqpkg/packagewin.h | |||
@@ -1,45 +1,46 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. | 3 | |
4 | .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | .=l. Dan Williams <drw@handhelds.org> | ||
5 | .>+-= | 6 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 13 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 19 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 20 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
26 | 27 | ||
27 | */ | 28 | */ |
28 | 29 | ||
29 | #ifndef PACKAGEWIN_H | 30 | #ifndef PACKAGEWIN_H |
30 | #define PACKAGEWIN_H | 31 | #define PACKAGEWIN_H |
31 | 32 | ||
32 | #include <qwidget.h> | 33 | #include <qwidget.h> |
33 | 34 | ||
34 | class Package; | 35 | class Package; |
35 | 36 | ||
36 | class PackageWindow :public QWidget | 37 | class PackageWindow :public QWidget |
37 | { | 38 | { |
38 | Q_OBJECT | 39 | Q_OBJECT |
39 | 40 | ||
40 | public: | 41 | public: |
41 | PackageWindow( Package * = 0x0, const QString & = QString::null ); | 42 | PackageWindow( Package * = 0x0, const QString & = QString::null ); |
42 | ~PackageWindow(); | 43 | ~PackageWindow(); |
43 | }; | 44 | }; |
44 | 45 | ||
45 | #endif | 46 | #endif |
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp index e2b8096..4693db1 100644 --- a/noncore/settings/aqpkg/server.cpp +++ b/noncore/settings/aqpkg/server.cpp | |||
@@ -1,215 +1,223 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | server.cpp - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | description : This class holds details about a server | 7 | _;:, .> :=|. This file is free software; you can |
8 | : e.g. all the packages that contained on the server | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | : the installation status | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | ***************************************************************************/ | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | 11 | - . .-<_> .<> Foundation; either version 2 of the License, | |
12 | /*************************************************************************** | 12 | ._= =} : or (at your option) any later version. |
13 | * * | 13 | .%`+i> _;_. |
14 | * This program is free software; you can redistribute it and/or modify * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * it under the terms of the GNU General Public License as published by * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | * the Free Software Foundation; either version 2 of the License, or * | 16 | : .. .:, . . . without even the implied warranty of |
17 | * (at your option) any later version. * | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | * * | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ***************************************************************************/ | 19 | ..}^=.= = ; Public License for more details. |
20 | 20 | ++= -. .` .: | |
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
21 | 29 | ||
22 | #include "server.h" | 30 | #include "server.h" |
23 | #include "datamgr.h" | 31 | #include "datamgr.h" |
24 | 32 | ||
25 | #include <qfile.h> | 33 | #include <qfile.h> |
26 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
27 | 35 | ||
28 | #ifdef QWS | 36 | #ifdef QWS |
29 | #include <qpe/global.h> | 37 | #include <qpe/global.h> |
30 | #include <qpe/applnk.h> | 38 | #include <qpe/applnk.h> |
31 | #include <qlist.h> | 39 | #include <qlist.h> |
32 | #endif | 40 | #endif |
33 | 41 | ||
34 | #include "utils.h" | 42 | #include "utils.h" |
35 | 43 | ||
36 | #include "global.h" | 44 | #include "global.h" |
37 | 45 | ||
38 | Server :: Server( const char *name, const char *url ) | 46 | Server :: Server( const char *name, const char *url ) |
39 | { | 47 | { |
40 | serverName = name; | 48 | serverName = name; |
41 | serverUrl = url; | 49 | serverUrl = url; |
42 | packageFile = IPKG_DIR; | 50 | packageFile = IPKG_DIR; |
43 | active = true; | 51 | active = true; |
44 | packageFile += "lists/" + serverName; | 52 | packageFile.append( "lists/" ); |
53 | packageFile.append( serverName ); | ||
45 | } | 54 | } |
46 | 55 | ||
47 | Server :: ~Server() | 56 | Server :: ~Server() |
48 | { | 57 | { |
49 | cleanUp(); | 58 | cleanUp(); |
50 | } | 59 | } |
51 | 60 | ||
52 | void Server :: cleanUp() | 61 | void Server :: cleanUp() |
53 | { | 62 | { |
54 | packageList.clear(); | 63 | packageList.clear(); |
55 | } | 64 | } |
56 | 65 | ||
57 | void Server :: readStatusFile( QList<Destination> &destList ) | 66 | void Server :: readStatusFile( QList<Destination> &destList ) |
58 | { | 67 | { |
59 | cleanUp(); | 68 | cleanUp(); |
60 | 69 | ||
61 | Destination *dest; | 70 | Destination *dest; |
62 | QListIterator<Destination> dit( destList ); | 71 | QListIterator<Destination> dit( destList ); |
63 | bool rootRead = false; | 72 | bool rootRead = false; |
64 | for ( ; dit.current(); ++dit ) | 73 | for ( ; dit.current(); ++dit ) |
65 | { | 74 | { |
66 | dest = dit.current(); | 75 | dest = dit.current(); |
67 | bool installingToRoot = false; | 76 | bool installingToRoot = false; |
68 | 77 | ||
69 | QString path = dest->getDestinationPath(); | 78 | QString path = dest->getDestinationPath(); |
70 | if ( path.right( 1 ) != "/" ) | 79 | if ( path.right( 1 ) != "/" ) |
71 | path.append( "/" ); | 80 | path.append( "/" ); |
72 | 81 | ||
73 | if ( path == "/" ) | 82 | if ( path == "/" ) |
74 | { | 83 | { |
75 | rootRead = true; | 84 | rootRead = true; |
76 | installingToRoot = true; | 85 | installingToRoot = true; |
77 | } | 86 | } |
78 | 87 | ||
79 | packageFile = path; | 88 | packageFile = path; |
80 | packageFile.append( "usr/lib/ipkg/status" ); | 89 | packageFile.append( "usr/lib/ipkg/status" ); |
81 | readPackageFile( 0, false, installingToRoot, &( *dest ) ); | 90 | readPackageFile( 0, false, installingToRoot, &( *dest ) ); |
82 | } | 91 | } |
83 | 92 | ||
84 | // Ensure that the root status file is read | 93 | // Ensure that the root status file is read |
85 | if ( !rootRead ) | 94 | if ( !rootRead ) |
86 | { | 95 | { |
87 | //cout << "Reading status file " << "/usr/lib/ipkg/status" << endl; | ||
88 | packageFile = "/usr/lib/ipkg/status"; | 96 | packageFile = "/usr/lib/ipkg/status"; |
89 | readPackageFile( 0, false, true ); | 97 | readPackageFile( 0, false, true ); |
90 | } | 98 | } |
91 | } | 99 | } |
92 | 100 | ||
93 | void Server :: readLocalIpks( Server *local ) | 101 | void Server :: readLocalIpks( Server *local ) |
94 | { | 102 | { |
95 | cleanUp(); | 103 | cleanUp(); |
96 | 104 | ||
97 | #ifdef QWS | 105 | #ifdef QWS |
98 | // First, get any local IPKGs in the documents area | 106 | // First, get any local IPKGs in the documents area |
99 | // Only applicable to Qtopie/Opie | 107 | // Only applicable to Qtopie/Opie |
100 | 108 | ||
101 | DocLnkSet files; | 109 | DocLnkSet files; |
102 | Global::findDocuments( &files, "application/ipkg" ); | 110 | Global::findDocuments( &files, "application/ipkg" ); |
103 | 111 | ||
104 | // Now add the items to the list | 112 | // Now add the items to the list |
105 | QListIterator<DocLnk> it( files.children() ); | 113 | QListIterator<DocLnk> it( files.children() ); |
106 | 114 | ||
107 | for ( ; it.current() ; ++it ) | 115 | for ( ; it.current() ; ++it ) |
108 | { | 116 | { |
109 | // OK, we have a local IPK file, I think the standard naming conventions | 117 | // OK, we have a local IPK file, I think the standard naming conventions |
110 | // for these are packagename_version_arm.ipk | 118 | // for these are packagename_version_arm.ipk |
111 | QString file = (*it)->file(); | 119 | QString file = (*it)->file(); |
112 | 120 | ||
113 | // Changed to display the filename (excluding the path) | 121 | // Changed to display the filename (excluding the path) |
114 | QString packageName = Utils::getFilenameFromIpkFilename( file ); | 122 | QString packageName = Utils::getFilenameFromIpkFilename( file ); |
115 | QString ver = Utils::getPackageVersionFromIpkFilename( file ); | 123 | QString ver = Utils::getPackageVersionFromIpkFilename( file ); |
116 | Package *package = new Package( packageName ); | 124 | Package *package = new Package( packageName ); |
117 | package->setVersion( ver ); | 125 | package->setVersion( ver ); |
118 | package->setFilename( file ); | 126 | package->setFilename( file ); |
119 | package->setPackageStoredLocally( true ); | 127 | package->setPackageStoredLocally( true ); |
120 | packageList.append( package ); | 128 | packageList.append( package ); |
121 | } | 129 | } |
122 | #else | 130 | #else |
123 | QString names[] = { "advancedfm_0.9.1-20020811_arm.ipk", "libopie_0.9.1-20020811_arm.ipk", "libopieobex_0.9.1-20020811.1_arm.ipk", "opie-addressbook_0.9.1-20020811_arm.ipk" }; | 131 | QString names[] = { "advancedfm_0.9.1-20020811_arm.ipk", "libopie_0.9.1-20020811_arm.ipk", "libopieobex_0.9.1-20020811.1_arm.ipk", "opie-addressbook_0.9.1-20020811_arm.ipk" }; |
124 | for ( int i = 0 ; i < 4 ; ++i ) | 132 | for ( int i = 0 ; i < 4 ; ++i ) |
125 | { | 133 | { |
126 | // OK, we have a local IPK file, I think the standard naming conventions | 134 | // OK, we have a local IPK file, I think the standard naming conventions |
127 | // for these are packagename_version_arm.ipk | 135 | // for these are packagename_version_arm.ipk |
128 | QString file = names[i]; | 136 | QString file = names[i]; |
129 | int p = file.find( "_" ); | 137 | int p = file.find( "_" ); |
130 | QString tmp = file.mid( 0, p ); | 138 | QString tmp = file.mid( 0, p ); |
131 | packageList.push_back( Package( tmp ) ); | 139 | packageList.push_back( Package( tmp ) ); |
132 | int p2 = file.find( "_", p+1 ); | 140 | int p2 = file.find( "_", p+1 ); |
133 | tmp = file.mid( p+1, p2-(p+1) ); | 141 | tmp = file.mid( p+1, p2-(p+1) ); |
134 | packageList.back().setVersion( tmp ); | 142 | packageList.back().setVersion( tmp ); |
135 | packageList.back().setPackageStoredLocally( true ); | 143 | packageList.back().setPackageStoredLocally( true ); |
136 | } | 144 | } |
137 | #endif | 145 | #endif |
138 | 146 | ||
139 | // build local packages | 147 | // build local packages |
140 | buildLocalPackages( local ); | 148 | buildLocalPackages( local ); |
141 | } | 149 | } |
142 | 150 | ||
143 | void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot, Destination *dest ) | 151 | void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot, Destination *dest ) |
144 | { | 152 | { |
145 | QFile f( packageFile ); | 153 | QFile f( packageFile ); |
146 | if ( !f.open( IO_ReadOnly ) ) | 154 | if ( !f.open( IO_ReadOnly ) ) |
147 | return; | 155 | return; |
148 | QTextStream t( &f ); | 156 | QTextStream t( &f ); |
149 | 157 | ||
150 | QString line; | 158 | QString line; |
151 | QString key; | 159 | QString key; |
152 | QString value; | 160 | QString value; |
153 | int pos; | 161 | int pos; |
154 | 162 | ||
155 | if ( clearAll ) | 163 | if ( clearAll ) |
156 | cleanUp(); | 164 | cleanUp(); |
157 | Package *currPackage = 0; | 165 | Package *currPackage = 0; |
158 | 166 | ||
159 | bool newPackage = true; | 167 | bool newPackage = true; |
160 | while ( !t.eof() ) | 168 | while ( !t.eof() ) |
161 | { | 169 | { |
162 | line = t.readLine(); | 170 | line = t.readLine(); |
163 | 171 | ||
164 | pos = line.find( ':', 0 ); | 172 | pos = line.find( ':', 0 ); |
165 | if ( pos > -1 ) | 173 | if ( pos > -1 ) |
166 | key = line.mid( 0, pos ).stripWhiteSpace(); | 174 | key = line.mid( 0, pos ).stripWhiteSpace(); |
167 | else | 175 | else |
168 | key = QString::null; | 176 | key = QString::null; |
169 | value = line.mid( pos+1, line.length()-pos ).stripWhiteSpace(); | 177 | value = line.mid( pos+1, line.length()-pos ).stripWhiteSpace(); |
170 | 178 | ||
171 | if ( key == "Package" && newPackage ) | 179 | if ( key == "Package" && newPackage ) |
172 | { | 180 | { |
173 | newPackage = false; | 181 | newPackage = false; |
174 | 182 | ||
175 | currPackage = getPackage( value ); | 183 | currPackage = getPackage( value ); |
176 | if ( !currPackage ) | 184 | if ( !currPackage ) |
177 | { | 185 | { |
178 | Package *package = new Package( value ); | 186 | Package *package = new Package( value ); |
179 | packageList.append( package ); | 187 | packageList.append( package ); |
180 | currPackage = package; | 188 | currPackage = package; |
181 | currPackage->setInstalledTo( dest ); | 189 | currPackage->setInstalledTo( dest ); |
182 | if ( installingToRoot ) | 190 | if ( installingToRoot ) |
183 | currPackage->setInstalledToRoot( true ); | 191 | currPackage->setInstalledToRoot( true ); |
184 | } | 192 | } |
185 | else | 193 | else |
186 | { | 194 | { |
187 | if ( currPackage->isInstalled() ) | 195 | if ( currPackage->isInstalled() ) |
188 | currPackage->setInstalledTo( dest ); | 196 | currPackage->setInstalledTo( dest ); |
189 | } | 197 | } |
190 | } | 198 | } |
191 | else if ( key == "Version" ) | 199 | else if ( key == "Version" ) |
192 | { | 200 | { |
193 | if ( currPackage ) | 201 | if ( currPackage ) |
194 | currPackage->setVersion( value ); | 202 | currPackage->setVersion( value ); |
195 | } | 203 | } |
196 | else if ( key == "Status" ) | 204 | else if ( key == "Status" ) |
197 | { | 205 | { |
198 | if ( currPackage ) | 206 | if ( currPackage ) |
199 | currPackage->setStatus( value ); | 207 | currPackage->setStatus( value ); |
200 | } | 208 | } |
201 | else if ( key == "Description" ) | 209 | else if ( key == "Description" ) |
202 | { | 210 | { |
203 | if ( currPackage ) | 211 | if ( currPackage ) |
204 | currPackage->setDescription( value ); | 212 | currPackage->setDescription( value ); |
205 | } | 213 | } |
206 | else if ( key == "Filename" ) | 214 | else if ( key == "Filename" ) |
207 | { | 215 | { |
208 | if ( currPackage ) | 216 | if ( currPackage ) |
209 | currPackage->setFilename( value ); | 217 | currPackage->setFilename( value ); |
210 | } | 218 | } |
211 | else if ( key == "Size" ) | 219 | else if ( key == "Size" ) |
212 | { | 220 | { |
213 | if ( currPackage ) | 221 | if ( currPackage ) |
214 | currPackage->setPackageSize( value ); | 222 | currPackage->setPackageSize( value ); |
215 | } | 223 | } |
diff --git a/noncore/settings/aqpkg/server.h b/noncore/settings/aqpkg/server.h index 02746e0..f524ed6 100644 --- a/noncore/settings/aqpkg/server.h +++ b/noncore/settings/aqpkg/server.h | |||
@@ -1,66 +1,79 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | server.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This file is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
8 | 29 | ||
9 | /*************************************************************************** | ||
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | #ifndef SERVER_H | 30 | #ifndef SERVER_H |
18 | #define SERVER_H | 31 | #define SERVER_H |
19 | 32 | ||
20 | #include <qlist.h> | 33 | #include <qlist.h> |
21 | #include <qstring.h> | 34 | #include <qstring.h> |
22 | 35 | ||
23 | using namespace std; | 36 | using namespace std; |
24 | 37 | ||
25 | #include "package.h" | 38 | #include "package.h" |
26 | #include "destination.h" | 39 | #include "destination.h" |
27 | 40 | ||
28 | class Server | 41 | class Server |
29 | { | 42 | { |
30 | public: | 43 | public: |
31 | Server() {} | 44 | Server() {} |
32 | Server( const char *name, const char *url ); | 45 | Server( const char *name, const char *url ); |
33 | Server( const char *name, const char *url, const char *file ); | 46 | Server( const char *name, const char *url, const char *file ); |
34 | ~Server(); | 47 | ~Server(); |
35 | 48 | ||
36 | void cleanUp(); | 49 | void cleanUp(); |
37 | 50 | ||
38 | void readStatusFile( QList<Destination> &v ); | 51 | void readStatusFile( QList<Destination> &v ); |
39 | void readLocalIpks( Server *local ); | 52 | void readLocalIpks( Server *local ); |
40 | void readPackageFile( Server *local = 0, bool clearAll = true, bool installedToRoot= false, Destination *dest = 0 ); | 53 | void readPackageFile( Server *local = 0, bool clearAll = true, bool installedToRoot= false, Destination *dest = 0 ); |
41 | void buildLocalPackages( Server *local ); | 54 | void buildLocalPackages( Server *local ); |
42 | Package *getPackage( const char *name ); | 55 | Package *getPackage( const char *name ); |
43 | Package *getPackage( QString &name ); | 56 | Package *getPackage( QString &name ); |
44 | QString toString(); | 57 | QString toString(); |
45 | QList<Package> &getPackageList(); | 58 | QList<Package> &getPackageList(); |
46 | bool isServerActive() { return active; } | 59 | bool isServerActive() { return active; } |
47 | 60 | ||
48 | void setServerName( const QString &name ) { serverName = name; } | 61 | void setServerName( const QString &name ) { serverName = name; } |
49 | void setServerUrl( const QString &url ) { serverUrl = url; } | 62 | void setServerUrl( const QString &url ) { serverUrl = url; } |
50 | void setActive( bool val ) { active = val; } | 63 | void setActive( bool val ) { active = val; } |
51 | QString &getServerName() { return serverName; } | 64 | QString &getServerName() { return serverName; } |
52 | QString &getServerUrl() { return serverUrl; } | 65 | QString &getServerUrl() { return serverUrl; } |
53 | 66 | ||
54 | protected: | 67 | protected: |
55 | 68 | ||
56 | private: | 69 | private: |
57 | QString serverName; | 70 | QString serverName; |
58 | QString serverUrl; | 71 | QString serverUrl; |
59 | QString packageFile; | 72 | QString packageFile; |
60 | bool active; | 73 | bool active; |
61 | 74 | ||
62 | 75 | ||
63 | QList<Package> packageList; | 76 | QList<Package> packageList; |
64 | }; | 77 | }; |
65 | 78 | ||
66 | #endif | 79 | #endif |
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp index e2afada..4887ceb 100644 --- a/noncore/settings/aqpkg/settingsimpl.cpp +++ b/noncore/settings/aqpkg/settingsimpl.cpp | |||
@@ -1,144 +1,156 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | settingsimpl.cpp - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Thu Aug 29 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
17 | 29 | ||
18 | #include <fstream> | 30 | #include <fstream> |
19 | #include <algorithm> | 31 | #include <algorithm> |
20 | using namespace std; | 32 | using namespace std; |
21 | 33 | ||
22 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
23 | #include <qgroupbox.h> | 35 | #include <qgroupbox.h> |
24 | #include <qlabel.h> | 36 | #include <qlabel.h> |
25 | #include <qlayout.h> | 37 | #include <qlayout.h> |
26 | #include <qlineedit.h> | 38 | #include <qlineedit.h> |
27 | #include <qlistbox.h> | 39 | #include <qlistbox.h> |
28 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
29 | 41 | ||
30 | #include <opie/otabwidget.h> | 42 | #include <opie/otabwidget.h> |
31 | 43 | ||
32 | #ifdef QWS | 44 | #ifdef QWS |
33 | #include <qpe/config.h> | 45 | #include <qpe/config.h> |
34 | #include <qpe/resource.h> | 46 | #include <qpe/resource.h> |
35 | #endif | 47 | #endif |
36 | 48 | ||
37 | #include "settingsimpl.h" | 49 | #include "settingsimpl.h" |
38 | 50 | ||
39 | #include "global.h" | 51 | #include "global.h" |
40 | 52 | ||
41 | SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) | 53 | SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) |
42 | : QDialog( parent, name, modal, fl ) | 54 | : QDialog( parent, name, modal, fl ) |
43 | { | 55 | { |
44 | setCaption( tr( "Configuration" ) ); | 56 | setCaption( tr( "Configuration" ) ); |
45 | 57 | ||
46 | // Setup layout to make everything pretty | 58 | // Setup layout to make everything pretty |
47 | QVBoxLayout *layout = new QVBoxLayout( this ); | 59 | QVBoxLayout *layout = new QVBoxLayout( this ); |
48 | layout->setMargin( 2 ); | 60 | layout->setMargin( 2 ); |
49 | layout->setSpacing( 4 ); | 61 | layout->setSpacing( 4 ); |
50 | 62 | ||
51 | // Setup tabs for all info | 63 | // Setup tabs for all info |
52 | OTabWidget *tabwidget = new OTabWidget( this ); | 64 | OTabWidget *tabwidget = new OTabWidget( this ); |
53 | layout->addWidget( tabwidget ); | 65 | layout->addWidget( tabwidget ); |
54 | 66 | ||
55 | tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) ); | 67 | tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) ); |
56 | tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); | 68 | tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); |
57 | tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); | 69 | tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); |
58 | tabwidget->setCurrentTab( tr( "Servers" ) ); | 70 | tabwidget->setCurrentTab( tr( "Servers" ) ); |
59 | 71 | ||
60 | dataMgr = dataManager; | 72 | dataMgr = dataManager; |
61 | setupData(); | 73 | setupData(); |
62 | changed = false; | 74 | changed = false; |
63 | newserver = false; | 75 | newserver = false; |
64 | newdestination = false; | 76 | newdestination = false; |
65 | } | 77 | } |
66 | 78 | ||
67 | SettingsImpl :: ~SettingsImpl() | 79 | SettingsImpl :: ~SettingsImpl() |
68 | { | 80 | { |
69 | 81 | ||
70 | } | 82 | } |
71 | 83 | ||
72 | bool SettingsImpl :: showDlg() | 84 | bool SettingsImpl :: showDlg() |
73 | { | 85 | { |
74 | showMaximized(); | 86 | showMaximized(); |
75 | exec(); | 87 | exec(); |
76 | 88 | ||
77 | if ( changed ) | 89 | if ( changed ) |
78 | dataMgr->writeOutIpkgConf(); | 90 | dataMgr->writeOutIpkgConf(); |
79 | 91 | ||
80 | return changed; | 92 | return changed; |
81 | } | 93 | } |
82 | 94 | ||
83 | QWidget *SettingsImpl :: initServerTab() | 95 | QWidget *SettingsImpl :: initServerTab() |
84 | { | 96 | { |
85 | QWidget *control = new QWidget( this ); | 97 | QWidget *control = new QWidget( this ); |
86 | 98 | ||
87 | QVBoxLayout *vb = new QVBoxLayout( control ); | 99 | QVBoxLayout *vb = new QVBoxLayout( control ); |
88 | 100 | ||
89 | QScrollView *sv = new QScrollView( control ); | 101 | QScrollView *sv = new QScrollView( control ); |
90 | vb->addWidget( sv, 0, 0 ); | 102 | vb->addWidget( sv, 0, 0 ); |
91 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 103 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
92 | sv->setFrameStyle( QFrame::NoFrame ); | 104 | sv->setFrameStyle( QFrame::NoFrame ); |
93 | 105 | ||
94 | QWidget *container = new QWidget( sv->viewport() ); | 106 | QWidget *container = new QWidget( sv->viewport() ); |
95 | sv->addChild( container ); | 107 | sv->addChild( container ); |
96 | 108 | ||
97 | QGridLayout *layout = new QGridLayout( container ); | 109 | QGridLayout *layout = new QGridLayout( container ); |
98 | layout->setSpacing( 2 ); | 110 | layout->setSpacing( 2 ); |
99 | layout->setMargin( 4 ); | 111 | layout->setMargin( 4 ); |
100 | 112 | ||
101 | servers = new QListBox( container ); | 113 | servers = new QListBox( container ); |
102 | servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 114 | servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
103 | connect( servers, SIGNAL( highlighted( int ) ), this, SLOT( editServer( int ) ) ); | 115 | connect( servers, SIGNAL( highlighted( int ) ), this, SLOT( editServer( int ) ) ); |
104 | layout->addMultiCellWidget( servers, 0, 0, 0, 1 ); | 116 | layout->addMultiCellWidget( servers, 0, 0, 0, 1 ); |
105 | 117 | ||
106 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); | 118 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); |
107 | connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) ); | 119 | connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) ); |
108 | layout->addWidget( btn, 1, 0 ); | 120 | layout->addWidget( btn, 1, 0 ); |
109 | 121 | ||
110 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 122 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); |
111 | connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) ); | 123 | connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) ); |
112 | layout->addWidget( btn, 1, 1 ); | 124 | layout->addWidget( btn, 1, 1 ); |
113 | 125 | ||
114 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); | 126 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); |
115 | grpbox->layout()->setSpacing( 2 ); | 127 | grpbox->layout()->setSpacing( 2 ); |
116 | grpbox->layout()->setMargin( 4 ); | 128 | grpbox->layout()->setMargin( 4 ); |
117 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); | 129 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); |
118 | 130 | ||
119 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); | 131 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); |
120 | 132 | ||
121 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); | 133 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); |
122 | grplayout->addWidget( label, 0, 0 ); | 134 | grplayout->addWidget( label, 0, 0 ); |
123 | servername = new QLineEdit( grpbox ); | 135 | servername = new QLineEdit( grpbox ); |
124 | grplayout->addWidget( servername, 0, 1 ); | 136 | grplayout->addWidget( servername, 0, 1 ); |
125 | 137 | ||
126 | label = new QLabel( tr( "Address:" ), grpbox ); | 138 | label = new QLabel( tr( "Address:" ), grpbox ); |
127 | grplayout->addWidget( label, 1, 0 ); | 139 | grplayout->addWidget( label, 1, 0 ); |
128 | serverurl = new QLineEdit( grpbox ); | 140 | serverurl = new QLineEdit( grpbox ); |
129 | grplayout->addWidget( serverurl, 1, 1 ); | 141 | grplayout->addWidget( serverurl, 1, 1 ); |
130 | 142 | ||
131 | active = new QCheckBox( tr( "Active Server" ), grpbox ); | 143 | active = new QCheckBox( tr( "Active Server" ), grpbox ); |
132 | grplayout->addMultiCellWidget( active, 2, 2, 0, 1 ); | 144 | grplayout->addMultiCellWidget( active, 2, 2, 0, 1 ); |
133 | 145 | ||
134 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); | 146 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); |
135 | connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) ); | 147 | connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) ); |
136 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); | 148 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); |
137 | 149 | ||
138 | return control; | 150 | return control; |
139 | } | 151 | } |
140 | 152 | ||
141 | QWidget *SettingsImpl :: initDestinationTab() | 153 | QWidget *SettingsImpl :: initDestinationTab() |
142 | { | 154 | { |
143 | QWidget *control = new QWidget( this ); | 155 | QWidget *control = new QWidget( this ); |
144 | 156 | ||
diff --git a/noncore/settings/aqpkg/settingsimpl.h b/noncore/settings/aqpkg/settingsimpl.h index 9ffc259..1530ce1 100644 --- a/noncore/settings/aqpkg/settingsimpl.h +++ b/noncore/settings/aqpkg/settingsimpl.h | |||
@@ -1,77 +1,89 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | settingsimpl.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Thu Aug 29 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This file is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
8 | 27 | ||
9 | /*************************************************************************** | 28 | */ |
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | 29 | ||
18 | #include "datamgr.h" | 30 | #include "datamgr.h" |
19 | 31 | ||
20 | #include <qdialog.h> | 32 | #include <qdialog.h> |
21 | 33 | ||
22 | class QCheckBox; | 34 | class QCheckBox; |
23 | class QLineEdit; | 35 | class QLineEdit; |
24 | class QListBox; | 36 | class QListBox; |
25 | 37 | ||
26 | class SettingsImpl : public QDialog | 38 | class SettingsImpl : public QDialog |
27 | { | 39 | { |
28 | Q_OBJECT | 40 | Q_OBJECT |
29 | public: | 41 | public: |
30 | SettingsImpl( DataManager *dataManager, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 42 | SettingsImpl( DataManager *dataManager, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
31 | ~SettingsImpl(); | 43 | ~SettingsImpl(); |
32 | 44 | ||
33 | bool showDlg(); | 45 | bool showDlg(); |
34 | 46 | ||
35 | private: | 47 | private: |
36 | QListBox *servers; | 48 | QListBox *servers; |
37 | QLineEdit *servername; | 49 | QLineEdit *servername; |
38 | QLineEdit *serverurl; | 50 | QLineEdit *serverurl; |
39 | QCheckBox *active; | 51 | QCheckBox *active; |
40 | QListBox *destinations; | 52 | QListBox *destinations; |
41 | QLineEdit *destinationname; | 53 | QLineEdit *destinationname; |
42 | QLineEdit *destinationurl; | 54 | QLineEdit *destinationurl; |
43 | QCheckBox *linkToRoot; | 55 | QCheckBox *linkToRoot; |
44 | QLineEdit *txtHttpProxy; | 56 | QLineEdit *txtHttpProxy; |
45 | QCheckBox *chkHttpProxyEnabled; | 57 | QCheckBox *chkHttpProxyEnabled; |
46 | QLineEdit *txtFtpProxy; | 58 | QLineEdit *txtFtpProxy; |
47 | QCheckBox *chkFtpProxyEnabled; | 59 | QCheckBox *chkFtpProxyEnabled; |
48 | QLineEdit *txtUsername; | 60 | QLineEdit *txtUsername; |
49 | QLineEdit *txtPassword; | 61 | QLineEdit *txtPassword; |
50 | 62 | ||
51 | DataManager *dataMgr; | 63 | DataManager *dataMgr; |
52 | QString serverName; | 64 | QString serverName; |
53 | QString destinationName; | 65 | QString destinationName; |
54 | int currentSelectedServer; | 66 | int currentSelectedServer; |
55 | int currentSelectedDestination; | 67 | int currentSelectedDestination; |
56 | bool changed; | 68 | bool changed; |
57 | bool newserver; | 69 | bool newserver; |
58 | bool newdestination; | 70 | bool newdestination; |
59 | 71 | ||
60 | QWidget *initServerTab(); | 72 | QWidget *initServerTab(); |
61 | QWidget *initDestinationTab(); | 73 | QWidget *initDestinationTab(); |
62 | QWidget *initProxyTab(); | 74 | QWidget *initProxyTab(); |
63 | 75 | ||
64 | void setupConnections(); | 76 | void setupConnections(); |
65 | void setupData(); | 77 | void setupData(); |
66 | 78 | ||
67 | public slots: | 79 | public slots: |
68 | void editServer( int s ); | 80 | void editServer( int s ); |
69 | void changeServerDetails(); | 81 | void changeServerDetails(); |
70 | void newServer(); | 82 | void newServer(); |
71 | void removeServer(); | 83 | void removeServer(); |
72 | void editDestination( int s ); | 84 | void editDestination( int s ); |
73 | void changeDestinationDetails(); | 85 | void changeDestinationDetails(); |
74 | void newDestination(); | 86 | void newDestination(); |
75 | void removeDestination(); | 87 | void removeDestination(); |
76 | void proxyApplyChanges(); | 88 | void proxyApplyChanges(); |
77 | }; | 89 | }; |
diff --git a/noncore/settings/aqpkg/utils.cpp b/noncore/settings/aqpkg/utils.cpp index 446ce39..00607dd 100644 --- a/noncore/settings/aqpkg/utils.cpp +++ b/noncore/settings/aqpkg/utils.cpp | |||
@@ -1,96 +1,105 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | utils.cpp - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Sat Sep 7 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
17 | 29 | ||
18 | #include <stdio.h> | 30 | #include <stdio.h> |
19 | #include <sys/vfs.h> | 31 | #include <sys/vfs.h> |
20 | //#include <mntent.h> | ||
21 | 32 | ||
22 | #include "utils.h" | 33 | #include "utils.h" |
23 | #include "global.h" | 34 | #include "global.h" |
24 | 35 | ||
25 | Utils :: Utils() | 36 | Utils :: Utils() |
26 | { | 37 | { |
27 | } | 38 | } |
28 | 39 | ||
29 | Utils :: ~Utils() | 40 | Utils :: ~Utils() |
30 | { | 41 | { |
31 | } | 42 | } |
32 | 43 | ||
33 | |||
34 | QString Utils :: getPathfromIpkFilename( const QString &file ) | 44 | QString Utils :: getPathfromIpkFilename( const QString &file ) |
35 | { | 45 | { |
36 | int p = file.findRev( "/" ); | 46 | int p = file.findRev( "/" ); |
37 | QString path = ""; | 47 | QString path = ""; |
38 | if ( p != -1 ) | 48 | if ( p != -1 ) |
39 | path = file.left( p ); | 49 | path = file.left( p ); |
40 | 50 | ||
41 | return path; | 51 | return path; |
42 | 52 | ||
43 | } | 53 | } |
44 | 54 | ||
45 | QString Utils :: getFilenameFromIpkFilename( const QString &file ) | 55 | QString Utils :: getFilenameFromIpkFilename( const QString &file ) |
46 | { | 56 | { |
47 | int p = file.findRev( "/" ); | 57 | int p = file.findRev( "/" ); |
48 | QString name = file; | 58 | QString name = file; |
49 | if ( p != -1 ) | 59 | if ( p != -1 ) |
50 | name = name.mid( p + 1 ); | 60 | name = name.mid( p + 1 ); |
51 | 61 | ||
52 | 62 | ||
53 | return name; | 63 | return name; |
54 | } | 64 | } |
55 | 65 | ||
56 | QString Utils :: getPackageNameFromIpkFilename( const QString &file ) | 66 | QString Utils :: getPackageNameFromIpkFilename( const QString &file ) |
57 | { | 67 | { |
58 | int p = file.findRev( "/" ); | 68 | int p = file.findRev( "/" ); |
59 | QString name = file; | 69 | QString name = file; |
60 | if ( p != -1 ) | 70 | if ( p != -1 ) |
61 | name = name.mid( p + 1 ); | 71 | name = name.mid( p + 1 ); |
62 | p = name.find( "_" ); | 72 | p = name.find( "_" ); |
63 | QString packageName = name.mid( 0, p ); | 73 | QString packageName = name.mid( 0, p ); |
64 | return packageName; | 74 | return packageName; |
65 | } | 75 | } |
66 | 76 | ||
67 | QString Utils :: getPackageVersionFromIpkFilename( const QString &file ) | 77 | QString Utils :: getPackageVersionFromIpkFilename( const QString &file ) |
68 | { | 78 | { |
69 | int p = file.findRev( "/" ); | 79 | int p = file.findRev( "/" ); |
70 | QString name = file; | 80 | QString name = file; |
71 | if ( p != -1 ) | 81 | if ( p != -1 ) |
72 | name = name.mid( p + 1 ); | 82 | name = name.mid( p + 1 ); |
73 | p = name.find( "_" ) + 1; | 83 | p = name.find( "_" ) + 1; |
74 | int p2 = name.find( "_", p ); | 84 | int p2 = name.find( "_", p ); |
75 | QString version = name.mid( p, p2 - p ); | 85 | QString version = name.mid( p, p2 - p ); |
76 | return version; | 86 | return version; |
77 | } | 87 | } |
78 | 88 | ||
79 | 89 | ||
80 | bool Utils :: getStorageSpace( const char *path, long *blockSize, long *totalBlocks, long *availBlocks ) | 90 | bool Utils :: getStorageSpace( const char *path, long *blockSize, long *totalBlocks, long *availBlocks ) |
81 | { | 91 | { |
82 | bool ret = false; | 92 | bool ret = false; |
83 | 93 | ||
84 | // qDebug( "Reading from path %s", path ); | ||
85 | struct statfs fs; | 94 | struct statfs fs; |
86 | if ( !statfs( path, &fs ) ) | 95 | if ( !statfs( path, &fs ) ) |
87 | { | 96 | { |
88 | *blockSize = fs.f_bsize; | 97 | *blockSize = fs.f_bsize; |
89 | *totalBlocks = fs.f_blocks; | 98 | *totalBlocks = fs.f_blocks; |
90 | *availBlocks = fs.f_bavail; | 99 | *availBlocks = fs.f_bavail; |
91 | ret = true; | 100 | ret = true; |
92 | } | 101 | } |
93 | 102 | ||
94 | return ret; | 103 | return ret; |
95 | } | 104 | } |
96 | 105 | ||
diff --git a/noncore/settings/aqpkg/utils.h b/noncore/settings/aqpkg/utils.h index c572f7b..6e5116e 100644 --- a/noncore/settings/aqpkg/utils.h +++ b/noncore/settings/aqpkg/utils.h | |||
@@ -1,39 +1,51 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | utils.h - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Sat Sep 7 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This file is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
8 | 27 | ||
9 | /*************************************************************************** | 28 | */ |
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | 29 | ||
18 | #ifndef UTILS_H | 30 | #ifndef UTILS_H |
19 | #define UTILS_H | 31 | #define UTILS_H |
20 | 32 | ||
21 | #include <qstring.h> | 33 | #include <qstring.h> |
22 | 34 | ||
23 | /** | 35 | /** |
24 | *@author Andy Qua | 36 | *@author Andy Qua |
25 | */ | 37 | */ |
26 | 38 | ||
27 | class Utils { | 39 | class Utils { |
28 | public: | 40 | public: |
29 | Utils(); | 41 | Utils(); |
30 | ~Utils(); | 42 | ~Utils(); |
31 | 43 | ||
32 | static QString getPathfromIpkFilename( const QString &file ); | 44 | static QString getPathfromIpkFilename( const QString &file ); |
33 | static QString getFilenameFromIpkFilename( const QString &file ); | 45 | static QString getFilenameFromIpkFilename( const QString &file ); |
34 | static QString getPackageNameFromIpkFilename( const QString &file ); | 46 | static QString getPackageNameFromIpkFilename( const QString &file ); |
35 | static QString getPackageVersionFromIpkFilename( const QString &file ); | 47 | static QString getPackageVersionFromIpkFilename( const QString &file ); |
36 | static bool getStorageSpace( const char *path, long *blockSize, long *totalBlocks, long *availBlocks ); | 48 | static bool getStorageSpace( const char *path, long *blockSize, long *totalBlocks, long *availBlocks ); |
37 | }; | 49 | }; |
38 | 50 | ||
39 | #endif | 51 | #endif |