summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg
Side-by-side diff
Diffstat (limited to 'noncore/settings/aqpkg') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/settings.ui169
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp43
2 files changed, 143 insertions, 69 deletions
diff --git a/noncore/settings/aqpkg/settings.ui b/noncore/settings/aqpkg/settings.ui
index eb99cf7..6b3cfd4 100644
--- a/noncore/settings/aqpkg/settings.ui
+++ b/noncore/settings/aqpkg/settings.ui
@@ -2,26 +2,26 @@
<class>SettingsBase</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>Settings</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>331</width>
- <height>456</height>
+ <width>247</width>
+ <height>390</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Package Servers</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
@@ -60,25 +60,25 @@
<name>title</name>
<string>Servers</string>
</attribute>
<grid>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
- <widget row="0" column="0" rowspan="1" colspan="2" >
+ <widget row="0" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout2</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
@@ -109,133 +109,161 @@
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</hbox>
</widget>
- <widget row="1" column="0" rowspan="1" colspan="2" >
+ <widget row="1" column="0" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout8</cstring>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" rowspan="1" colspan="2" >
<class>QListBox</class>
<property stdset="1">
<name>name</name>
<cstring>servers</cstring>
</property>
<property stdset="1">
<name>selectionMode</name>
<enum>Extended</enum>
</property>
</widget>
- <widget row="2" column="1" >
- <class>QPushButton</class>
+ <widget row="2" column="0" rowspan="1" colspan="2" >
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>removeserver</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
+ <cstring>Layout6</cstring>
</property>
+ <grid>
<property stdset="1">
- <name>text</name>
- <string>Remove</string>
+ <name>margin</name>
+ <number>0</number>
</property>
<property stdset="1">
- <name>autoDefault</name>
- <bool>false</bool>
+ <name>spacing</name>
+ <number>6</number>
</property>
- </widget>
- <widget row="2" column="0" >
- <class>QPushButton</class>
+ <widget row="2" column="1" >
+ <class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>newserver</cstring>
+ <cstring>active</cstring>
</property>
<property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
+ <name>text</name>
+ <string>Active Server</string>
</property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
<property stdset="1">
- <name>text</name>
- <string>New</string>
+ <name>name</name>
+ <cstring>TextLabel1_3</cstring>
</property>
<property stdset="1">
- <name>autoDefault</name>
- <bool>false</bool>
+ <name>text</name>
+ <string>Name:</string>
</property>
</widget>
- <widget row="3" column="0" rowspan="1" colspan="2" >
- <class>QLayoutWidget</class>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>Layout10</cstring>
+ <cstring>TextLabel2_3</cstring>
</property>
- <grid>
<property stdset="1">
- <name>margin</name>
- <number>0</number>
+ <name>text</name>
+ <string>URL:</string>
</property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QLineEdit</class>
<property stdset="1">
- <name>spacing</name>
- <number>6</number>
+ <name>name</name>
+ <cstring>servername</cstring>
</property>
+ </widget>
<widget row="1" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>serverurl</cstring>
</property>
</widget>
- <widget row="1" column="0" >
- <class>QLabel</class>
+ <widget row="3" column="1" >
+ <class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel2_3</cstring>
+ <cstring>btnChangeServer</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>URL:</string>
+ <string>Change</string>
</property>
</widget>
- <widget row="0" column="1" >
- <class>QLineEdit</class>
+ </grid>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>servername</cstring>
+ <cstring>removeserver</cstring>
</property>
- </widget>
- <widget row="0" column="0" >
- <class>QLabel</class>
<property stdset="1">
- <name>name</name>
- <cstring>TextLabel1_3</cstring>
+ <name>enabled</name>
+ <bool>true</bool>
</property>
<property stdset="1">
<name>text</name>
- <string>Name:</string>
+ <string>Remove</string>
+ </property>
+ <property stdset="1">
+ <name>autoDefault</name>
+ <bool>false</bool>
</property>
</widget>
- <widget row="2" column="1" >
+ <widget row="1" column="0" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>btnChangeServer</cstring>
+ <cstring>newserver</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
</property>
<property stdset="1">
<name>text</name>
- <string>Change</string>
+ <string>New</string>
+ </property>
+ <property stdset="1">
+ <name>autoDefault</name>
+ <bool>false</bool>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
@@ -383,80 +411,95 @@
<name>name</name>
<cstring>destinations</cstring>
</property>
<property stdset="1">
<name>selectionMode</name>
<enum>Single</enum>
</property>
</widget>
<widget row="3" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>Layout8</cstring>
+ <cstring>Layout13</cstring>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
- <widget row="0" column="1" >
- <class>QLineEdit</class>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>destinationname</cstring>
+ <cstring>TextLabel1_3_2_2</cstring>
</property>
- </widget>
- <widget row="1" column="1" >
- <class>QLineEdit</class>
<property stdset="1">
- <name>name</name>
- <cstring>destinationurl</cstring>
+ <name>text</name>
+ <string>URL:</string>
</property>
</widget>
- <widget row="2" column="1" >
+ <widget row="3" column="1" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>btnChangeDest</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Change</string>
</property>
</widget>
+ <widget row="0" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>destinationname</cstring>
+ </property>
+ </widget>
<widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_3_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Name:</string>
</property>
</widget>
- <widget row="1" column="0" >
- <class>QLabel</class>
+ <widget row="2" column="1" >
+ <class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel1_3_2_2</cstring>
+ <cstring>linkToRoot</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>URL:</string>
+ <string>LinkToRoot</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>destinationurl</cstring>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
</widget>
</grid>
</widget>
<connections>
<connection>
<sender>newserver</sender>
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
@@ -13,24 +13,29 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <fstream>
using namespace std;
#include <qlistbox.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qtabwidget.h>
+#include <qcheckbox.h>
+
+#ifdef QWS
+#include <qpe/config.h>
+#endif
#include "settingsimpl.h"
#include "global.h"
SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
: SettingsBase( parent, name, modal, fl )
{
dataMgr = dataManager;
setupData();
changed = false;
@@ -74,122 +79,148 @@ void SettingsImpl :: setupData()
}
//------------------ Servers tab ----------------------
void SettingsImpl :: editServer( int sel )
{
currentSelectedServer = sel;
Server *s = dataMgr->getServer( servers->currentText() );
serverName = s->getServerName();
servername->setText( s->getServerName() );
serverurl->setText( s->getServerUrl() );
+ active->setChecked( s->isServerActive() );
}
void SettingsImpl :: newServer()
{
newserver = true;
servername->setText( "" );
serverurl->setText( "" );
servername->setFocus();
+ active->setChecked( true );
}
void SettingsImpl :: removeServer()
{
changed = true;
Server *s = dataMgr->getServer( servers->currentText() );
dataMgr->getServerList().erase( s );
servers->removeItem( currentSelectedServer );
}
void SettingsImpl :: changeServerDetails()
{
changed = true;
QString newName = servername->text();
if ( !newserver )
{
Server *s = dataMgr->getServer( serverName );
// Update url
s->setServerUrl( serverurl->text() );
+ s->setActive( active->isChecked() );
+
// Check if server name has changed, if it has then we need to replace the key in the map
if ( serverName != newName )
{
// Update server name
s->setServerName( newName );
// See if this server is the active server
- if ( dataMgr->getActiveServer() == serverName )
- dataMgr->setActiveServer( newName );
+// if ( dataMgr->getActiveServer() == serverName )
+// dataMgr->setActiveServer( newName );
// Update list box
servers->changeItem( newName, currentSelectedServer );
}
}
else
{
+ Server s( newName, serverurl->text() );
dataMgr->getServerList().push_back( Server( newName, serverurl->text() ) );
+ dataMgr->getServerList().end()->setActive( active->isChecked() );
servers->insertItem( newName );
servers->setCurrentItem( servers->count() );
newserver = false;
}
}
//------------------ Destinations tab ----------------------
void SettingsImpl :: editDestination( int sel )
{
currentSelectedDestination = sel;
- Destination *s = dataMgr->getDestination( destinations->currentText() );
- destinationName = s->getDestinationName();
- destinationname->setText( s->getDestinationName() );
- destinationurl->setText( s->getDestinationPath() );
+ Destination *d = dataMgr->getDestination( destinations->currentText() );
+ destinationName = d->getDestinationName();
+ destinationname->setText( d->getDestinationName() );
+ destinationurl->setText( d->getDestinationPath() );
+ linkToRoot->setChecked( d->linkToRoot() );
}
void SettingsImpl :: newDestination()
{
newdestination = true;
destinationname->setText( "" );
destinationurl->setText( "" );
destinationname->setFocus();
+ linkToRoot->setChecked( true );
}
void SettingsImpl :: removeDestination()
{
changed = true;
Destination *d = dataMgr->getDestination( destinations->currentText() );
dataMgr->getDestinationList().erase( d );
destinations->removeItem( currentSelectedDestination );
}
void SettingsImpl :: changeDestinationDetails()
{
changed = true;
+#ifdef QWS
+ Config cfg( "aqpkg" );
+ cfg.setGroup( "destinations" );
+#endif
+
QString newName = destinationname->text();
if ( !newdestination )
{
Destination *d = dataMgr->getDestination( destinationName );
// Update url
d->setDestinationPath( destinationurl->text() );
+ d->linkToRoot( linkToRoot->isChecked() );
// Check if server name has changed, if it has then we need to replace the key in the map
if ( destinationName != newName )
{
// Update server name
d->setDestinationName( newName );
// Update list box
destinations->changeItem( newName, currentSelectedDestination );
}
+#ifdef QWS
+ QString key = newName;
+ key += "_linkToRoot";
+ int val = d->linkToRoot();
+ cfg.writeEntry( key, val );
+#endif
}
else
{
dataMgr->getDestinationList().push_back( Destination( newName, destinationurl->text() ) );
destinations->insertItem( newName );
destinations->setCurrentItem( destinations->count() );
newdestination = false;
+
+#ifdef QWS
+ QString key = newName;
+ key += "_linkToRoot";
+ cfg.writeEntry( key, true );
+#endif
}
}