-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 2 |
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 | |||
@@ -74,129 +74,129 @@ void NetworkPackageManager :: timerEvent ( QTimerEvent * ) | |||
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 | ||
82 | void NetworkPackageManager :: updateData() | 82 | void 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 | ||
110 | void NetworkPackageManager :: initGui() | 110 | void 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 | ||
155 | void NetworkPackageManager :: setupConnections() | 155 | void 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 | ||
164 | void NetworkPackageManager :: showProgressDialog( char *initialText ) | 164 | void 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 | ||
173 | void NetworkPackageManager :: serverSelected( int ) | 173 | void 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() ) |