summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/settingsimpl.cpp
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg/settingsimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp
index a18a178..9dd2206 100644
--- a/noncore/settings/aqpkg/settingsimpl.cpp
+++ b/noncore/settings/aqpkg/settingsimpl.cpp
@@ -13,12 +13,13 @@
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 <algorithm>
19using namespace std; 20using namespace std;
20 21
21#include <qlistbox.h> 22#include <qlistbox.h>
22#include <qlineedit.h> 23#include <qlineedit.h>
23#include <qpushbutton.h> 24#include <qpushbutton.h>
24#include <qtabwidget.h> 25#include <qtabwidget.h>
@@ -88,13 +89,13 @@ void SettingsImpl :: setupData()
88 89
89//------------------ Servers tab ---------------------- 90//------------------ Servers tab ----------------------
90 91
91void SettingsImpl :: editServer( int sel ) 92void SettingsImpl :: editServer( int sel )
92{ 93{
93 currentSelectedServer = sel; 94 currentSelectedServer = sel;
94 Server *s = dataMgr->getServer( servers->currentText() ); 95 vector<Server>::iterator s = dataMgr->getServer( servers->currentText() );
95 serverName = s->getServerName(); 96 serverName = s->getServerName();
96 servername->setText( s->getServerName() ); 97 servername->setText( s->getServerName() );
97 serverurl->setText( s->getServerUrl() ); 98 serverurl->setText( s->getServerUrl() );
98 active->setChecked( s->isServerActive() ); 99 active->setChecked( s->isServerActive() );
99} 100}
100 101
@@ -106,26 +107,26 @@ void SettingsImpl :: newServer()
106 servername->setFocus(); 107 servername->setFocus();
107 active->setChecked( true ); 108 active->setChecked( true );
108} 109}
109 110
110void SettingsImpl :: removeServer() 111void SettingsImpl :: removeServer()
111{ 112{
112 changed = true; 113 changed = true;
113 Server *s = dataMgr->getServer( servers->currentText() ); 114 vector<Server>::iterator s = dataMgr->getServer( servers->currentText() );
114 dataMgr->getServerList().erase( s ); 115 dataMgr->getServerList().erase( s );
115 servers->removeItem( currentSelectedServer ); 116 servers->removeItem( currentSelectedServer );
116} 117}
117 118
118void SettingsImpl :: changeServerDetails() 119void SettingsImpl :: changeServerDetails()
119{ 120{
120 changed = true; 121 changed = true;
121 122
122 QString newName = servername->text(); 123 QString newName = servername->text();
123 if ( !newserver ) 124 if ( !newserver )
124 { 125 {
125 Server *s = dataMgr->getServer( serverName ); 126 vector<Server>::iterator s = dataMgr->getServer( servers->currentText() );
126 127
127 // Update url 128 // Update url
128 s->setServerUrl( serverurl->text() ); 129 s->setServerUrl( serverurl->text() );
129 s->setActive( active->isChecked() ); 130 s->setActive( active->isChecked() );
130 131
131 132
@@ -156,13 +157,13 @@ void SettingsImpl :: changeServerDetails()
156 157
157//------------------ Destinations tab ---------------------- 158//------------------ Destinations tab ----------------------
158 159
159void SettingsImpl :: editDestination( int sel ) 160void SettingsImpl :: editDestination( int sel )
160{ 161{
161 currentSelectedDestination = sel; 162 currentSelectedDestination = sel;
162 Destination *d = dataMgr->getDestination( destinations->currentText() ); 163 vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() );
163 destinationName = d->getDestinationName(); 164 destinationName = d->getDestinationName();
164 destinationname->setText( d->getDestinationName() ); 165 destinationname->setText( d->getDestinationName() );
165 destinationurl->setText( d->getDestinationPath() ); 166 destinationurl->setText( d->getDestinationPath() );
166 linkToRoot->setChecked( d->linkToRoot() ); 167 linkToRoot->setChecked( d->linkToRoot() );
167} 168}
168 169
@@ -174,15 +175,15 @@ void SettingsImpl :: newDestination()
174 destinationname->setFocus(); 175 destinationname->setFocus();
175 linkToRoot->setChecked( true ); 176 linkToRoot->setChecked( true );
176} 177}
177 178
178void SettingsImpl :: removeDestination() 179void SettingsImpl :: removeDestination()
179{ 180{
180 changed = true; 181 changed = true;
181 Destination *d = dataMgr->getDestination( destinations->currentText() ); 182 vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() );
182 dataMgr->getDestinationList().erase( d ); 183 dataMgr->getDestinationList().erase( d );
183 destinations->removeItem( currentSelectedDestination ); 184 destinations->removeItem( currentSelectedDestination );
184} 185}
185 186
186void SettingsImpl :: changeDestinationDetails() 187void SettingsImpl :: changeDestinationDetails()
187{ 188{
188 changed = true; 189 changed = true;
@@ -192,13 +193,13 @@ void SettingsImpl :: changeDestinationDetails()
192 cfg.setGroup( "destinations" ); 193 cfg.setGroup( "destinations" );
193#endif 194#endif
194 195
195 QString newName = destinationname->text(); 196 QString newName = destinationname->text();
196 if ( !newdestination ) 197 if ( !newdestination )
197 { 198 {
198 Destination *d = dataMgr->getDestination( destinationName ); 199 vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() );
199 200
200 // Update url 201 // Update url
201 d->setDestinationPath( destinationurl->text() ); 202 d->setDestinationPath( destinationurl->text() );
202 d->linkToRoot( linkToRoot->isChecked() ); 203 d->linkToRoot( linkToRoot->isChecked() );
203 204
204 // Check if server name has changed, if it has then we need to replace the key in the map 205 // Check if server name has changed, if it has then we need to replace the key in the map