Diffstat (limited to 'noncore/unsupported/oipkg/pksettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.cpp | 57 |
1 files changed, 44 insertions, 13 deletions
diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp index be01837..6c8dc2a 100644 --- a/noncore/unsupported/oipkg/pksettings.cpp +++ b/noncore/unsupported/oipkg/pksettings.cpp @@ -33,2 +33,3 @@ #include "debug.h" +//#include "utils.h" @@ -58,2 +59,3 @@ PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* na readSettings(); + activeLinkDestination->hide(); } @@ -78,4 +80,6 @@ void PackageManagerSettings::newServer() } + changed = true; servers->setSelected(i,TRUE); editServer(i); + changed = true; } @@ -99,2 +103,3 @@ void PackageManagerSettings::newDestination() editDestination(i); + changed = true; } @@ -119,2 +124,3 @@ void PackageManagerSettings::editServer(int i) connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); + changed = true; } @@ -139,2 +145,3 @@ void PackageManagerSettings::editDestination(int i) connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); + changed = true; } @@ -153,2 +160,3 @@ void PackageManagerSettings::removeServer() serverurl->setEnabled(FALSE); + changed = true; } @@ -168,2 +176,3 @@ void PackageManagerSettings::removeDestination() destinationurl->setEnabled(FALSE); + changed = true; } @@ -175,3 +184,5 @@ void PackageManagerSettings::serverNameChanged(const QString& t) activeServers->changeItem( t, editedserver ); + changed = true; connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); + changed = true; } @@ -185,2 +196,3 @@ void PackageManagerSettings::destNameChanged(const QString& t) connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); + changed = true; } @@ -190,2 +202,3 @@ void PackageManagerSettings::serverUrlChanged(const QString& t) serverurlDic.replace(editedserver, new QString(t)); + changed = true; } @@ -195,2 +208,3 @@ void PackageManagerSettings::destUrlChanged(const QString& t) destinationurlDic.replace(editeddestination, new QString(t)); + changed = true; } @@ -267,2 +281,3 @@ void PackageManagerSettings::installationSettingChange(int cs) readInstallationSetting( cs ); + changed = true; } @@ -271,3 +286,2 @@ void PackageManagerSettings::writeInstallationSettings() { - if ( ! changed ) return ; { @@ -287,3 +301,3 @@ void PackageManagerSettings::readInstallationSetting(int setting) cfg.setGroup( "Setting_" + QString::number( setting ) ); - CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); + CheckBoxLink->setChecked( cfg.readBoolEntry( "link", true ) ); QString dest = cfg.readEntry( "dest" ); @@ -292,10 +306,9 @@ void PackageManagerSettings::readInstallationSetting(int setting) pvDebug(3, "linkdest="+linkdest); - for ( int i = 0; i < activeDestination->count(); i++) - { - if ( activeDestination->text( i ) == dest ) - activeDestination->setCurrentItem( i ); - if ( activeLinkDestination->text( i ) == linkdest ) - activeLinkDestination->setCurrentItem( i ); - } + { + if ( activeDestination->text( i ) == dest ) + activeDestination->setCurrentItem( i ); + if ( activeLinkDestination->text( i ) == linkdest ) + activeLinkDestination->setCurrentItem( i ); + } } @@ -305,3 +318,2 @@ void PackageManagerSettings::writeCurrentInstallationSetting() Config cfg( "oipkg", Config::User ); - changed = false; cfg.setGroup( "Setting_" + QString::number(currentSetting) ); @@ -334,2 +346,3 @@ bool PackageManagerSettings::readIpkgConfig(const QString& conffile) QFile conf(conffile); + changed = false; if ( conf.open(IO_ReadOnly) ) { @@ -426,3 +439,3 @@ void PackageManagerSettings::writeSettings() { - writeIpkgConfig("/etc/ipkg.conf"); + if ( changed ) writeIpkgConfig("/etc/ipkg.conf"); writeInstallationSettings(); @@ -437,3 +450,3 @@ bool PackageManagerSettings::showDialog( int i ) else readSettings(); - return ret; + return (changed && ret); } @@ -471,2 +484,11 @@ QStringList PackageManagerSettings::getActiveServers() } + QStringList PackageManagerSettings::getServers() +{ + QStringList sl; + for (int i=0; i<(int)activeServers->count(); i++) + { + sl += activeServers->text(i); + } + return sl; +} @@ -508,4 +530,13 @@ void PackageManagerSettings::linkEnabled( bool b ) { - changed = true; activeLinkDestination->setEnabled( b ); } + +void PackageManagerSettings::activeServerChanged() +{ + changed = true; +} + +QComboBox* PackageManagerSettings::getDestCombo() +{ + return new QComboBox(activeDestination); +} |