Version: (using KDE Devel) Installed from: Compiled sources If you edit a style and click Ok, the changed style fails a duplicate style name check. Looks like we think the changed style is a new style being added, instead of changes to an existing style. The style being edited then disappears from the style list.
*** Bug 67931 has been marked as a duplicate of this bug. ***
yeah, this should be fixed for kde 3.2. It makes having custom styles useless
Oups, sorry, i closed the wrong bug with this mail, of course, this is this one i wanted to close with this commit ----------------------------------------------------------- CVS commit by ogoffart: Fix Bug 67494: crash on exit after editing chat style CCMAIL: 67494-done@bugs.kde.org M +21 -13 appearanceconfig.cpp 1.14 M +1 -1 appearanceconfig.h 1.3 --- kdenetwork/kopete/kopete/config/appearance/appearanceconfig.cpp #1.13:1.14 @@ -489,6 +489,6 @@ void AppearanceConfig::slotDeleteStyle() void AppearanceConfig::slotStyleSaved() { - addStyle( styleEditor->styleName->text(), KTextEditor::editInterface( \ editDocument )->text() ); - + if( addStyle( styleEditor->styleName->text(), KTextEditor::editInterface( \ editDocument )->text() ) ) + { // Remove our tempfile QString filePath = itemMap[ editedItem ]; @@ -499,12 +499,16 @@ void AppearanceConfig::slotStyleSaved() } delete editedItem; + editedItem=0L; styleEditor->deleteLater(); emit changed( true ); + } + else //The style has not been saved for a reason or another - don't loose it + styleEditor->show(); } -void AppearanceConfig::addStyle( const QString &styleName, const QString &styleSheet \ ) +bool AppearanceConfig::addStyle( const QString &styleName, const QString \ &styleSheet ) { - if( !mPrfsChatWindow->styleList->findItem( styleName ) ) + if( !mPrfsChatWindow->styleList->findItem( styleName ) || \ (mPrfsChatWindow->styleList->selectedItem() && \ mPrfsChatWindow->styleList->selectedItem()->text()==styleName) ) { QString filePath = locateLocal("appdata", \ QString::fromLatin1("styles/%1.xsl").arg( styleName ) ); @@ -521,4 +525,5 @@ void \ AppearanceConfig::addStyle( const Q mPrfsChatWindow->styleList->sort(); styleChanged = true; + return true; } else @@ -531,4 +536,7 @@ void AppearanceConfig::addStyle( const Q KMessageBox::queuedMessageBox( this, KMessageBox::Error, i18n("A \ style named \"%1\" already exists. Please rename the style.").arg( styleName ), \ i18n("Could Not Save") ); } + + //The style has not been saved for a reason or another + return false; } --- kdenetwork/kopete/kopete/config/appearance/appearanceconfig.h #1.2:1.3 @@ -104,5 +104,5 @@ private: void updateHighlight(); QString fileContents(const QString &path); - void addStyle(const QString &styleName, const QString &xslString); + bool addStyle(const QString &styleName, const QString &xslString); KopeteAppearanceConfigPrivate *d;
Just tried to verify this was fixed, but edited styles disappear and cause the deadly XML error message. (edit style, click onto a different style, click onto the edited style). The next time you open the dialog, the edited styles will have disappeared.
CVS commit by wstephens: We were deleting just edited styles, don't do that. I couldn't find any mention of a tempfile anywhere else. Don't add edited files into the listview, they already exist there. Update the preview after an edit. CCMAIL: 67490-done@bugs.kde M +15 -15 appearanceconfig.cpp 1.16 --- kdenetwork/kopete/kopete/config/appearance/appearanceconfig.cpp #1.15:1.16 @@ -501,14 +501,4 @@ void AppearanceConfig::slotStyleSaved() if( addStyle( styleEditor->styleName->text(), KTextEditor::editInterface( editDocument )->text() ) ) { - // Remove our tempfile - QString filePath = itemMap[ editedItem ]; - if ( !filePath.isNull() ) - { - if ( QFileInfo( filePath ).isWritable() ) - QFile::remove( filePath ); - } - delete editedItem; - editedItem=0L; - styleEditor->deleteLater(); emit changed( true ); @@ -520,5 +510,9 @@ void AppearanceConfig::slotStyleSaved() bool AppearanceConfig::addStyle( const QString &styleName, const QString &styleSheet ) { - if( !mPrfsChatWindow->styleList->findItem( styleName ) || (mPrfsChatWindow->styleList->selectedItem() && mPrfsChatWindow->styleList->selectedItem()->text()==styleName) ) + bool newStyleName = !mPrfsChatWindow->styleList->findItem( styleName ); + bool editExistingStyle = (mPrfsChatWindow->styleList->selectedItem() && + mPrfsChatWindow->styleList->selectedItem()->text()==styleName); + + if ( newStyleName || editExistingStyle ) { QString filePath = locateLocal("appdata", QString::fromLatin1("styles/%1.xsl").arg( styleName ) ); @@ -530,8 +524,14 @@ bool AppearanceConfig::addStyle( const Q out.close(); + if ( newStyleName ) + { mPrfsChatWindow->styleList->insertItem( styleName, 0 ); itemMap.insert( mPrfsChatWindow->styleList->firstItem(), filePath ); mPrfsChatWindow->styleList->setSelected( mPrfsChatWindow->styleList->firstItem(), true ); mPrfsChatWindow->styleList->sort(); + } + else + slotUpdatePreview(); + styleChanged = true; return true;