summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index cf94628..e8e2982 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -33,131 +33,132 @@ using namespace std;
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#include "categoryfilterimpl.h" 43#include "categoryfilterimpl.h"
44 44
45#include "global.h" 45#include "global.h"
46 46
47extern int compareVersions( const char *v1, const char *v2 ); 47extern int compareVersions( const char *v1, const char *v2 );
48 48
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// cout << "Adding " << it->getServerName() << " to combobox" << endl;
98 if ( !it->isServerActive() ) 98 if ( !it->isServerActive() )
99 { 99 {
100 cout << it->getServerName() << " is not active" << endl;
100 i--; 101 i--;
101 continue; 102 continue;
102 } 103 }
103 serversList->insertItem( it->getServerName() ); 104 serversList->insertItem( it->getServerName() );
104 if ( it->getServerName() == currentlySelectedServer ) 105 if ( it->getServerName() == currentlySelectedServer )
105 activeItem = i; 106 activeItem = i;
106 } 107 }
107 108
108 // set selected server to be active server 109 // set selected server to be active server
109 if ( activeItem != -1 ) 110 if ( activeItem != -1 )
110 serversList->setCurrentItem( activeItem ); 111 serversList->setCurrentItem( activeItem );
111 serverSelected( 0 ); 112 serverSelected( 0 );
112} 113}
113 114
114void NetworkPackageManager :: selectLocalPackage( const QString &pkg ) 115void NetworkPackageManager :: selectLocalPackage( const QString &pkg )
115{ 116{
116 // First select local server 117 // First select local server
117 for ( int i = 0 ; i < serversList->count() ; ++i ) 118 for ( int i = 0 ; i < serversList->count() ; ++i )
118 { 119 {
119 if ( serversList->text( i ) == LOCAL_IPKGS ) 120 if ( serversList->text( i ) == LOCAL_IPKGS )
120 { 121 {
121 serversList->setCurrentItem( i ); 122 serversList->setCurrentItem( i );
122 break; 123 break;
123 } 124 }
124 } 125 }
125 serverSelected( 0 ); 126 serverSelected( 0 );
126 127
127 // Now set the check box of the selected package 128 // Now set the check box of the selected package
128 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 129 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
129 item != 0 ; 130 item != 0 ;
130 item = (QCheckListItem *)item->nextSibling() ) 131 item = (QCheckListItem *)item->nextSibling() )
131 { 132 {
132 if ( item->text().startsWith( pkg ) ) 133 if ( item->text().startsWith( pkg ) )
133 { 134 {
134 item->setOn( true ); 135 item->setOn( true );
135 break; 136 break;
136 } 137 }
137 } 138 }
138} 139}
139 140
140 141
141void NetworkPackageManager :: initGui() 142void NetworkPackageManager :: initGui()
142{ 143{
143 QLabel *l = new QLabel( "Servers", this ); 144 QLabel *l = new QLabel( "Servers", this );
144 serversList = new QComboBox( this ); 145 serversList = new QComboBox( this );
145 packagesList = new QListView( this ); 146 packagesList = new QListView( this );
146 update = new QPushButton( "Refresh Lists", this ); 147 update = new QPushButton( "Refresh Lists", this );
147 download = new QPushButton( "Download", this ); 148 download = new QPushButton( "Download", this );
148 upgrade = new QPushButton( "Upgrade", this ); 149 upgrade = new QPushButton( "Upgrade", this );
149 apply = new QPushButton( "Apply", this ); 150 apply = new QPushButton( "Apply", this );
150 151
151 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" ); 152 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" );
152 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" ); 153 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" );
153 hbox1->addWidget( l ); 154 hbox1->addWidget( l );
154 hbox1->addWidget( serversList ); 155 hbox1->addWidget( serversList );
155 156
156 QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" ); 157 QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" );
157 QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" ); 158 QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" );
158 159
159 160
160 if ( showJumpTo ) 161 if ( showJumpTo )
161 { 162 {
162 char text[2]; 163 char text[2];
163 text[1] = '\0'; 164 text[1] = '\0';