summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 91a318c..ff8f182 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -1,119 +1,120 @@
1/*************************************************************************** 1/***************************************************************************
2 networkpkgmgr.cpp - description 2 networkpkgmgr.cpp - description
3 ------------------- 3 -------------------
4 begin : Mon Aug 26 13:32:30 BST 2002 4 begin : Mon Aug 26 13:32:30 BST 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 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
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 25
25#ifdef QWS 26#ifdef QWS
26#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
27#include <qpe/qcopenvelope_qws.h> 28#include <qpe/qcopenvelope_qws.h>
28#include <qpe/config.h> 29#include <qpe/config.h>
29#else 30#else
30#include <qapplication.h> 31#include <qapplication.h>
31#endif 32#endif
32#include <qlabel.h> 33#include <qlabel.h>
33#include <qfile.h> 34#include <qfile.h>
34 35
35#include "datamgr.h" 36#include "datamgr.h"
36#include "networkpkgmgr.h" 37#include "networkpkgmgr.h"
37#include "installdlgimpl.h" 38#include "installdlgimpl.h"
38#include "ipkg.h" 39#include "ipkg.h"
39#include "inputdlg.h" 40#include "inputdlg.h"
40 41
41#include "global.h" 42#include "global.h"
42 43
43NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) 44NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name)
44 : QWidget(parent, name) 45 : QWidget(parent, name)
45{ 46{
46 dataMgr = dataManager; 47 dataMgr = dataManager;
47 48
48 initGui(); 49 initGui();
49 setupConnections(); 50 setupConnections();
50 51
51 progressDlg = 0; 52 progressDlg = 0;
52 timerId = startTimer( 100 ); 53 timerId = startTimer( 100 );
53} 54}
54 55
55NetworkPackageManager::~NetworkPackageManager() 56NetworkPackageManager::~NetworkPackageManager()
56{ 57{
57} 58}
58 59
59void NetworkPackageManager :: timerEvent ( QTimerEvent * ) 60void NetworkPackageManager :: timerEvent ( QTimerEvent * )
60{ 61{
61 killTimer( timerId ); 62 killTimer( timerId );
62 63
63// showProgressDialog(); 64// showProgressDialog();
64 // Add server names to listbox 65 // Add server names to listbox
65 updateData(); 66 updateData();
66 67
67// progressDlg->hide(); 68// progressDlg->hide();
68} 69}
69 70
70void NetworkPackageManager :: updateData() 71void NetworkPackageManager :: updateData()
71{ 72{
72 serversList->clear(); 73 serversList->clear();
73 packagesList->clear(); 74 packagesList->clear();
74 75
75 vector<Server>::iterator it; 76 vector<Server>::iterator it;
76 int activeItem = -1; 77 int activeItem = -1;
77 int i; 78 int i;
78 for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) 79 for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i )
79 { 80 {
80 serversList->insertItem( it->getServerName() ); 81 serversList->insertItem( it->getServerName() );
81 if ( it->getServerName() == dataMgr->getActiveServer() ) 82 if ( it->getServerName() == dataMgr->getActiveServer() )
82 activeItem = i; 83 activeItem = i;
83 } 84 }
84 85
85 // set selected server to be active server 86 // set selected server to be active server
86 if ( activeItem != -1 ) 87 if ( activeItem != -1 )
87 serversList->setCurrentItem( activeItem ); 88 serversList->setCurrentItem( activeItem );
88 serverSelected( 0 ); 89 serverSelected( 0 );
89} 90}
90 91
91 92
92void NetworkPackageManager :: initGui() 93void NetworkPackageManager :: initGui()
93{ 94{
94 QLabel *l = new QLabel( "Servers", this ); 95 QLabel *l = new QLabel( "Servers", this );
95 serversList = new QComboBox( this ); 96 serversList = new QComboBox( this );
96 packagesList = new QListView( this ); 97 packagesList = new QListView( this );
97 update = new QPushButton( "Refresh List", this ); 98 update = new QPushButton( "Refresh List", this );
98 download = new QPushButton( "Download", this ); 99 download = new QPushButton( "Download", this );
99 apply = new QPushButton( "Apply", this ); 100 apply = new QPushButton( "Apply", this );
100 101
101 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" ); 102 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" );
102 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" ); 103 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" );
103 hbox1->addWidget( l ); 104 hbox1->addWidget( l );
104 hbox1->addWidget( serversList ); 105 hbox1->addWidget( serversList );
105 106
106 vbox->addWidget( packagesList ); 107 vbox->addWidget( packagesList );
107 packagesList->addColumn( "Packages" ); 108 packagesList->addColumn( "Packages" );
108 109
109 QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" ); 110 QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" );
110 hbox2->addWidget( update ); 111 hbox2->addWidget( update );
111 hbox2->addWidget( download ); 112 hbox2->addWidget( download );
112 hbox2->addWidget( apply ); 113 hbox2->addWidget( apply );
113} 114}
114 115
115void NetworkPackageManager :: setupConnections() 116void NetworkPackageManager :: setupConnections()
116{ 117{
117 connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); 118 connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int )));
118 connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) ); 119 connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) );
119 connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) ); 120 connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) );