[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdenetwork/kopete/kopete/chatwindow
From:       Engin Aydogan <engin () bzzzt ! biz>
Date:       2005-09-26 18:40:29
Message-ID: 1127760029.163096.9256.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 464265 by engin:

BUG:99189


 M  +1 -0      kopetechatwindow.cpp  
 M  +14 -14    krichtexteditpart.cpp  
 M  +3 -0      krichtexteditpart.h  


--- branches/KDE/3.5/kdenetwork/kopete/kopete/chatwindow/kopetechatwindow.cpp #464264:464265
@@ -875,6 +875,7 @@
 	m_activeView->setFocus();
 	updateSpellCheckAction();
 	slotUpdateSendEnabled();
+	m_activeView->editPart()->reloadConfig();
 }
 
 void KopeteChatWindow::slotUpdateCaptionIcons( ChatView *view )
--- branches/KDE/3.5/kdenetwork/kopete/kopete/chatwindow/krichtexteditpart.cpp #464264:464265
@@ -100,6 +100,11 @@
 	emit toggleToolbar( buttonsEnabled() );
 }
 
+void KopeteRichTextEditPart::reloadConfig()
+{
+	readConfig();
+}
+
 void KopeteRichTextEditPart::createActions()
 {
 	createActions( actionCollection() );
@@ -291,6 +296,8 @@
 
 void KopeteRichTextEditPart::readConfig()
 {
+	// Don't update config untill we read whole config first
+	m_configWriteLock = true;
 	KConfig *config = KGlobal::config();
 	config->setGroup("RichTextEditor");
 
@@ -306,21 +313,10 @@
 	int tmp = KGlobalSettings::generalFont().pixelSize();
 	setFontSize( config->readNumEntry( "FontSize", tmp ) );
 
-	if( config->readBoolEntry( "FontBold" ) )
-	{
-		action_bold->activate();
-	}
+	action_bold->setChecked( config->readBoolEntry( "FontBold" ) );
+	action_italic->setChecked( config->readBoolEntry( "FontItalic" ) );
+	action_underline->setChecked( config->readBoolEntry( "FontUnderline" ) );
 
-	if( config->readBoolEntry( "FontItalic" ) )
-	{
-		action_italic->activate();
-	}
-
-	if( config->readBoolEntry( "FontUnderline" ) )
-	{
-		action_underline->activate();
-	}
-
 	switch( config->readNumEntry( "EditAlignment", AlignLeft ) )
 	{
 		case AlignLeft:
@@ -336,10 +332,14 @@
 			action_align_justify->activate();
 		break;
 	}
+	m_configWriteLock = false;
 }
 
 void KopeteRichTextEditPart::writeConfig()
 {
+	// If true we're still reading the conf write now, so don't write.
+	if( m_configWriteLock ) return;
+
 	KConfig *config = KGlobal::config();
 	config->setGroup("RichTextEditor");
 	config->writeEntry("Font", mFont );
--- branches/KDE/3.5/kdenetwork/kopete/kopete/chatwindow/krichtexteditpart.h #464264:464265
@@ -78,6 +78,7 @@
 		void setAlignJustify( bool yes );
 
 		void checkToolbarEnabled();
+		void reloadConfig();
 
 	signals:
 		void toggleToolbar( bool enabled );
@@ -129,6 +130,8 @@
 		bool m_richTextAvailable;
 		bool m_richTextEnabled;
 
+		bool m_configWriteLock;
+
 		QFont mFont;
 		QColor mBgColor;
 		QColor mFgColor;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic