Diffstat (limited to 'noncore/settings/aqpkg/settingsimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/settingsimpl.cpp | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp index 81e89ed..9ee3a33 100644 --- a/noncore/settings/aqpkg/settingsimpl.cpp +++ b/noncore/settings/aqpkg/settingsimpl.cpp | |||
@@ -22,6 +22,11 @@ using namespace std; | |||
22 | #include <qlineedit.h> | 22 | #include <qlineedit.h> |
23 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
24 | #include <qtabwidget.h> | 24 | #include <qtabwidget.h> |
25 | #include <qcheckbox.h> | ||
26 | |||
27 | #ifdef QWS | ||
28 | #include <qpe/config.h> | ||
29 | #endif | ||
25 | 30 | ||
26 | #include "settingsimpl.h" | 31 | #include "settingsimpl.h" |
27 | 32 | ||
@@ -83,6 +88,7 @@ void SettingsImpl :: editServer( int sel ) | |||
83 | serverName = s->getServerName(); | 88 | serverName = s->getServerName(); |
84 | servername->setText( s->getServerName() ); | 89 | servername->setText( s->getServerName() ); |
85 | serverurl->setText( s->getServerUrl() ); | 90 | serverurl->setText( s->getServerUrl() ); |
91 | active->setChecked( s->isServerActive() ); | ||
86 | } | 92 | } |
87 | 93 | ||
88 | void SettingsImpl :: newServer() | 94 | void SettingsImpl :: newServer() |
@@ -91,6 +97,7 @@ void SettingsImpl :: newServer() | |||
91 | servername->setText( "" ); | 97 | servername->setText( "" ); |
92 | serverurl->setText( "" ); | 98 | serverurl->setText( "" ); |
93 | servername->setFocus(); | 99 | servername->setFocus(); |
100 | active->setChecked( true ); | ||
94 | } | 101 | } |
95 | 102 | ||
96 | void SettingsImpl :: removeServer() | 103 | void SettingsImpl :: removeServer() |
@@ -112,6 +119,8 @@ void SettingsImpl :: changeServerDetails() | |||
112 | 119 | ||
113 | // Update url | 120 | // Update url |
114 | s->setServerUrl( serverurl->text() ); | 121 | s->setServerUrl( serverurl->text() ); |
122 | s->setActive( active->isChecked() ); | ||
123 | |||
115 | 124 | ||
116 | // Check if server name has changed, if it has then we need to replace the key in the map | 125 | // Check if server name has changed, if it has then we need to replace the key in the map |
117 | if ( serverName != newName ) | 126 | if ( serverName != newName ) |
@@ -120,8 +129,8 @@ void SettingsImpl :: changeServerDetails() | |||
120 | s->setServerName( newName ); | 129 | s->setServerName( newName ); |
121 | 130 | ||
122 | // See if this server is the active server | 131 | // See if this server is the active server |
123 | if ( dataMgr->getActiveServer() == serverName ) | 132 | // if ( dataMgr->getActiveServer() == serverName ) |
124 | dataMgr->setActiveServer( newName ); | 133 | // dataMgr->setActiveServer( newName ); |
125 | 134 | ||
126 | // Update list box | 135 | // Update list box |
127 | servers->changeItem( newName, currentSelectedServer ); | 136 | servers->changeItem( newName, currentSelectedServer ); |
@@ -129,7 +138,9 @@ void SettingsImpl :: changeServerDetails() | |||
129 | } | 138 | } |
130 | else | 139 | else |
131 | { | 140 | { |
132 | dataMgr->getServerList().push_back( Server( newName, serverurl->text() ) ); | 141 | Server s( newName, serverurl->text() ); |
142 | dataMgr->getServerList().push_back( Server( newName, serverurl->text() ) ); | ||
143 | dataMgr->getServerList().end()->setActive( active->isChecked() ); | ||
133 | servers->insertItem( newName ); | 144 | servers->insertItem( newName ); |
134 | servers->setCurrentItem( servers->count() ); | 145 | servers->setCurrentItem( servers->count() ); |
135 | newserver = false; | 146 | newserver = false; |
@@ -141,10 +152,11 @@ void SettingsImpl :: changeServerDetails() | |||
141 | void SettingsImpl :: editDestination( int sel ) | 152 | void SettingsImpl :: editDestination( int sel ) |
142 | { | 153 | { |
143 | currentSelectedDestination = sel; | 154 | currentSelectedDestination = sel; |
144 | Destination *s = dataMgr->getDestination( destinations->currentText() ); | 155 | Destination *d = dataMgr->getDestination( destinations->currentText() ); |
145 | destinationName = s->getDestinationName(); | 156 | destinationName = d->getDestinationName(); |
146 | destinationname->setText( s->getDestinationName() ); | 157 | destinationname->setText( d->getDestinationName() ); |
147 | destinationurl->setText( s->getDestinationPath() ); | 158 | destinationurl->setText( d->getDestinationPath() ); |
159 | linkToRoot->setChecked( d->linkToRoot() ); | ||
148 | } | 160 | } |
149 | 161 | ||
150 | void SettingsImpl :: newDestination() | 162 | void SettingsImpl :: newDestination() |
@@ -153,6 +165,7 @@ void SettingsImpl :: newDestination() | |||
153 | destinationname->setText( "" ); | 165 | destinationname->setText( "" ); |
154 | destinationurl->setText( "" ); | 166 | destinationurl->setText( "" ); |
155 | destinationname->setFocus(); | 167 | destinationname->setFocus(); |
168 | linkToRoot->setChecked( true ); | ||
156 | } | 169 | } |
157 | 170 | ||
158 | void SettingsImpl :: removeDestination() | 171 | void SettingsImpl :: removeDestination() |
@@ -167,13 +180,19 @@ void SettingsImpl :: changeDestinationDetails() | |||
167 | { | 180 | { |
168 | changed = true; | 181 | changed = true; |
169 | 182 | ||
170 | QString newName = destinationname->text(); | 183 | #ifdef QWS |
184 | Config cfg( "aqpkg" ); | ||
185 | cfg.setGroup( "destinations" ); | ||
186 | #endif | ||
187 | |||
188 | QString newName = destinationname->text(); | ||
171 | if ( !newdestination ) | 189 | if ( !newdestination ) |
172 | { | 190 | { |
173 | Destination *d = dataMgr->getDestination( destinationName ); | 191 | Destination *d = dataMgr->getDestination( destinationName ); |
174 | 192 | ||
175 | // Update url | 193 | // Update url |
176 | d->setDestinationPath( destinationurl->text() ); | 194 | d->setDestinationPath( destinationurl->text() ); |
195 | d->linkToRoot( linkToRoot->isChecked() ); | ||
177 | 196 | ||
178 | // Check if server name has changed, if it has then we need to replace the key in the map | 197 | // Check if server name has changed, if it has then we need to replace the key in the map |
179 | if ( destinationName != newName ) | 198 | if ( destinationName != newName ) |
@@ -184,6 +203,12 @@ void SettingsImpl :: changeDestinationDetails() | |||
184 | // Update list box | 203 | // Update list box |
185 | destinations->changeItem( newName, currentSelectedDestination ); | 204 | destinations->changeItem( newName, currentSelectedDestination ); |
186 | } | 205 | } |
206 | #ifdef QWS | ||
207 | QString key = newName; | ||
208 | key += "_linkToRoot"; | ||
209 | int val = d->linkToRoot(); | ||
210 | cfg.writeEntry( key, val ); | ||
211 | #endif | ||
187 | } | 212 | } |
188 | else | 213 | else |
189 | { | 214 | { |
@@ -191,5 +216,11 @@ void SettingsImpl :: changeDestinationDetails() | |||
191 | destinations->insertItem( newName ); | 216 | destinations->insertItem( newName ); |
192 | destinations->setCurrentItem( destinations->count() ); | 217 | destinations->setCurrentItem( destinations->count() ); |
193 | newdestination = false; | 218 | newdestination = false; |
219 | |||
220 | #ifdef QWS | ||
221 | QString key = newName; | ||
222 | key += "_linkToRoot"; | ||
223 | cfg.writeEntry( key, true ); | ||
224 | #endif | ||
194 | } | 225 | } |
195 | } | 226 | } |