From b35bfb1c9cb5e9b00cb854c104bc80dfc79b0f7d Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Sun, 23 Nov 2003 18:03:25 +0000 Subject: [PATCH] Removed the 'iterate over all toplevel windows and call readConfig()' hack by a clean signal/slot solution to notify the single components of a change in the config dialog. That fixes also #67484. CCMAIL:67484-done@bugs.kde.org svn path=/trunk/kdepim/; revision=269130 --- configuredialog.cpp | 7 ++----- configuredialog.h | 3 +++ kmcomposewin.cpp | 7 +++++++ kmcomposewin.h | 1 + kmkernel.cpp | 5 ++++- kmkernel.h | 3 +++ kmmainwidget.cpp | 8 ++++++++ kmmainwidget.h | 2 ++ kmmainwin.cpp | 10 +++++++++- kmmainwin.h | 1 + kmreadermainwin.cpp | 14 ++++++++++++++ kmreadermainwin.h | 2 ++ 12 files changed, 56 insertions(+), 7 deletions(-) diff --git a/configuredialog.cpp b/configuredialog.cpp index 1da2b09a0..17aef81ad 100644 --- a/configuredialog.cpp +++ b/configuredialog.cpp @@ -339,11 +339,8 @@ void ConfigureDialog::apply( bool everything ) { // KMMessage::readConfig(); KCursorSaver busy(KBusyPtr::busy()); // this can take some time when a large folder is open - QPtrListIterator it( *KMainWindow::memberList ); - for ( it.toFirst() ; it.current() ; ++it ) - // ### FIXME: use dynamic_cast. - if ( (*it)->inherits( "KMTopLevelWidget" ) ) - ((KMTopLevelWidget*)(*it))->readConfig(); + + emit configChanged(); } diff --git a/configuredialog.h b/configuredialog.h index bcef5a15d..68db66d3f 100644 --- a/configuredialog.h +++ b/configuredialog.h @@ -63,6 +63,9 @@ protected slots: private slots: void slotCancelOrClose(); +signals: + void configChanged(); + private: void setup(); void apply(bool); diff --git a/kmcomposewin.cpp b/kmcomposewin.cpp index 70513c133..90f0157ed 100644 --- a/kmcomposewin.cpp +++ b/kmcomposewin.cpp @@ -245,6 +245,8 @@ KMComposeWin::KMComposeWin( KMMessage *aMsg, uint id ) SLOT(slotFolderRemoved(KMFolder*))); connect(kmkernel->dimapFolderMgr(),SIGNAL(folderRemoved(KMFolder*)), SLOT(slotFolderRemoved(KMFolder*))); + connect( kmkernel, SIGNAL( configChanged() ), + this, SLOT( slotConfigChanged() ) ); connect (mEditor, SIGNAL (spellcheck_done(int)), this, SLOT (slotSpellcheckDone (int))); @@ -5305,6 +5307,11 @@ void KMComposeWin::slotCompletionModeChanged( KGlobalSettings::Completion mode) mEdtBcc->setCompletionMode( mode ); } +void KMComposeWin::slotConfigChanged() +{ + readConfig(); +} + /* * checks if the drafts-folder has been deleted * that is not nice so we set the system-drafts-folder diff --git a/kmcomposewin.h b/kmcomposewin.h index 7ab0f2875..8debb0101 100644 --- a/kmcomposewin.h +++ b/kmcomposewin.h @@ -828,6 +828,7 @@ protected: private slots: void slotCompletionModeChanged( KGlobalSettings::Completion ); + void slotConfigChanged(); private: QColor mForeColor,mBackColor; diff --git a/kmkernel.cpp b/kmkernel.cpp index 135ca069a..c6a0f6a21 100644 --- a/kmkernel.cpp +++ b/kmkernel.cpp @@ -1361,8 +1361,11 @@ void KMKernel::slotRequestConfigSync() { void KMKernel::slotShowConfigurationDialog() { - if( !mConfigureDialog ) + if( !mConfigureDialog ) { mConfigureDialog = new ConfigureDialog( 0, "configure", false ); + connect( mConfigureDialog, SIGNAL( configChanged() ), + this, SIGNAL( configChanged() ) ); + } if( mConfigureDialog->isHidden() ) mConfigureDialog->show(); diff --git a/kmkernel.h b/kmkernel.h index 050968926..caf31377b 100644 --- a/kmkernel.h +++ b/kmkernel.h @@ -235,6 +235,9 @@ protected slots: void cleanupLoop(); void cleanupProgress(); +signals: + void configChanged(); + private: KMFolder *the_inboxFolder; KMFolder *the_outboxFolder; diff --git a/kmmainwidget.cpp b/kmmainwidget.cpp index 25a80250f..17e1d2497 100644 --- a/kmmainwidget.cpp +++ b/kmmainwidget.cpp @@ -122,6 +122,9 @@ KMMainWidget::KMMainWidget(QWidget *parent, const char *name, connect(kmkernel->acctMgr(), SIGNAL( checkedMail(bool, bool)), SLOT( slotMailChecked(bool, bool))); + connect(kmkernel, SIGNAL( configChanged() ), + this, SLOT( slotConfigChanged() )); + // display the full path to the folder in the caption connect(mFolderTree, SIGNAL(currentChanged(QListViewItem*)), this, SLOT(slotChangeCaption(QListViewItem*))); @@ -1365,6 +1368,11 @@ void KMMainWidget::slotPrintMsg() command->start(); } +//----------------------------------------------------------------------------- +void KMMainWidget::slotConfigChanged() +{ + readConfig(); +} //----------------------------------------------------------------------------- void KMMainWidget::slotSaveMsg() diff --git a/kmmainwidget.h b/kmmainwidget.h index 0f23549e2..aa2f70599 100644 --- a/kmmainwidget.h +++ b/kmmainwidget.h @@ -343,6 +343,8 @@ protected slots: void slotToFilter(); void slotPrintMsg(); + void slotConfigChanged(); + private: // Message actions KAction *mTrashAction, *mDeleteAction, *mSaveAsAction, *mEditAction, diff --git a/kmmainwin.cpp b/kmmainwin.cpp index 6a904fda5..dada4d94a 100644 --- a/kmmainwin.cpp +++ b/kmmainwin.cpp @@ -49,10 +49,14 @@ KMMainWin::KMMainWin(QWidget *) applyMainWindowSettings(KMKernel::config(), "Main Window"); connect(kmkernel->msgSender(), SIGNAL(statusMsg(const QString&)), this, SLOT(statusMsg(const QString&))); + connect(kmkernel, SIGNAL(configChanged()), + this, SLOT(slotConfigChanged())); connect(mKMMainWidget->messageView(), SIGNAL(statusMsg(const QString&)), this, SLOT(htmlStatusMsg(const QString&))); connect(mKMMainWidget, SIGNAL(captionChangeRequest(const QString&)), SLOT(setCaption(const QString&)) ); + + mKMMainWidget->readConfig(); } KMMainWin::~KMMainWin() @@ -147,7 +151,6 @@ void KMMainWin::setupStatusBar() /** Read configuration options after widgets are created. */ void KMMainWin::readConfig(void) { - mKMMainWidget->readConfig(); } /** Write configuration options. */ @@ -161,6 +164,11 @@ void KMMainWin::slotQuit() close(); } +void KMMainWin::slotConfigChanged() +{ + readConfig(); +} + //----------------------------------------------------------------------------- bool KMMainWin::queryClose() { if (kmkernel->shuttingDown() || kapp->sessionSaving()) diff --git a/kmmainwin.h b/kmmainwin.h index ad6c8883f..6b76569d2 100644 --- a/kmmainwin.h +++ b/kmmainwin.h @@ -50,6 +50,7 @@ protected: protected slots: void slotQuit(); + void slotConfigChanged(); private: #if !KDE_IS_VERSION( 3, 1, 90 ) diff --git a/kmreadermainwin.cpp b/kmreadermainwin.cpp index febd85ac5..e48859a29 100644 --- a/kmreadermainwin.cpp +++ b/kmreadermainwin.cpp @@ -34,6 +34,9 @@ KMReaderMainWin::KMReaderMainWin( bool htmlOverride, char *name ) mReaderWin->setHtmlOverride( htmlOverride ); setCentralWidget( mReaderWin ); setupAccel(); + + connect( kmkernel, SIGNAL( configChanged() ), + this, SLOT( slotConfigChanged() ) ); } @@ -44,6 +47,9 @@ KMReaderMainWin::KMReaderMainWin( char *name ) mReaderWin->setAutoDelete( true ); setCentralWidget( mReaderWin ); setupAccel(); + + connect( kmkernel, SIGNAL( configChanged() ), + this, SLOT( slotConfigChanged() ) ); } @@ -58,6 +64,9 @@ KMReaderMainWin::KMReaderMainWin(KMMessagePart* aMsgPart, mReaderWin->setMsgPart( aMsgPart, aHTML, aFileName, pname ); setCentralWidget( mReaderWin ); setupAccel(); + + connect( kmkernel, SIGNAL( configChanged() ), + this, SLOT( slotConfigChanged() ) ); } @@ -131,6 +140,11 @@ void KMReaderMainWin::slotBounceMsg() command->start(); } +//----------------------------------------------------------------------------- +void KMReaderMainWin::slotConfigChanged() +{ + readConfig(); +} void KMReaderMainWin::setupAccel() { diff --git a/kmreadermainwin.h b/kmreadermainwin.h index 63ace2d69..f40d32cb6 100644 --- a/kmreadermainwin.h +++ b/kmreadermainwin.h @@ -40,6 +40,8 @@ private slots: void slotRedirectMsg(); void slotBounceMsg(); + void slotConfigChanged(); + private: void setupAccel();