author | andyq <andyq> | 2002-10-17 22:50:20 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-10-17 22:50:20 (UTC) |
commit | b61a21e46590228b6c5800d168fc57789ce733f6 (patch) (unidiff) | |
tree | da0732436919ccb19167eb124898615d499e5914 /noncore/settings/aqpkg/settingsimpl.cpp | |
parent | 51dbf76486cb81a7cb34c07483b344c8ea7a8a24 (diff) | |
download | opie-b61a21e46590228b6c5800d168fc57789ce733f6.zip opie-b61a21e46590228b6c5800d168fc57789ce733f6.tar.gz opie-b61a21e46590228b6c5800d168fc57789ce733f6.tar.bz2 |
Changed dlg to add linkToRoot checkbox to destinations tab
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 | |||
@@ -19,12 +19,17 @@ | |||
19 | using namespace std; | 19 | using namespace std; |
20 | 20 | ||
21 | #include <qlistbox.h> | 21 | #include <qlistbox.h> |
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 | ||
28 | #include "global.h" | 33 | #include "global.h" |
29 | 34 | ||
30 | SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) | 35 | SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) |
@@ -80,20 +85,22 @@ void SettingsImpl :: editServer( int sel ) | |||
80 | { | 85 | { |
81 | currentSelectedServer = sel; | 86 | currentSelectedServer = sel; |
82 | Server *s = dataMgr->getServer( servers->currentText() ); | 87 | Server *s = dataMgr->getServer( servers->currentText() ); |
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() |
89 | { | 95 | { |
90 | newserver = true; | 96 | newserver = true; |
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() |
97 | { | 104 | { |
98 | changed = true; | 105 | changed = true; |
99 | Server *s = dataMgr->getServer( servers->currentText() ); | 106 | Server *s = dataMgr->getServer( servers->currentText() ); |
@@ -109,53 +116,59 @@ void SettingsImpl :: changeServerDetails() | |||
109 | if ( !newserver ) | 116 | if ( !newserver ) |
110 | { | 117 | { |
111 | Server *s = dataMgr->getServer( serverName ); | 118 | Server *s = dataMgr->getServer( serverName ); |
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 ) |
118 | { | 127 | { |
119 | // Update server name | 128 | // Update server name |
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 ); |
128 | } | 137 | } |
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; |
136 | } | 147 | } |
137 | } | 148 | } |
138 | 149 | ||
139 | //------------------ Destinations tab ---------------------- | 150 | //------------------ Destinations tab ---------------------- |
140 | 151 | ||
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() |
151 | { | 163 | { |
152 | newdestination = true; | 164 | newdestination = true; |
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() |
159 | { | 172 | { |
160 | changed = true; | 173 | changed = true; |
161 | Destination *d = dataMgr->getDestination( destinations->currentText() ); | 174 | Destination *d = dataMgr->getDestination( destinations->currentText() ); |
@@ -164,32 +177,50 @@ void SettingsImpl :: removeDestination() | |||
164 | } | 177 | } |
165 | 178 | ||
166 | void SettingsImpl :: changeDestinationDetails() | 179 | 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 ) |
180 | { | 199 | { |
181 | // Update server name | 200 | // Update server name |
182 | d->setDestinationName( newName ); | 201 | d->setDestinationName( newName ); |
183 | 202 | ||
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 | { |
190 | dataMgr->getDestinationList().push_back( Destination( newName, destinationurl->text() ) ); | 215 | dataMgr->getDestinationList().push_back( Destination( newName, destinationurl->text() ) ); |
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 | } |