summaryrefslogtreecommitdiff
authorandyq <andyq>2002-10-21 16:02:45 (UTC)
committer andyq <andyq>2002-10-21 16:02:45 (UTC)
commit71c7800e8ae5dc2d701242828ceb8c11bcd96fbe (patch) (unidiff)
tree5068eae7a8a4059a4092dce2101bf906761e53bf
parentbb135a644e61cbc30116b96ff8fb24dfb7576a21 (diff)
downloadopie-71c7800e8ae5dc2d701242828ceb8c11bcd96fbe.zip
opie-71c7800e8ae5dc2d701242828ceb8c11bcd96fbe.tar.gz
opie-71c7800e8ae5dc2d701242828ceb8c11bcd96fbe.tar.bz2
Changed so that there are 13 letter buttons on each line - previously N, O & P
were missing (presumed dead)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 9acaaf1..52d95a8 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -10,257 +10,257 @@
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 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 * 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 * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include <fstream> 18#include <fstream>
19#include <iostream> 19#include <iostream>
20using namespace std; 20using namespace std;
21 21
22#include <unistd.h> 22#include <unistd.h>
23#include <stdlib.h> 23#include <stdlib.h>
24#include <linux/limits.h> 24#include <linux/limits.h>
25 25
26#ifdef QWS 26#ifdef QWS
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/qcopenvelope_qws.h> 28#include <qpe/qcopenvelope_qws.h>
29#include <qpe/config.h> 29#include <qpe/config.h>
30#else 30#else
31#include <qapplication.h> 31#include <qapplication.h>
32#endif 32#endif
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qmessagebox.h> 35#include <qmessagebox.h>
36 36
37#include "datamgr.h" 37#include "datamgr.h"
38#include "networkpkgmgr.h" 38#include "networkpkgmgr.h"
39#include "installdlgimpl.h" 39#include "installdlgimpl.h"
40#include "ipkg.h" 40#include "ipkg.h"
41#include "inputdlg.h" 41#include "inputdlg.h"
42#include "letterpushbutton.h" 42#include "letterpushbutton.h"
43 43
44#include "global.h" 44#include "global.h"
45 45
46NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) 46NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name)
47 : QWidget(parent, name) 47 : QWidget(parent, name)
48{ 48{
49 dataMgr = dataManager; 49 dataMgr = dataManager;
50 50
51#ifdef QWS 51#ifdef QWS
52 // read download directory from config file 52 // read download directory from config file
53 Config cfg( "aqpkg" ); 53 Config cfg( "aqpkg" );
54 cfg.setGroup( "settings" ); 54 cfg.setGroup( "settings" );
55 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); 55 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
56 showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); 56 showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
57#endif 57#endif
58 58
59 59
60 initGui(); 60 initGui();
61 setupConnections(); 61 setupConnections();
62 62
63 progressDlg = 0; 63 progressDlg = 0;
64 timerId = startTimer( 100 ); 64 timerId = startTimer( 100 );
65} 65}
66 66
67NetworkPackageManager::~NetworkPackageManager() 67NetworkPackageManager::~NetworkPackageManager()
68{ 68{
69} 69}
70 70
71void NetworkPackageManager :: timerEvent ( QTimerEvent * ) 71void NetworkPackageManager :: timerEvent ( QTimerEvent * )
72{ 72{
73 killTimer( timerId ); 73 killTimer( timerId );
74 74
75// showProgressDialog(); 75// showProgressDialog();
76 // Add server names to listbox 76 // Add server names to listbox
77 updateData(); 77 updateData();
78 78
79// progressDlg->hide(); 79// progressDlg->hide();
80} 80}
81 81
82void NetworkPackageManager :: updateData() 82void NetworkPackageManager :: updateData()
83{ 83{
84 serversList->clear(); 84 serversList->clear();
85 packagesList->clear(); 85 packagesList->clear();
86 86
87 87
88 vector<Server>::iterator it; 88 vector<Server>::iterator it;
89 int activeItem = -1; 89 int activeItem = -1;
90 int i; 90 int i;
91 for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) 91 for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i )
92 { 92 {
93 if ( !it->isServerActive() ) 93 if ( !it->isServerActive() )
94 { 94 {
95 i--; 95 i--;
96 continue; 96 continue;
97 } 97 }
98 serversList->insertItem( it->getServerName() ); 98 serversList->insertItem( it->getServerName() );
99 if ( it->getServerName() == currentlySelectedServer ) 99 if ( it->getServerName() == currentlySelectedServer )
100 activeItem = i; 100 activeItem = i;
101 } 101 }
102 102
103 // set selected server to be active server 103 // set selected server to be active server
104 if ( activeItem != -1 ) 104 if ( activeItem != -1 )
105 serversList->setCurrentItem( activeItem ); 105 serversList->setCurrentItem( activeItem );
106 serverSelected( 0 ); 106 serverSelected( 0 );
107} 107}
108 108
109 109
110void NetworkPackageManager :: initGui() 110void NetworkPackageManager :: initGui()
111{ 111{
112 QLabel *l = new QLabel( "Servers", this ); 112 QLabel *l = new QLabel( "Servers", this );
113 serversList = new QComboBox( this ); 113 serversList = new QComboBox( this );
114 packagesList = new QListView( this ); 114 packagesList = new QListView( this );
115 update = new QPushButton( "Refresh List", this ); 115 update = new QPushButton( "Refresh List", this );
116 download = new QPushButton( "Download", this ); 116 download = new QPushButton( "Download", this );
117 upgrade = new QPushButton( "Upgrade", this ); 117 upgrade = new QPushButton( "Upgrade", this );
118 apply = new QPushButton( "Apply", this ); 118 apply = new QPushButton( "Apply", this );
119 119
120 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" ); 120 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" );
121 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" ); 121 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" );
122 hbox1->addWidget( l ); 122 hbox1->addWidget( l );
123 hbox1->addWidget( serversList ); 123 hbox1->addWidget( serversList );
124 124
125 QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" ); 125 QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" );
126 QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" ); 126 QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" );
127 127
128 128
129 if ( showJumpTo ) 129 if ( showJumpTo )
130 { 130 {
131 char text[2]; 131 char text[2];
132 text[1] = '\0'; 132 text[1] = '\0';
133 for ( int i = 0 ; i < 26 ; ++i ) 133 for ( int i = 0 ; i < 26 ; ++i )
134 { 134 {
135 text[0] = 'A' + i; 135 text[0] = 'A' + i;
136 LetterPushButton *b = new LetterPushButton( text, this ); 136 LetterPushButton *b = new LetterPushButton( text, this );
137 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); 137 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) );
138 if ( i < 16 ) 138 if ( i < 13 )
139 hbox3->addWidget( b ); 139 hbox3->addWidget( b );
140 else 140 else
141 hbox4->addWidget( b ); 141 hbox4->addWidget( b );
142 } 142 }
143 } 143 }
144 144
145 vbox->addWidget( packagesList ); 145 vbox->addWidget( packagesList );
146 packagesList->addColumn( "Packages" ); 146 packagesList->addColumn( "Packages" );
147 147
148 QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" ); 148 QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" );
149 hbox2->addWidget( update ); 149 hbox2->addWidget( update );
150 hbox2->addWidget( download ); 150 hbox2->addWidget( download );
151 hbox2->addWidget( upgrade ); 151 hbox2->addWidget( upgrade );
152 hbox2->addWidget( apply ); 152 hbox2->addWidget( apply );
153} 153}
154 154
155void NetworkPackageManager :: setupConnections() 155void NetworkPackageManager :: setupConnections()
156{ 156{
157 connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); 157 connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int )));
158 connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) ); 158 connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) );
159 connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) ); 159 connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) );
160 connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) ); 160 connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) );
161 connect( update, SIGNAL(released()), this, SLOT(updateServer()) ); 161 connect( update, SIGNAL(released()), this, SLOT(updateServer()) );
162} 162}
163 163
164void NetworkPackageManager :: showProgressDialog( char *initialText ) 164void NetworkPackageManager :: showProgressDialog( char *initialText )
165{ 165{
166 if ( !progressDlg ) 166 if ( !progressDlg )
167 progressDlg = new ProgressDlg( this, "Progress", false ); 167 progressDlg = new ProgressDlg( this, "Progress", false );
168 progressDlg->setText( initialText ); 168 progressDlg->setText( initialText );
169 progressDlg->show(); 169 progressDlg->show();
170} 170}
171 171
172 172
173void NetworkPackageManager :: serverSelected( int ) 173void NetworkPackageManager :: serverSelected( int )
174{ 174{
175 packagesList->clear(); 175 packagesList->clear();
176 176
177 // display packages 177 // display packages
178 QString serverName = serversList->currentText(); 178 QString serverName = serversList->currentText();
179 currentlySelectedServer = serverName; 179 currentlySelectedServer = serverName;
180 180
181#ifdef QWS 181#ifdef QWS
182 // read download directory from config file 182 // read download directory from config file
183 Config cfg( "aqpkg" ); 183 Config cfg( "aqpkg" );
184 cfg.setGroup( "settings" ); 184 cfg.setGroup( "settings" );
185 cfg.writeEntry( "selectedServer", currentlySelectedServer ); 185 cfg.writeEntry( "selectedServer", currentlySelectedServer );
186#endif 186#endif
187 187
188 Server *s = dataMgr->getServer( serverName ); 188 Server *s = dataMgr->getServer( serverName );
189// dataMgr->setActiveServer( serverName ); 189// dataMgr->setActiveServer( serverName );
190 190
191 vector<Package> &list = s->getPackageList(); 191 vector<Package> &list = s->getPackageList();
192 vector<Package>::iterator it; 192 vector<Package>::iterator it;
193 for ( it = list.begin() ; it != list.end() ; ++it ) 193 for ( it = list.begin() ; it != list.end() ; ++it )
194 { 194 {
195 QString text = ""; 195 QString text = "";
196 196
197 // If the local server, only display installed packages 197 // If the local server, only display installed packages
198 if ( serverName == LOCAL_SERVER && !it->isInstalled() ) 198 if ( serverName == LOCAL_SERVER && !it->isInstalled() )
199 continue; 199 continue;
200 200
201 text += it->getPackageName(); 201 text += it->getPackageName();
202 if ( it->isInstalled() ) 202 if ( it->isInstalled() )
203 { 203 {
204 text += " (installed)"; 204 text += " (installed)";
205 205
206 // If a different version of package is available, postfix it with an * 206 // If a different version of package is available, postfix it with an *
207 if ( it->getVersion() != it->getInstalledVersion() ) 207 if ( it->getVersion() != it->getInstalledVersion() )
208 text += "*"; 208 text += "*";
209 } 209 }
210 210
211 QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); 211 QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox );
212 212
213 if ( it->isInstalled() ) 213 if ( it->isInstalled() )
214 { 214 {
215 QString destName = ""; 215 QString destName = "";
216 if ( it->getLocalPackage() ) 216 if ( it->getLocalPackage() )
217 { 217 {
218 if ( it->getLocalPackage()->getInstalledTo() ) 218 if ( it->getLocalPackage()->getInstalledTo() )
219 destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); 219 destName = it->getLocalPackage()->getInstalledTo()->getDestinationName();
220 } 220 }
221 else 221 else
222 { 222 {
223 if ( it->getInstalledTo() ) 223 if ( it->getInstalledTo() )
224 destName = it->getInstalledTo()->getDestinationName(); 224 destName = it->getInstalledTo()->getDestinationName();
225 } 225 }
226 if ( destName != "" ) 226 if ( destName != "" )
227 new QCheckListItem( item, QString( "Installed To - " ) + destName ); 227 new QCheckListItem( item, QString( "Installed To - " ) + destName );
228 } 228 }
229 229
230 if ( !it->isPackageStoredLocally() ) 230 if ( !it->isPackageStoredLocally() )
231 new QCheckListItem( item, QString( "Description - " ) + it->getDescription() ); 231 new QCheckListItem( item, QString( "Description - " ) + it->getDescription() );
232 else 232 else
233 new QCheckListItem( item, QString( "Filename - " ) + it->getFilename() ); 233 new QCheckListItem( item, QString( "Filename - " ) + it->getFilename() );
234 234
235 new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() ); 235 new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() );
236 if ( it->getLocalPackage() ) 236 if ( it->getLocalPackage() )
237 { 237 {
238 if ( it->isInstalled() ) 238 if ( it->isInstalled() )
239 new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() ); 239 new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() );
240 } 240 }
241 packagesList->insertItem( item ); 241 packagesList->insertItem( item );
242 } 242 }
243 243
244 // If the local server or the local ipkgs server disable the download button 244 // If the local server or the local ipkgs server disable the download button
245 if ( serverName == LOCAL_SERVER ) 245 if ( serverName == LOCAL_SERVER )
246 { 246 {
247 upgrade->setEnabled( false ); 247 upgrade->setEnabled( false );
248 download->setText( "Download" ); 248 download->setText( "Download" );
249 download->setEnabled( false ); 249 download->setEnabled( false );
250 } 250 }
251 else if ( serverName == LOCAL_IPKGS ) 251 else if ( serverName == LOCAL_IPKGS )
252 { 252 {
253 upgrade->setEnabled( false ); 253 upgrade->setEnabled( false );
254 download->setEnabled( true ); 254 download->setEnabled( true );
255 download->setText( "Remove" ); 255 download->setText( "Remove" );
256 } 256 }
257 else 257 else
258 { 258 {
259 upgrade->setEnabled( true ); 259 upgrade->setEnabled( true );
260 download->setEnabled( true ); 260 download->setEnabled( true );
261 download->setText( "Download" ); 261 download->setText( "Download" );
262 } 262 }
263} 263}
264 264
265void NetworkPackageManager :: updateServer() 265void NetworkPackageManager :: updateServer()
266{ 266{