diff --git a/kmcomposewin.cpp b/kmcomposewin.cpp index eb8f00925..49c68eaba 100644 --- a/kmcomposewin.cpp +++ b/kmcomposewin.cpp @@ -194,7 +194,7 @@ KMComposeWin::KMComposeWin( KMMessage *aMsg, uint id ) mAutoSaveTimer( 0 ), mLastAutoSaveErrno( 0 ) { (void) new MailcomposerAdaptor( this ); - QDBusConnection::sessionBus().registerObject("/Composer", this); + QDBusConnection::sessionBus().registerObject("/Composer", this); mClassicalRecipients = GlobalSettings::self()->recipientsEditorType() == GlobalSettings::EnumRecipientsEditorType::Classic; @@ -770,9 +770,9 @@ void KMComposeWin::slotView(void) //This sucks awfully, but no, I cannot get an activated(int id) from // actionContainer() - if ( sender()->metaObject()->className() != "KToggleAction") + KToggleAction *act = ::qobject_cast( sender() ); + if ( !act ) return; - KToggleAction *act = (KToggleAction *) sender(); if (act == mAllFieldsAction) id = 0; diff --git a/kmfoldercachedimap.cpp b/kmfoldercachedimap.cpp index 105badad7..30894933e 100644 --- a/kmfoldercachedimap.cpp +++ b/kmfoldercachedimap.cpp @@ -1572,7 +1572,7 @@ void KMFolderCachedImap::slotProgress(unsigned long done, unsigned long total) void KMFolderCachedImap::setAccount(KMAcctCachedImap *aAccount) { - assert( aAccount->metaObject()->className() == "KMAcctCachedImap" ); + assert( ::qobject_cast(aAccount) ); mAccount = aAccount; if( imapPath()=="/" ) aAccount->setFolder( folder() ); diff --git a/kmfoldertree.cpp b/kmfoldertree.cpp index 07d0a1832..370ecdb58 100644 --- a/kmfoldertree.cpp +++ b/kmfoldertree.cpp @@ -1648,7 +1648,7 @@ bool KMFolderTree::eventFilter( QObject *o, QEvent *e ) { if ( e->type() == QEvent::MouseButtonPress && static_cast(e)->button() == Qt::RightButton && - QString(o->metaObject()->className()) == "Q3Header" ) + ::qobject_cast(o) ) { mPopup->popup( static_cast(e)->globalPos() ); return true; diff --git a/kmheaders.cpp b/kmheaders.cpp index c33a6efa1..2611837eb 100644 --- a/kmheaders.cpp +++ b/kmheaders.cpp @@ -254,7 +254,7 @@ bool KMHeaders::eventFilter ( QObject *o, QEvent *e ) { if ( e->type() == QEvent::MouseButtonPress && static_cast(e)->button() == Qt::RightButton && - QString(o->metaObject()->className()) == "Q3Header" ) + ::qobject_cast(o) ) { // if we currently only show one of either sender/receiver column // modify the popup text in the way, that it displays the text of the other of the two @@ -1321,9 +1321,11 @@ void KMHeaders::setStyleDependantFrameWidth() { // set the width of the frame to a reasonable value for the current GUI style int frameWidth; - if( style()->metaObject()->className() == "KeramikStyle" ) +#if 0 // is this hack still needed with kde4? + if( !qstrcmp( style()->metaObject()->className(), "KeramikStyle" ) ) frameWidth = style()->pixelMetric( QStyle::PM_DefaultFrameWidth ) - 1; else +#endif frameWidth = style()->pixelMetric( QStyle::PM_DefaultFrameWidth ); if ( frameWidth < 0 ) frameWidth = 0; diff --git a/kmkernel.cpp b/kmkernel.cpp index bb7f4ac89..3af0662a9 100644 --- a/kmkernel.cpp +++ b/kmkernel.cpp @@ -349,7 +349,7 @@ void KMKernel::openReader( bool onlyCheck ) for ( QList::const_iterator it = KMainWindow::memberList().begin(); it != KMainWindow::memberList().end(); ++it ) { - if ( (*it)->metaObject()->className() == "KMMainWin" ) { + if ( ::qobject_cast(*it) ) { ktmw = (*it); break; } @@ -882,7 +882,7 @@ QStringList KMKernel::folderList() const QDBusObjectPath KMKernel::getFolder( const QString& vpath ) { -#if 0 +#if 0 QString adaptorName; const QString localPrefix = "/Local"; if ( the_folderMgr->getFolderByURL( vpath ) ) @@ -899,7 +899,7 @@ QDBusObjectPath KMKernel::getFolder( const QString& vpath ) QDBusConnection::sessionBus().registerObject( vpath, this ); return QDBusObjectPath(vpath); } -#endif +#endif #ifdef __GNUC__ #warning Port DCOPRef usage! #endif @@ -924,10 +924,10 @@ void KMKernel::raise() if (!iface.isValid() || !(reply = iface.call("newInstance")).isValid()) { QDBusError err = iface.lastError(); - kError() << "Communication problem with kmail" + kError() << "Communication problem with kmail" << "Error message was: " << err.name() << ": \"" << err.message() << "\"" << endl; } - + } bool KMKernel::showMail( quint32 serialNumber, QString /* messageId */ ) @@ -1489,8 +1489,8 @@ void KMKernel::closeAllKMailWindows() KMainWindow *window = 0; while ( it.hasNext() ) { window = it.next(); - if ( window && ( window->metaObject()->className() == "KMMainWindow" || - window->inherits("KMail::SecondaryWindow") ) ) + if ( ::qobject_cast(window) || + ::qobject_cast(window) ) { window->setAttribute(Qt::WA_DeleteOnClose); window->close(); // close and delete the window @@ -1918,7 +1918,7 @@ KMainWindow* KMKernel::mainWin() // First look for a KMMainWin. for ( QList::const_iterator it = KMainWindow::memberList().begin(); it != KMainWindow::memberList().end(); ++it ) - if ( (*it)->metaObject()->className() == "KMMainWin" ) + if ( ::qobject_cast(*it) ) return kmWin; // There is no KMMainWin. Use any other KMainWindow instead (e.g. in diff --git a/kmmimeparttree.cpp b/kmmimeparttree.cpp index f4f73a101..a9db7b08f 100644 --- a/kmmimeparttree.cpp +++ b/kmmimeparttree.cpp @@ -185,9 +185,11 @@ void KMMimePartTree::setStyleDependantFrameWidth() { // set the width of the frame to a reasonable value for the current GUI style int frameWidth; - if( style()->metaObject()->className() == "KeramikStyle" ) +#if 0 // is this hack still needed with kde4? + if( !qstrcmp( style()->metaObject()->className(), "KeramikStyle" ) ) frameWidth = style()->pixelMetric( QStyle::PM_DefaultFrameWidth ) - 1; else +#endif frameWidth = style()->pixelMetric( QStyle::PM_DefaultFrameWidth ); if ( frameWidth < 0 ) frameWidth = 0; diff --git a/kmreaderwin.cpp b/kmreaderwin.cpp index 6bae8ee10..15eb85ea7 100644 --- a/kmreaderwin.cpp +++ b/kmreaderwin.cpp @@ -1902,9 +1902,11 @@ void KMReaderWin::setStyleDependantFrameWidth() return; // set the width of the frame to a reasonable value for the current GUI style int frameWidth; - if( style()->metaObject()->className() == "KeramikStyle" ) +#if 0 // is this hack still needed with kde4? + if( !qstrcmp( style()->metaObject()->className(), "KeramikStyle" ) ) frameWidth = style()->pixelMetric( QStyle::PM_DefaultFrameWidth ) - 1; else +#endif frameWidth = style()->pixelMetric( QStyle::PM_DefaultFrameWidth ); if ( frameWidth < 0 ) frameWidth = 0;