CVS commit by ravi: Backport layout fixes, selection fixes, and bug fix for 74203. M +28 -15 installer.cpp 1.11.2.1 --- kdebase/ksplashml/kcmksplash/installer.cpp #1.11:1.11.2.1 @@ -96,6 +96,5 @@ SplashInstaller::SplashInstaller (QWidge QHBoxLayout* hbox = new QHBoxLayout( this, 0, KDialog::spacingHint() ); - QVBoxLayout* leftbox = new QVBoxLayout( this, 0, KDialog::spacingHint() ); - hbox->addLayout( leftbox ); + QVBoxLayout* leftbox = new QVBoxLayout( hbox, KDialog::spacingHint() ); hbox->setStretchFactor( leftbox, 1 ); @@ -118,6 +117,5 @@ SplashInstaller::SplashInstaller (QWidge connect(mBtnTest, SIGNAL(clicked()), SLOT(slotTest())); - QVBoxLayout* rightbox = new QVBoxLayout( this, 0, KDialog::spacingHint() ); - hbox->addLayout( rightbox ); + QVBoxLayout* rightbox = new QVBoxLayout( hbox, KDialog::spacingHint() ); hbox->setStretchFactor( rightbox, 3 ); @@ -173,4 +171,8 @@ void SplashInstaller::addNewTheme(const url.setPath(locateLocal("tmp",filename)); + // Remove file from temporary directory if it aleady exists - usually the result of a failed install. + if ( KIO::NetAccess::exists( url, true, 0 ) ) + KIO::NetAccess::del( url, 0 ); + bool rc = KIO::NetAccess::copy(srcURL, url, 0); if (!rc) @@ -189,11 +191,16 @@ void SplashInstaller::addNewTheme(const } KArchiveDirectory const *ad = tarFile.directory(); + // Find first directory entry. + QString themeName( ad->entries().first() ); // TODO: Make sure we put the entries into a subdirectory if the tarball does not. // TODO: Warn the user if we overwrite something. ad->copyTo(locateLocal("ksplashthemes","/")); tarFile.close(); + KIO::NetAccess::del( url, 0 ); // TODO: Update only the entries from this installation. readThemesList(); + mThemesList->setCurrentItem(findTheme(themeName)); + mThemesList->setSelected(mThemesList->currentItem(), true); } @@ -205,5 +212,5 @@ void SplashInstaller::readThemesList() // Read local themes QStringList entryList = KGlobal::dirs()->resourceDirs("ksplashthemes"); - kdDebug() << entryList << endl; + //kdDebug() << "readThemesList: " << entryList << endl; QDir dir; QStringList subdirs; @@ -215,9 +222,13 @@ void SplashInstaller::readThemesList() continue; subdirs = dir.entryList( QDir::Dirs ); - kdDebug() << subdirs << endl; + // kdDebug() << "readThemesList: " << subdirs << endl; // TODO: Make sure it contains a *.rc file. for (QStringList::Iterator l = subdirs.begin(); l != subdirs.end(); l++ ) if ( !(*l).startsWith(QString(".")) ) + { + mThemesList->blockSignals( true ); // Don't activate any theme until all themes are loaded. addTheme(dir.path(),*l); + mThemesList->blockSignals( false ); + } } } @@ -272,4 +283,6 @@ void SplashInstaller::slotRemove() if (KMessageBox::questionYesNo(this,i18n("Delete folder %1 and its contents?").arg(themeDir))==KMessageBox::Yes) rc = KIO::NetAccess::del(url,this); + else + return; } if (!rc)