summaryrefslogtreecommitdiff
path: root/noncore
authorandyq <andyq>2002-11-21 18:11:40 (UTC)
committer andyq <andyq>2002-11-21 18:11:40 (UTC)
commit5e806f161bc0bde64d5058dab4850c45aeba2cdf (patch) (unidiff)
treee93f10fe052da154b1cfe42bdbf5f29ef8749bc4 /noncore
parent5b0e9483f45967da95dc05d770197c631b959070 (diff)
downloadopie-5e806f161bc0bde64d5058dab4850c45aeba2cdf.zip
opie-5e806f161bc0bde64d5058dab4850c45aeba2cdf.tar.gz
opie-5e806f161bc0bde64d5058dab4850c45aeba2cdf.tar.bz2
Fixed bug where installed and local ipkg servers weren't shown (hopefully)
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp1
-rw-r--r--noncore/settings/aqpkg/server.cpp1
2 files changed, 2 insertions, 0 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 0814121..cf94628 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -49,96 +49,97 @@ extern int compareVersions( const char *v1, const char *v2 );
49NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) 49NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name)
50 : QWidget(parent, name) 50 : QWidget(parent, name)
51{ 51{
52 dataMgr = dataManager; 52 dataMgr = dataManager;
53 53
54#ifdef QWS 54#ifdef QWS
55 // read download directory from config file 55 // read download directory from config file
56 Config cfg( "aqpkg" ); 56 Config cfg( "aqpkg" );
57 cfg.setGroup( "settings" ); 57 cfg.setGroup( "settings" );
58 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); 58 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
59 showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); 59 showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
60 60
61#endif 61#endif
62 62
63 showUninstalledPkgs = false; 63 showUninstalledPkgs = false;
64 showInstalledPkgs = false; 64 showInstalledPkgs = false;
65 showUpgradedPkgs = false; 65 showUpgradedPkgs = false;
66 categoryFilterEnabled = false; 66 categoryFilterEnabled = false;
67 67
68 initGui(); 68 initGui();
69 setupConnections(); 69 setupConnections();
70 70
71 updateData(); 71 updateData();
72} 72}
73 73
74NetworkPackageManager::~NetworkPackageManager() 74NetworkPackageManager::~NetworkPackageManager()
75{ 75{
76} 76}
77 77
78void NetworkPackageManager :: timerEvent ( QTimerEvent * ) 78void NetworkPackageManager :: timerEvent ( QTimerEvent * )
79{ 79{
80 killTimer( timerId ); 80 killTimer( timerId );
81 81
82 // Add server names to listbox 82 // Add server names to listbox
83 updateData(); 83 updateData();
84} 84}
85 85
86void NetworkPackageManager :: updateData() 86void NetworkPackageManager :: updateData()
87{ 87{
88 serversList->clear(); 88 serversList->clear();
89 packagesList->clear(); 89 packagesList->clear();
90 90
91 91
92 vector<Server>::iterator it; 92 vector<Server>::iterator it;
93 int activeItem = -1; 93 int activeItem = -1;
94 int i; 94 int i;
95 for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) 95 for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i )
96 { 96 {
97 cout << "Adding " << it->getServerName() << " to combobox" << endl;
97 if ( !it->isServerActive() ) 98 if ( !it->isServerActive() )
98 { 99 {
99 i--; 100 i--;
100 continue; 101 continue;
101 } 102 }
102 serversList->insertItem( it->getServerName() ); 103 serversList->insertItem( it->getServerName() );
103 if ( it->getServerName() == currentlySelectedServer ) 104 if ( it->getServerName() == currentlySelectedServer )
104 activeItem = i; 105 activeItem = i;
105 } 106 }
106 107
107 // set selected server to be active server 108 // set selected server to be active server
108 if ( activeItem != -1 ) 109 if ( activeItem != -1 )
109 serversList->setCurrentItem( activeItem ); 110 serversList->setCurrentItem( activeItem );
110 serverSelected( 0 ); 111 serverSelected( 0 );
111} 112}
112 113
113void NetworkPackageManager :: selectLocalPackage( const QString &pkg ) 114void NetworkPackageManager :: selectLocalPackage( const QString &pkg )
114{ 115{
115 // First select local server 116 // First select local server
116 for ( int i = 0 ; i < serversList->count() ; ++i ) 117 for ( int i = 0 ; i < serversList->count() ; ++i )
117 { 118 {
118 if ( serversList->text( i ) == LOCAL_IPKGS ) 119 if ( serversList->text( i ) == LOCAL_IPKGS )
119 { 120 {
120 serversList->setCurrentItem( i ); 121 serversList->setCurrentItem( i );
121 break; 122 break;
122 } 123 }
123 } 124 }
124 serverSelected( 0 ); 125 serverSelected( 0 );
125 126
126 // Now set the check box of the selected package 127 // Now set the check box of the selected package
127 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 128 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
128 item != 0 ; 129 item != 0 ;
129 item = (QCheckListItem *)item->nextSibling() ) 130 item = (QCheckListItem *)item->nextSibling() )
130 { 131 {
131 if ( item->text().startsWith( pkg ) ) 132 if ( item->text().startsWith( pkg ) )
132 { 133 {
133 item->setOn( true ); 134 item->setOn( true );
134 break; 135 break;
135 } 136 }
136 } 137 }
137} 138}
138 139
139 140
140void NetworkPackageManager :: initGui() 141void NetworkPackageManager :: initGui()
141{ 142{
142 QLabel *l = new QLabel( "Servers", this ); 143 QLabel *l = new QLabel( "Servers", this );
143 serversList = new QComboBox( this ); 144 serversList = new QComboBox( this );
144 packagesList = new QListView( this ); 145 packagesList = new QListView( this );
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp
index 726cf00..58407d5 100644
--- a/noncore/settings/aqpkg/server.cpp
+++ b/noncore/settings/aqpkg/server.cpp
@@ -1,95 +1,96 @@
1/*************************************************************************** 1/***************************************************************************
2 server.cpp - description 2 server.cpp - description
3 ------------------- 3 -------------------
4 begin : Mon Aug 26 2002 4 begin : Mon Aug 26 2002
5 copyright : (C) 2002 by Andy Qua 5 copyright : (C) 2002 by Andy Qua
6 email : andy.qua@blueyonder.co.uk 6 email : andy.qua@blueyonder.co.uk
7 description : This class holds details about a server 7 description : This class holds details about a server
8 : e.g. all the packages that contained on the server 8 : e.g. all the packages that contained on the server
9 : the installation status 9 : the installation status
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * * 13 * *
14 * This program is free software; you can redistribute it and/or modify * 14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by * 15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or * 16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. * 17 * (at your option) any later version. *
18 * * 18 * *
19 ***************************************************************************/ 19 ***************************************************************************/
20 20
21 21
22#include <stdio.h> 22#include <stdio.h>
23#include <string.h> 23#include <string.h>
24#include <stdlib.h> 24#include <stdlib.h>
25 25
26#include <iostream> 26#include <iostream>
27#include <fstream> 27#include <fstream>
28using namespace std; 28using namespace std;
29 29
30#include "server.h" 30#include "server.h"
31#include "datamgr.h" 31#include "datamgr.h"
32 32
33#ifdef QWS 33#ifdef QWS
34#include <qpe/global.h> 34#include <qpe/global.h>
35#include <qpe/applnk.h> 35#include <qpe/applnk.h>
36#include <qlist.h> 36#include <qlist.h>
37#endif 37#endif
38 38
39#include "utils.h" 39#include "utils.h"
40 40
41#include "global.h" 41#include "global.h"
42 42
43Server :: Server( const char *name, const char *url ) 43Server :: Server( const char *name, const char *url )
44{ 44{
45 serverName = name; 45 serverName = name;
46 serverUrl = url; 46 serverUrl = url;
47 packageFile = IPKG_DIR; 47 packageFile = IPKG_DIR;
48 active = true;
48 packageFile += "lists/" + serverName; 49 packageFile += "lists/" + serverName;
49} 50}
50 51
51Server :: ~Server() 52Server :: ~Server()
52{ 53{
53 cleanUp(); 54 cleanUp();
54} 55}
55 56
56void Server :: cleanUp() 57void Server :: cleanUp()
57{ 58{
58 packageList.clear(); 59 packageList.clear();
59} 60}
60 61
61void Server :: readStatusFile( vector<Destination> &destList ) 62void Server :: readStatusFile( vector<Destination> &destList )
62{ 63{
63 cleanUp(); 64 cleanUp();
64 65
65 vector<Destination>::iterator dit; 66 vector<Destination>::iterator dit;
66 bool rootRead = false; 67 bool rootRead = false;
67 for ( dit = destList.begin() ; dit != destList.end() ; ++dit ) 68 for ( dit = destList.begin() ; dit != destList.end() ; ++dit )
68 { 69 {
69 bool installingToRoot = false; 70 bool installingToRoot = false;
70 71
71 QString path = dit->getDestinationPath(); 72 QString path = dit->getDestinationPath();
72 if ( path.right( 1 ) != "/" ) 73 if ( path.right( 1 ) != "/" )
73 path += "/"; 74 path += "/";
74 75
75 if ( path == "/" ) 76 if ( path == "/" )
76 { 77 {
77 rootRead = true; 78 rootRead = true;
78 installingToRoot = true; 79 installingToRoot = true;
79 } 80 }
80 81
81 packageFile = path + "usr/lib/ipkg/status"; 82 packageFile = path + "usr/lib/ipkg/status";
82 readPackageFile( 0, false, installingToRoot, dit ); 83 readPackageFile( 0, false, installingToRoot, dit );
83 } 84 }
84 85
85 // Ensure that the root status file is read 86 // Ensure that the root status file is read
86 if ( !rootRead ) 87 if ( !rootRead )
87 { 88 {
88 cout << "Reading status file " << "/usr/lib/ipkg/status" << endl; 89 cout << "Reading status file " << "/usr/lib/ipkg/status" << endl;
89 packageFile = "/usr/lib/ipkg/status"; 90 packageFile = "/usr/lib/ipkg/status";
90 readPackageFile( 0, false, true ); 91 readPackageFile( 0, false, true );
91 } 92 }
92} 93}
93 94
94void Server :: readLocalIpks( Server *local ) 95void Server :: readLocalIpks( Server *local )
95{ 96{