------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=121072         
mattr kde org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From mattr kde org  2006-05-06 17:05 -------
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();
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to