Version: svn (using KDE KDE 3.5.0) Installed from: Gentoo Packages OS: Linux Hi, following this scenario i get the problem : - open a jabber chat (maybe others i guess) - uncheck rich text format - close the jabber window - re-open a jabber chat => the rich text button is checked but the rich text toolbar is not here
in fact Installed from: is sources :)
there are several issues with rich text, iirc... I looked at the code but got scared off. :) there was some sort of reasoning behind the strange behaviour of that button, I think... I just can't remember it right now... you can manually enable the toolbar (from the menu iirc). I think the rich-text button just enables & disables the stuff *on* the toolbar.
this is not a bug. the rich text setting is not saved between chats on purpose.
Well, it should be a bug. The reason is when chatting with people on other IM programs, and the RTF button is turned on, the other user may get blank lines or garbage before and after the text you send because they don't or can't support the RTF. So each time you open a chat, you have to remember to turn off the RTF button.
k, i changed my mind. it is a bug. :)
Would it be possible to disable rich text by default? I am not sure how many use it now but I guess the majority doesn't and it really is annoying to tell your contact (and do it yourself) to disable it so you don't have these blank lines. Thanks :)
I changed my mind, too. I don't think that disabling it by default would be a good idea. Why? Because an average user won't think that the "pencil" icon will enable the format toolbar when he didn't hide the latter via "Configure Toolbars...".
SVN commit 538029 by mattr: fix bug 121072. the rich text setting is now saved between chats with the same person. BUG: 121072 M +36 -1 chatview.cpp M +12 -0 chatview.h M +22 -4 kopetechatwindow.cpp M +3 -2 kopetechatwindow.h M +9 -8 krichtexteditpart.cpp M +1 -2 krichtexteditpart.h --- branches/kopete/0.12/kopete/kopete/chatwindow/chatview.cpp #538028:538029 @@ -608,7 +608,7 @@ void ChatView::slotContactAdded(const Kopete::Contact *contact, bool suppress) { - QString contactName; + QString contactName; // Myself metacontact is not a reliable source. if( contact->metaContact() && contact->metaContact() != Kopete::ContactList::self()->myself() ) { @@ -838,9 +838,44 @@ writeDockConfig ( config, QString::fromLatin1( "ChatViewDock" ) ); config->setGroup( QString::fromLatin1( "ChatViewDock" ) ); config->writeEntry( QString::fromLatin1( "membersDockPosition" ), membersDockPosition ); + saveChatSettings(); config->sync(); } +void ChatView::saveChatSettings() +{ + Kopete::ContactPtrList contacts = msgManager()->members(); + if ( contacts.count() > 1 ) + return; //can't save with more than one person in chatview + + KConfig* config = KGlobal::config(); + QString contactListGroup = QString::fromLatin1("chatwindow_") + + contacts.first()->metaContact()->metaContactId(); + + config->setGroup( contactListGroup ); + config->writeEntry( "EnableRichText", editPart()->richTextEnabled() ); + config->writeEntry( "EnableAutoSpellCheck", editPart()->autoSpellCheckEnabled() ); + config->sync(); +} + +void ChatView::loadChatSettings() +{ + Kopete::ContactPtrList contacts = msgManager()->members(); + if ( contacts.count() > 1 ) + return; //can't load with more than one other person in the chat + + //read settings for metacontact + QString contactListGroup = QString::fromLatin1("chatwindow_") + + contacts.first()->metaContact()->metaContactId(); + KConfig* config = KGlobal::config(); + config->setGroup( contactListGroup ); + bool enableRichText = config->readBoolEntry( "EnableRichText", true ); + editPart()->slotSetRichTextEnabled( enableRichText ); + emit rtfEnabled( this, enableRichText ); + bool enableAutoSpell = config->readBoolEntry( "EnableAutoSpellCheck", false ); + emit autoSpellCheckEnabled( this, enableAutoSpell ); +} + void ChatView::readOptions() { KConfig *config = KGlobal::config(); --- branches/kopete/0.12/kopete/kopete/chatwindow/chatview.h #538028:538029 @@ -82,6 +82,16 @@ void setActive( bool value ); /** + * save the chat settings (rich text, auto spelling) + */ + void saveChatSettings(); + + /** + * read the chat settings (rich text, auto spelling) + */ + void loadChatSettings(); + + /** * Clears the chat buffer * * Reimplemented from KopeteView @@ -299,6 +309,8 @@ */ void rtfEnabled( ChatView*, bool ); + void autoSpellCheckEnabled( ChatView*, bool ); + private slots: void slotRemoteTypingTimeout(); /** --- branches/kopete/0.12/kopete/kopete/chatwindow/kopetechatwindow.cpp #538028:538029 @@ -381,7 +381,7 @@ toggleAutoSpellCheck = new KToggleAction( i18n( "Automatic Spell Checking" ), QString::null, 0, this, SLOT( toggleAutoSpellChecking() ), coll, "enable_auto_spell_check" ); toggleAutoSpellCheck->setChecked( true ); - + actionSmileyMenu = new KopeteEmoticonAction( coll, "format_smiley" ); actionSmileyMenu->setDelayed( false ); connect(actionSmileyMenu, SIGNAL(activated(const QString &)), this, SLOT(slotSmileyActivated(const QString &))); @@ -702,8 +702,12 @@ connect( newView, SIGNAL(rtfEnabled( ChatView*, bool ) ), this, SLOT( slotRTFEnabled( ChatView*, bool ) ) ); connect( newView, SIGNAL(updateStatusIcon( ChatView* ) ), this, SLOT(slotUpdateCaptionIcons( ChatView* ) ) ); connect( newView, SIGNAL(updateChatState( ChatView*, int ) ), this, SLOT( updateChatState( ChatView*, int ) ) ); + updateSpellCheckAction(); checkDetachEnable(); + newView->loadChatSettings(); + connect( newView, SIGNAL(autoSpellCheckEnabled( ChatView*, bool ) ), + this, SLOT( toggleAutoSpellCheckEnabled( ChatView*, bool ) ) ); } void KopeteChatWindow::checkDetachEnable() @@ -889,6 +893,7 @@ updateSpellCheckAction(); slotUpdateSendEnabled(); m_activeView->editPart()->reloadConfig(); + m_activeView->loadChatSettings(); } void KopeteChatWindow::slotUpdateCaptionIcons( ChatView *view ) @@ -903,7 +908,7 @@ if(!c || c->onlineStatus() < contact->onlineStatus()) c=contact; } - + if ( view == m_activeView ) { QPixmap icon16 = c ? view->msgManager()->contactOnlineStatus( c ).iconFor( c , 16) : @@ -1039,6 +1044,9 @@ if( m_tabBar ) config->writeEntry ( QString::fromLatin1("Tab Placement"), m_tabBar->tabPosition() ); + if ( m_activeView ) + m_activeView->saveChatSettings(); + config->sync(); } @@ -1095,6 +1103,16 @@ updateSpellCheckAction(); } +void KopeteChatWindow::slotAutoSpellCheckEnabled( ChatView* view, bool isEnabled ) +{ + if ( view != m_activeView ) + return; + + toggleAutoSpellCheck->setEnabled( isEnabled ); + toggleAutoSpellCheck->setChecked( isEnabled ); + m_activeView->editPart()->toggleAutoSpellCheck( isEnabled ); +} + bool KopeteChatWindow::queryClose() { bool canClose = true; @@ -1135,7 +1153,7 @@ Kopete::PluginManager::self()->shutdown(); return true; } - else + else return false; } @@ -1150,7 +1168,7 @@ // Save settings if auto-save is enabled, and settings have changed if ( settingsDirty() && autoSaveSettings() ) saveAutoSaveSettings(); - + if ( queryClose() ) { e->accept(); } --- branches/kopete/0.12/kopete/kopete/chatwindow/kopetechatwindow.h #538028:538029 @@ -94,8 +94,8 @@ void updateMembersActions(); void setStatus( const QString & ); - /** - * Reimplemented from KMainWindow - asks each ChatView in the window if it is ok to close the window + /** + * Reimplemented from KMainWindow - asks each ChatView in the window if it is ok to close the window * @return true if no ChatView objects to closing. */ virtual bool queryClose(); @@ -211,6 +211,7 @@ void toggleAutoSpellChecking(); void slotRTFEnabled( ChatView*, bool ); + void slotAutoSpellCheckEnabled( ChatView*, bool ); void slotSetCaption( bool ); void slotUpdateCaptionIcons( ChatView * ); --- branches/kopete/0.12/kopete/kopete/chatwindow/krichtexteditpart.cpp #538028:538029 @@ -93,6 +93,7 @@ //Enable / disable buttons updateActions(); + enableRichText->setChecked( !m_richTextAvailable ); } void KopeteRichTextEditPart::checkToolbarEnabled() @@ -473,12 +474,12 @@ void KopeteRichTextEditPart::setBold( bool b ) { mFont.setBold(b); - if( m_capabilities & Kopete::Protocol::RichBFormatting || m_capabilities & Kopete::Protocol::BaseBFormatting ) + if( m_capabilities & Kopete::Protocol::RichBFormatting || m_capabilities & Kopete::Protocol::BaseBFormatting ) { if( m_richTextEnabled ) editor->setBold(b); - else - editor->setFont(mFont); + else + editor->setFont(mFont); } writeConfig(); } @@ -486,12 +487,12 @@ void KopeteRichTextEditPart::setItalic( bool b ) { mFont.setItalic( b ); - if( m_capabilities & Kopete::Protocol::RichIFormatting || m_capabilities & Kopete::Protocol::BaseIFormatting ) + if( m_capabilities & Kopete::Protocol::RichIFormatting || m_capabilities & Kopete::Protocol::BaseIFormatting ) { if(m_richTextEnabled) editor->setItalic(b); - else - editor->setFont(mFont); + else + editor->setFont(mFont); } writeConfig(); } @@ -503,8 +504,8 @@ { if(m_richTextEnabled) editor->setUnderline(b); - else - editor->setFont(mFont); + else + editor->setFont(mFont); } writeConfig(); } --- branches/kopete/0.12/kopete/kopete/chatwindow/krichtexteditpart.h #538028:538029 @@ -79,6 +79,7 @@ void checkToolbarEnabled(); void reloadConfig(); + void slotSetRichTextEnabled( bool enable ); signals: void toggleToolbar( bool enabled ); @@ -101,8 +102,6 @@ void updateCharFmt(); void updateAligment(); - void slotSetRichTextEnabled( bool enable ); - private: void readConfig(); void writeConfig();
Hi, since this commit I have another problem! If I chat in ICQ my outgoing messages are displayed like this in the chat window: <html><head><meta name="qrichtext" content="1" /></head><body style="font-size:10pt;font-family:Nimbus Sans L"> <p>MY MESSAGE HERE</p> </body></html> It seems, that the message is displayed correct on the other side, but it is quite annoying to see all this HTML stuff :-$ Regards Heiko
I have a similar problem with ICQ. But as for me, the outgoing messages are also dislayed like this on the other side: <html><head><meta name="qrichtext" content="1" /></head><body style="font-size:10pt;font-family:Nimbus Sans L"> <p>MY MESSAGE HERE</p> </body></html> There is a way to avoid it. Open a chat session, send some lines your contact. Close the chat session and open a new one. Now the outgoing messages should be displayed correctly. But still, it's annoying.
This is with svn revision 538364. I forgot to mention this.
Created attachment 15967 [details] Don't put the editor into RichText format if protocol doesn't support it The problem is that rtf will be enabled by default if no configuration exists for the contact, regardless wether the protocol supports it. Please try this patch.
> The problem is that rtf will be enabled by default if no configuration exists > for the contact, regardless wether the protocol supports it. > Please try this patch. seems to work for me. shall I commit? -- This insane ranting was brought to you by evyl bananas, and the number 3. www.chani3.com
yes please
SVN commit 538460 by chani: CCBUG: 121072 patch from Jan Ritzerfeld Don't put the editor into RichText format if protocol doesn't support it M +6 -5 krichtexteditpart.cpp --- branches/kopete/0.12/kopete/kopete/chatwindow/krichtexteditpart.cpp #538459:538460 @@ -74,7 +74,9 @@ void KopeteRichTextEditPart::slotSetRichTextEnabled( bool enable ) { - if( enable ) + m_richTextEnabled = enable && m_richTextAvailable; + + if( m_richTextEnabled ) { editor->setTextFormat( Qt::RichText ); } @@ -83,17 +85,16 @@ editor->setTextFormat( Qt::PlainText ); } - m_richTextEnabled = enable; emit toggleToolbar( buttonsEnabled() ); // Spellchecking disabled when using rich text because the // text we were getting from widget was coloured HTML! - editor->setCheckSpellingEnabled( !richTextEnabled() ); - checkSpelling->setEnabled( !richTextEnabled() ); + editor->setCheckSpellingEnabled( !m_richTextEnabled ); + checkSpelling->setEnabled( !m_richTextEnabled ); //Enable / disable buttons updateActions(); - enableRichText->setChecked( richTextEnabled() ); + enableRichText->setChecked( m_richTextEnabled ); } void KopeteRichTextEditPart::checkToolbarEnabled()