generic: cast pointers with QObject as base class via qobject_cast<T>()

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-06-01 21:36:17 +03:00
parent 2da4d8573a
commit 38cdd9c0f4
30 changed files with 65 additions and 93 deletions

View file

@ -477,7 +477,7 @@ void KateFileTemplates::slotOpenTemplate( const KUrl &url )
QWidget *KateFileTemplates::parentWindow() QWidget *KateFileTemplates::parentWindow()
{ {
return dynamic_cast<QWidget*>(application()->activeMainWindow()); return qobject_cast<QWidget*>(application()->activeMainWindow());
} }
// The next part are tools to aid the creation and editing of templates // The next part are tools to aid the creation and editing of templates

View file

@ -358,12 +358,12 @@ int ExpandingWidgetModel::basicRowHeight( const QModelIndex& idx_ ) const
{ {
QModelIndex idx(firstColumn(idx_)); QModelIndex idx(firstColumn(idx_));
ExpandingDelegate* delegate = dynamic_cast<ExpandingDelegate*>( treeView()->itemDelegate(idx) ); ExpandingDelegate* delegate = qobject_cast<ExpandingDelegate*>( treeView()->itemDelegate(idx) );
if( !delegate || !idx.isValid() ) { if( !delegate || !idx.isValid() ) {
kDebug( 13035 ) << "ExpandingWidgetModel::basicRowHeight: Could not get delegate"; kDebug( 13035 ) << "ExpandingWidgetModel::basicRowHeight: Could not get delegate";
return 15; return 15;
} }
return delegate->basicSizeHint( idx ).height(); return delegate->basicSizeHint( idx ).height();
} }

View file

@ -473,7 +473,7 @@ namespace KateMDI
if (ev->type() == QEvent::ContextMenu) if (ev->type() == QEvent::ContextMenu)
{ {
QContextMenuEvent *e = (QContextMenuEvent *) ev; QContextMenuEvent *e = (QContextMenuEvent *) ev;
KMultiTabBarTab *bt = dynamic_cast<KMultiTabBarTab*>(obj); KMultiTabBarTab *bt = qobject_cast<KMultiTabBarTab*>(obj);
if (bt) if (bt)
{ {
//kDebug() << "Request for popup"; //kDebug() << "Request for popup";
@ -487,7 +487,7 @@ namespace KateMDI
KMenu *p = new KMenu (this); KMenu *p = new KMenu (this);
if (!w->plugin.isNull()) { if (!w->plugin.isNull()) {
Kate::PluginConfigPageInterface* pcpi=dynamic_cast<Kate::PluginConfigPageInterface*>(w->plugin.data()); Kate::PluginConfigPageInterface* pcpi=qobject_cast<Kate::PluginConfigPageInterface*>(w->plugin.data());
if (pcpi) { if (pcpi) {
if (pcpi->configPages()>0) if (pcpi->configPages()>0)
p->addAction(i18n("Configure ..."))->setData(20); p->addAction(i18n("Configure ..."))->setData(20);
@ -559,7 +559,7 @@ namespace KateMDI
// configure actionCollection // configure actionCollection
if (id==20) { if (id==20) {
if (!w->plugin.isNull()) { if (!w->plugin.isNull()) {
Kate::PluginConfigPageInterface* pcpi=dynamic_cast<Kate::PluginConfigPageInterface*>(w->plugin.data()); Kate::PluginConfigPageInterface* pcpi=qobject_cast<Kate::PluginConfigPageInterface*>(w->plugin.data());
if (pcpi) { if (pcpi) {
if (pcpi->configPages()>0) if (pcpi->configPages()>0)
emit sigShowPluginConfigPage(pcpi,0); emit sigShowPluginConfigPage(pcpi,0);

View file

@ -93,7 +93,7 @@ void BookmarkListView::setModel(QAbstractItemModel * model)
KBookmarkModel* BookmarkListView::bookmarkModel() const KBookmarkModel* BookmarkListView::bookmarkModel() const
{ {
return dynamic_cast<KBookmarkModel*>(QTreeView::model()); return qobject_cast<KBookmarkModel*>(QTreeView::model());
} }
KBookmark BookmarkListView::bookmarkForIndex(const QModelIndex & idx) const KBookmark BookmarkListView::bookmarkForIndex(const QModelIndex & idx) const

View file

@ -66,8 +66,8 @@ KViewSearchLine::KViewSearchLine(QWidget *parent, QAbstractItemView *v) :
setClearButtonShown(true); setClearButtonShown(true);
d->treeView = dynamic_cast<QTreeView *>(v); d->treeView = qobject_cast<QTreeView *>(v);
d->listView = dynamic_cast<QListView *>(v); d->listView = qobject_cast<QListView *>(v);
connect(this, SIGNAL(textChanged(QString)), connect(this, SIGNAL(textChanged(QString)),
this, SLOT(queueSearch(QString))); this, SLOT(queueSearch(QString)));
@ -184,8 +184,8 @@ void KViewSearchLine::setView(QAbstractItemView *v)
disconnect(model(), SIGNAL(modelReset()), this, SLOT(slotModelReset())); disconnect(model(), SIGNAL(modelReset()), this, SLOT(slotModelReset()));
} }
d->treeView = dynamic_cast<QTreeView *>(v); d->treeView = qobject_cast<QTreeView *>(v);
d->listView = dynamic_cast<QListView *>(v); d->listView = qobject_cast<QListView *>(v);
if(view()) { if(view()) {
connect(view(), SIGNAL(destroyed()), connect(view(), SIGNAL(destroyed()),

View file

@ -65,7 +65,7 @@ public:
QMenu* popupMenuFactory(const char *type) QMenu* popupMenuFactory(const char *type)
{ {
QWidget * menu = factory()->container(type, this); QWidget * menu = factory()->container(type, this);
return dynamic_cast<QMenu *>(menu); return qobject_cast<QMenu *>(menu);
} }
KToggleAction* getToggleAction(const char *) const; KToggleAction* getToggleAction(const char *) const;

View file

@ -90,7 +90,7 @@ KInfoCenter::KInfoCenter() : KXmlGuiWindow( 0, Qt::WindowContextHelpButtonHint )
m_toolTips = new ToolTipManager(m_sideMenu); m_toolTips = new ToolTipManager(m_sideMenu);
setupGUI(QSize(640,480), ToolBar | Keys | Save | Create,"kinfocenterui.rc"); setupGUI(QSize(640,480), ToolBar | Keys | Save | Create,"kinfocenterui.rc");
m_helpAction->setMenu( dynamic_cast<KMenu*>( factory()->container("help", this) ) ); m_helpAction->setMenu( qobject_cast<KMenu*>( factory()->container("help", this) ) );
menuBar()->hide(); menuBar()->hide();
QAction *aboutApp = actionCollection()->action("help_about_app"); QAction *aboutApp = actionCollection()->action("help_about_app");

View file

@ -268,7 +268,7 @@ void Interface::updateSystemActivityToolTip()
{ {
/* Set the tooltip for the Show System Activity button to include the global shortcut */ /* Set the tooltip for the Show System Activity button to include the global shortcut */
KRunnerApp *krunnerApp = KRunnerApp::self(); KRunnerApp *krunnerApp = KRunnerApp::self();
KAction *showSystemActivityAction = dynamic_cast<KAction *>(krunnerApp->actionCollection()->action(QLatin1String( "Show System Activity" ))); KAction *showSystemActivityAction = qobject_cast<KAction *>(krunnerApp->actionCollection()->action(QLatin1String( "Show System Activity" )));
if (showSystemActivityAction) { if (showSystemActivityAction) {
QString shortcut = showSystemActivityAction->globalShortcut().toString(); QString shortcut = showSystemActivityAction->globalShortcut().toString();
if (shortcut.isEmpty()) { if (shortcut.isEmpty()) {

View file

@ -308,7 +308,7 @@ void QsDialog::updateSystemActivityToolTip()
{ {
/* Set the tooltip for the Show System Activity button to include the global shortcut */ /* Set the tooltip for the Show System Activity button to include the global shortcut */
KRunnerApp *krunnerApp = KRunnerApp::self(); KRunnerApp *krunnerApp = KRunnerApp::self();
KAction *showSystemActivityAction = dynamic_cast<KAction *>(krunnerApp->actionCollection()->action(QLatin1String( "Show System Activity" ))); KAction *showSystemActivityAction = qobject_cast<KAction *>(krunnerApp->actionCollection()->action(QLatin1String( "Show System Activity" )));
if (showSystemActivityAction) { if (showSystemActivityAction) {
QString shortcut = showSystemActivityAction->globalShortcut().toString(); QString shortcut = showSystemActivityAction->globalShortcut().toString();
if (shortcut.isEmpty()) { if (shortcut.isEmpty()) {

View file

@ -255,7 +255,7 @@ void TopLevel::initStatusBar()
KSGRD::SensorMgr->sendRequest( "localhost", "mem/swap/used?", KSGRD::SensorMgr->sendRequest( "localhost", "mem/swap/used?",
(KSGRD::SensorClient*)this, 7 ); (KSGRD::SensorClient*)this, 7 );
KToggleAction *sb = dynamic_cast<KToggleAction*>(action("options_show_statusbar")); KToggleAction *sb = qobject_cast<KToggleAction*>(action("options_show_statusbar"));
if (sb) if (sb)
connect(sb, SIGNAL(toggled(bool)), this, SLOT(updateStatusBar())); connect(sb, SIGNAL(toggled(bool)), this, SLOT(updateStatusBar()));
setupGUI(QSize(800,600), ToolBar | Keys | StatusBar | Save | Create); setupGUI(QSize(800,600), ToolBar | Keys | StatusBar | Save | Create);

View file

@ -779,7 +779,7 @@ bool Toplevel::setupCompositing()
// and us setting up damage tracking. If the client wins we won't get a damage event even // and us setting up damage tracking. If the client wins we won't get a damage event even
// though the window has been painted. To avoid this we mark the whole window as damaged // though the window has been painted. To avoid this we mark the whole window as damaged
// and schedule a repaint immediately after creating the damage object. // and schedule a repaint immediately after creating the damage object.
if (dynamic_cast<Unmanaged*>(this)) if (qobject_cast<Unmanaged*>(this))
addDamageFull(); addDamageFull();
return true; return true;

View file

@ -71,7 +71,7 @@ void Deleted::discard()
void Deleted::copyToDeleted(Toplevel* c) void Deleted::copyToDeleted(Toplevel* c)
{ {
assert(dynamic_cast< Deleted* >(c) == NULL); assert(qobject_cast< Deleted* >(c) == NULL);
Toplevel::copyToDeleted(c); Toplevel::copyToDeleted(c);
desk = c->desktop(); desk = c->desktop();
contentsRect = QRect(c->clientPos(), c->clientSize()); contentsRect = QRect(c->clientPos(), c->clientSize());
@ -79,7 +79,7 @@ void Deleted::copyToDeleted(Toplevel* c)
m_layer = c->layer(); m_layer = c->layer();
if (WinInfo* cinfo = dynamic_cast< WinInfo* >(info)) if (WinInfo* cinfo = dynamic_cast< WinInfo* >(info))
cinfo->disable(); cinfo->disable();
Client* client = dynamic_cast<Client*>(c); Client* client = qobject_cast<Client*>(c);
if (client) { if (client) {
m_wasClient = true; m_wasClient = true;
no_border = client->noBorder(); no_border = client->noBorder();

View file

@ -517,8 +517,8 @@ void EffectsHandlerImpl::slotUnmanagedAdded(Unmanaged *u)
void EffectsHandlerImpl::slotClientShown(KWin::Toplevel *t) void EffectsHandlerImpl::slotClientShown(KWin::Toplevel *t)
{ {
Q_ASSERT(dynamic_cast<Client*>(t)); Q_ASSERT(qobject_cast<Client*>(t));
Client *c = static_cast<Client*>(t); Client *c = qobject_cast<Client*>(t);
setupClientConnections(c); setupClientConnections(c);
if (!c->tabGroup()) // the "window" has already been there if (!c->tabGroup()) // the "window" has already been there
emit windowAdded(c->effectWindow()); emit windowAdded(c->effectWindow());
@ -526,8 +526,8 @@ void EffectsHandlerImpl::slotClientShown(KWin::Toplevel *t)
void EffectsHandlerImpl::slotUnmanagedShown(KWin::Toplevel *t) void EffectsHandlerImpl::slotUnmanagedShown(KWin::Toplevel *t)
{ // regardless, unmanaged windows are -yet?- not synced anyway { // regardless, unmanaged windows are -yet?- not synced anyway
Q_ASSERT(dynamic_cast<Unmanaged*>(t)); Q_ASSERT(qobject_cast<Unmanaged*>(t));
Unmanaged *u = static_cast<Unmanaged*>(t); Unmanaged *u = qobject_cast<Unmanaged*>(t);
setupUnmanagedConnections(u); setupUnmanagedConnections(u);
emit windowAdded(u->effectWindow()); emit windowAdded(u->effectWindow());
} }
@ -834,7 +834,7 @@ void EffectsHandlerImpl::deleteRootProperty(long atom) const
void EffectsHandlerImpl::activateWindow(EffectWindow* c) void EffectsHandlerImpl::activateWindow(EffectWindow* c)
{ {
if (Client* cl = dynamic_cast< Client* >(static_cast<EffectWindowImpl*>(c)->window())) if (Client* cl = qobject_cast< Client* >(static_cast<EffectWindowImpl*>(c)->window()))
Workspace::self()->activateClient(cl, true); Workspace::self()->activateClient(cl, true);
} }
@ -845,7 +845,7 @@ EffectWindow* EffectsHandlerImpl::activeWindow() const
void EffectsHandlerImpl::moveWindow(EffectWindow* w, const QPoint& pos, bool snap, double snapAdjust) void EffectsHandlerImpl::moveWindow(EffectWindow* w, const QPoint& pos, bool snap, double snapAdjust)
{ {
Client* cl = dynamic_cast< Client* >(static_cast<EffectWindowImpl*>(w)->window()); Client* cl = qobject_cast< Client* >(static_cast<EffectWindowImpl*>(w)->window());
if (!cl || !cl->isMovable()) if (!cl || !cl->isMovable())
return; return;
@ -857,14 +857,14 @@ void EffectsHandlerImpl::moveWindow(EffectWindow* w, const QPoint& pos, bool sna
void EffectsHandlerImpl::windowToDesktop(EffectWindow* w, int desktop) void EffectsHandlerImpl::windowToDesktop(EffectWindow* w, int desktop)
{ {
Client* cl = dynamic_cast< Client* >(static_cast<EffectWindowImpl*>(w)->window()); Client* cl = qobject_cast< Client* >(static_cast<EffectWindowImpl*>(w)->window());
if (cl && !cl->isDesktop() && !cl->isDock()) if (cl && !cl->isDesktop() && !cl->isDock())
Workspace::self()->sendClientToDesktop(cl, desktop, true); Workspace::self()->sendClientToDesktop(cl, desktop, true);
} }
void EffectsHandlerImpl::windowToScreen(EffectWindow* w, int screen) void EffectsHandlerImpl::windowToScreen(EffectWindow* w, int screen)
{ {
Client* cl = dynamic_cast< Client* >(static_cast<EffectWindowImpl*>(w)->window()); Client* cl = qobject_cast< Client* >(static_cast<EffectWindowImpl*>(w)->window());
if (cl && !cl->isDesktop() && !cl->isDock()) if (cl && !cl->isDesktop() && !cl->isDock())
Workspace::self()->sendClientToScreen(cl, screen); Workspace::self()->sendClientToScreen(cl, screen);
} }
@ -1017,7 +1017,7 @@ void EffectsHandlerImpl::setElevatedWindow(EffectWindow* w, bool set)
void EffectsHandlerImpl::setTabBoxWindow(EffectWindow* w) void EffectsHandlerImpl::setTabBoxWindow(EffectWindow* w)
{ {
#ifdef KWIN_BUILD_TABBOX #ifdef KWIN_BUILD_TABBOX
if (Client* c = dynamic_cast< Client* >(static_cast< EffectWindowImpl* >(w)->window())) { if (Client* c = qobject_cast< Client* >(static_cast< EffectWindowImpl* >(w)->window())) {
TabBox::TabBox::self()->setCurrentClient(c); TabBox::TabBox::self()->setCurrentClient(c);
} }
#else #else
@ -1138,7 +1138,7 @@ QRect EffectsHandlerImpl::clientArea(clientAreaOption opt, int screen, int deskt
QRect EffectsHandlerImpl::clientArea(clientAreaOption opt, const EffectWindow* c) const QRect EffectsHandlerImpl::clientArea(clientAreaOption opt, const EffectWindow* c) const
{ {
const Toplevel* t = static_cast< const EffectWindowImpl* >(c)->window(); const Toplevel* t = static_cast< const EffectWindowImpl* >(c)->window();
if (const Client* cl = dynamic_cast< const Client* >(t)) if (const Client* cl = qobject_cast< const Client* >(t))
return Workspace::self()->clientArea(opt, cl); return Workspace::self()->clientArea(opt, cl);
else else
return Workspace::self()->clientArea(opt, t->geometry().center(), VirtualDesktopManager::self()->current()); return Workspace::self()->clientArea(opt, t->geometry().center(), VirtualDesktopManager::self()->current());
@ -1239,7 +1239,7 @@ void EffectsHandlerImpl::unreserveElectricBorder(ElectricBorder border, Effect *
unsigned long EffectsHandlerImpl::xrenderBufferPicture() unsigned long EffectsHandlerImpl::xrenderBufferPicture()
{ {
#ifdef KWIN_BUILD_COMPOSITE #ifdef KWIN_BUILD_COMPOSITE
if (SceneXrender* s = dynamic_cast< SceneXrender* >(m_scene)) if (SceneXrender* s = qobject_cast< SceneXrender* >(m_scene))
return s->bufferPicture(); return s->bufferPicture();
#endif #endif
return None; return None;
@ -1640,21 +1640,21 @@ void EffectWindowImpl::disablePainting(int reason)
const EffectWindowGroup* EffectWindowImpl::group() const const EffectWindowGroup* EffectWindowImpl::group() const
{ {
if (Client* c = dynamic_cast< Client* >(toplevel)) if (Client* c = qobject_cast< Client* >(toplevel))
return c->group()->effectGroup(); return c->group()->effectGroup();
return NULL; // TODO return NULL; // TODO
} }
void EffectWindowImpl::refWindow() void EffectWindowImpl::refWindow()
{ {
if (Deleted* d = dynamic_cast< Deleted* >(toplevel)) if (Deleted* d = qobject_cast< Deleted* >(toplevel))
return d->refWindow(); return d->refWindow();
abort(); // TODO abort(); // TODO
} }
void EffectWindowImpl::unrefWindow() void EffectWindowImpl::unrefWindow()
{ {
if (Deleted* d = dynamic_cast< Deleted* >(toplevel)) if (Deleted* d = qobject_cast< Deleted* >(toplevel))
return d->unrefWindow(); // delays deletion in case return d->unrefWindow(); // delays deletion in case
abort(); // TODO abort(); // TODO
} }
@ -1677,7 +1677,7 @@ QRegion EffectWindowImpl::shape() const
QRect EffectWindowImpl::decorationInnerRect() const QRect EffectWindowImpl::decorationInnerRect() const
{ {
Client *client = dynamic_cast<Client*>(toplevel); Client *client = qobject_cast<Client*>(toplevel);
return client ? client->transparentRect() : contentsRect(); return client ? client->transparentRect() : contentsRect();
} }
@ -1693,7 +1693,7 @@ void EffectWindowImpl::deleteProperty(long int atom) const
EffectWindow* EffectWindowImpl::findModal() EffectWindow* EffectWindowImpl::findModal()
{ {
if (Client* c = dynamic_cast< Client* >(toplevel)) { if (Client* c = qobject_cast< Client* >(toplevel)) {
if (Client* c2 = c->findModal()) if (Client* c2 = c->findModal())
return c2->effectWindow(); return c2->effectWindow();
} }

View file

@ -671,7 +671,7 @@ void Scene::Window::discardShape()
const QRegion &Scene::Window::shape() const const QRegion &Scene::Window::shape() const
{ {
if (!shape_valid) { if (!shape_valid) {
Client* c = dynamic_cast< Client* >(toplevel); Client* c = qobject_cast< Client* >(toplevel);
if (toplevel->shape() || (c != NULL && !c->mask().isEmpty())) { if (toplevel->shape() || (c != NULL && !c->mask().isEmpty())) {
int count, order; int count, order;
XRectangle* rects = XShapeGetRectangles(display(), toplevel->frameId(), XRectangle* rects = XShapeGetRectangles(display(), toplevel->frameId(),
@ -771,7 +771,7 @@ WindowQuadList Scene::Window::buildQuads(bool force) const
if (toplevel->clientPos() == QPoint(0, 0) && toplevel->clientSize() == toplevel->decorationRect().size()) if (toplevel->clientPos() == QPoint(0, 0) && toplevel->clientSize() == toplevel->decorationRect().size())
ret = makeQuads(WindowQuadContents, shape()); // has no decoration ret = makeQuads(WindowQuadContents, shape()); // has no decoration
else { else {
Client *client = dynamic_cast<Client*>(toplevel); Client *client = qobject_cast<Client*>(toplevel);
QRegion contents = clientShape(); QRegion contents = clientShape();
QRegion center = toplevel->transparentRect(); QRegion center = toplevel->transparentRect();
QRegion decoration = (client && decorationPlugin()->hasAlpha() ? QRegion decoration = (client && decorationPlugin()->hasAlpha() ?

View file

@ -435,8 +435,8 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat
qreal yscale = 1; qreal yscale = 1;
bool scaled = false; bool scaled = false;
Client *client = dynamic_cast<Client*>(toplevel); Client *client = qobject_cast<Client*>(toplevel);
Deleted *deleted = dynamic_cast<Deleted*>(toplevel); Deleted *deleted = qobject_cast<Deleted*>(toplevel);
const QRect decorationRect = toplevel->decorationRect(); const QRect decorationRect = toplevel->decorationRect();
if (((client && !client->noBorder()) || (deleted && !deleted->noBorder())) && if (((client && !client->noBorder()) || (deleted && !deleted->noBorder())) &&
decorationPlugin()->hasAlpha()) { decorationPlugin()->hasAlpha()) {

View file

@ -294,7 +294,7 @@ void Toplevel::setReadyForPainting()
if (compositing()) { if (compositing()) {
addRepaintFull(); addRepaintFull();
emit windowShown(this); emit windowShown(this);
if (Client *cl = dynamic_cast<Client*>(this)) { if (Client *cl = qobject_cast<Client*>(this)) {
if (cl->tabGroup() && cl->tabGroup()->current() == cl) if (cl->tabGroup() && cl->tabGroup()->current() == cl)
cl->tabGroup()->setCurrent(cl, true); cl->tabGroup()->setCurrent(cl, true);
} }

View file

@ -509,22 +509,6 @@ void KonqOperations::doDropFileCopy()
{ {
// Neither control, shift or alt are pressed => show popup menu // Neither control, shift or alt are pressed => show popup menu
// TODO move this code out somehow. Allow user of KonqOperations to add his own actions...
#if 0
KonqIconViewWidget *iconView = dynamic_cast<KonqIconViewWidget*>(parent());
bool bSetWallpaper = false;
if ( iconView && iconView->maySetWallpaper() && lst.count() == 1 )
{
KUrl url = lst.first();
KMimeType::Ptr mime = KMimeType::findByUrl( url );
if ( mime && ( ( KImageIO::isSupported(mime->name(), KImageIO::Reading) ) ||
mime->is( "image/svg+xml" ) ) )
{
bSetWallpaper = true;
}
}
#endif
// Check what the source can do // Check what the source can do
// we'll assume it's the same for all URLs (hack) // we'll assume it's the same for all URLs (hack)
// TODO: if we had a KFileItemList instead of a KUrl::List, // TODO: if we had a KFileItemList instead of a KUrl::List,
@ -780,18 +764,6 @@ void KonqOperations::setOperation( KIO::Job * job, Operation method, const KUrl
job->ui()->setWindow(parentWidget()); job->ui()->setWindow(parentWidget());
connect( job, SIGNAL(result(KJob*)), connect( job, SIGNAL(result(KJob*)),
SLOT(slotResult(KJob*)) ); SLOT(slotResult(KJob*)) );
#if 0
KIO::CopyJob *copyJob = dynamic_cast<KIO::CopyJob*>(job);
KonqIconViewWidget *iconView = dynamic_cast<KonqIconViewWidget*>(parent());
if (copyJob && iconView)
{
connect(copyJob, SIGNAL(aboutToCreate(KIO::Job*,QList<KIO::CopyInfo>)),
this, SLOT(slotAboutToCreate(KIO::Job*,QList<KIO::CopyInfo>)));
// TODO move this connect into the iconview!
connect(this, SIGNAL(aboutToCreate(QPoint,QList<KIO::CopyInfo>)),
iconView, SLOT(slotAboutToCreate(QPoint,QList<KIO::CopyInfo>)));
}
#endif
} }
else // for link else // for link
slotResult( 0L ); slotResult( 0L );

View file

@ -432,7 +432,7 @@ void CalendarPrivate::popupMonthsMenu()
void Calendar::monthTriggered() void Calendar::monthTriggered()
{ {
QAction *action = dynamic_cast<QAction*> (sender()); QAction *action = qobject_cast<QAction*> (sender());
if (action && action->property("month").type() == QVariant::Int) { if (action && action->property("month").type() == QVariant::Int) {
int newMonth = action->property("month").toInt(); int newMonth = action->property("month").toInt();

View file

@ -376,7 +376,7 @@ void BackgroundDialog::changeBackgroundMode(int index)
if (!w) { if (!w) {
w = new QWidget(d->backgroundDialogUi.wallpaperGroup); w = new QWidget(d->backgroundDialogUi.wallpaperGroup);
} else if (w->layout()) { } else if (w->layout()) {
QGridLayout *gridLayout = dynamic_cast<QGridLayout *>(w->layout()); QGridLayout *gridLayout = qobject_cast<QGridLayout *>(w->layout());
if (gridLayout) { if (gridLayout) {
gridLayout->setColumnMinimumWidth(0, d->backgroundDialogUi.wallpaperTypeLabel->geometry().right()); gridLayout->setColumnMinimumWidth(0, d->backgroundDialogUi.wallpaperTypeLabel->geometry().right());
gridLayout->setColumnStretch(0, 0); gridLayout->setColumnStretch(0, 0);

View file

@ -91,7 +91,7 @@ void AbstractSortingStrategy::handleGroup(TaskGroup *group)
void AbstractSortingStrategy::removeGroup() void AbstractSortingStrategy::removeGroup()
{ {
TaskGroup *group = dynamic_cast<TaskGroup*>(sender()); TaskGroup *group = qobject_cast<TaskGroup*>(sender());
if (!group) { if (!group) {
return; return;
@ -117,7 +117,7 @@ void AbstractSortingStrategy::check(AbstractGroupableItem *itemToCheck)
{ {
AbstractGroupableItem *item; AbstractGroupableItem *item;
if (!itemToCheck) { if (!itemToCheck) {
item = dynamic_cast<AbstractGroupableItem *>(sender()); item = qobject_cast<AbstractGroupableItem *>(sender());
} else { } else {
item = itemToCheck; item = itemToCheck;
} }

View file

@ -84,7 +84,7 @@ QList<QAction*> ManualGroupingStrategy::strategyActions(QObject *parent, Abstrac
QAction *a = new QAction(i18n("Remove Group"), parent); QAction *a = new QAction(i18n("Remove Group"), parent);
connect(a, SIGNAL(triggered()), this, SLOT(removeGroup())); connect(a, SIGNAL(triggered()), this, SLOT(removeGroup()));
actionList.append(a); actionList.append(a);
d->tempGroup = dynamic_cast<TaskGroup*>(item); d->tempGroup = qobject_cast<TaskGroup*>(item);
} }
return actionList; return actionList;

View file

@ -191,7 +191,7 @@ void ProgramGroupingStrategy::handleItem(AbstractGroupableItem *item)
return; return;
} }
TaskItem *task = dynamic_cast<TaskItem*>(item); TaskItem *task = qobject_cast<TaskItem*>(item);
if (task && !programGrouping(task, root)) { if (task && !programGrouping(task, root)) {
//kDebug() << item->name() << "joined rootGroup "; //kDebug() << item->name() << "joined rootGroup ";
root->add(item); root->add(item);

View file

@ -645,9 +645,9 @@ BasicMenu::BasicMenu(QWidget *parent, TaskGroup* group, GroupManager *strategy,
foreach (AbstractGroupableItem * item, group->members()) { foreach (AbstractGroupableItem * item, group->members()) {
if (item->itemType() == GroupItemType) { if (item->itemType() == GroupItemType) {
addMenu(new BasicMenu(this, dynamic_cast<TaskGroup*>(item), strategy)); addMenu(new BasicMenu(this, qobject_cast<TaskGroup*>(item), strategy));
} else { } else {
addMenu(new BasicMenu(this, dynamic_cast<TaskItem*>(item), strategy, QList <QAction*>(), QList <QAction*>(), maxWidth)); addMenu(new BasicMenu(this, qobject_cast<TaskItem*>(item), strategy, QList <QAction*>(), QList <QAction*>(), maxWidth));
} }
} }
addSeparator(); addSeparator();

View file

@ -168,8 +168,8 @@ int TaskGroup::totalSize()
void TaskGroup::add(AbstractGroupableItem *item, int insertIndex) void TaskGroup::add(AbstractGroupableItem *item, int insertIndex)
{ {
/* if (!item->itemType() == GroupItemType) { /* if (!item->itemType() == GroupItemType) {
if ((dynamic_cast<TaskItem*>(item))->task()) { if ((qobject_cast<TaskItem*>(item))->task()) {
kDebug() << "Add item" << (dynamic_cast<TaskItem*>(item))->task()->visibleName(); kDebug() << "Add item" << (qobject_cast<TaskItem*>(item))->task()->visibleName();
} }
kDebug() << " to Group " << name(); kDebug() << " to Group " << name();
} }
@ -253,9 +253,9 @@ void TaskGroup::add(AbstractGroupableItem *item, int insertIndex)
//For debug //For debug
/* foreach (AbstractGroupableItem *item, d->members) { /* foreach (AbstractGroupableItem *item, d->members) {
if (item->itemType() == GroupItemType) { if (item->itemType() == GroupItemType) {
kDebug() << (dynamic_cast<TaskGroup*>(item))->name(); kDebug() << (qobject_cast<TaskGroup*>(item))->name();
} else { } else {
kDebug() << (dynamic_cast<TaskItem*>(item))->task()->visibleName(); kDebug() << (qobject_cast<TaskItem*>(item))->task()->visibleName();
} }
}*/ }*/
emit itemAdded(item); emit itemAdded(item);
@ -301,9 +301,9 @@ void TaskGroup::remove(AbstractGroupableItem *item)
/* /*
if (item->itemType() == GroupItemType) { if (item->itemType() == GroupItemType) {
kDebug() << "Remove group" << (dynamic_cast<TaskGroup*>(item))->name(); kDebug() << "Remove group" << (qobject_cast<TaskGroup*>(item))->name();
} else if ((dynamic_cast<TaskItem*>(item))->task()) { } else if ((qobject_cast<TaskItem*>(item))->task()) {
kDebug() << "Remove item" << (dynamic_cast<TaskItem*>(item))->task()->visibleName(); kDebug() << "Remove item" << (qobject_cast<TaskItem*>(item))->task()->visibleName();
} }
kDebug() << "from Group: " << name(); kDebug() << "from Group: " << name();
*/ */
@ -311,9 +311,9 @@ void TaskGroup::remove(AbstractGroupableItem *item)
/* kDebug() << "GroupMembers: "; /* kDebug() << "GroupMembers: ";
foreach (AbstractGroupableItem *item, d->members) { foreach (AbstractGroupableItem *item, d->members) {
if (item->itemType() == GroupItemType) { if (item->itemType() == GroupItemType) {
kDebug() << (dynamic_cast<TaskGroup*>(item))->name(); kDebug() << (qobject_cast<TaskGroup*>(item))->name();
} else { } else {
kDebug() << (dynamic_cast<TaskItem*>(item))->task()->visibleName(); kDebug() << (qobject_cast<TaskItem*>(item))->task()->visibleName();
} }
}*/ }*/

View file

@ -803,7 +803,7 @@ void MenuLauncherApplet::actionTriggered(QAction *action)
return; return;
} }
for (QWidget* w = action->parentWidget(); w; w = w->parentWidget()) { for (QWidget* w = action->parentWidget(); w; w = w->parentWidget()) {
if (Kickoff::MenuView *view = dynamic_cast<Kickoff::MenuView*>(w)) { if (Kickoff::MenuView *view = qobject_cast<Kickoff::MenuView*>(w)) {
view->actionTriggered(action); view->actionTriggered(action);
break; break;
} }

View file

@ -47,7 +47,7 @@ void AppsEngine::sycocaChanged(const QStringList &changes)
Plasma::Service *AppsEngine::serviceForSource(const QString &name) Plasma::Service *AppsEngine::serviceForSource(const QString &name)
{ {
AppSource *source = dynamic_cast<AppSource*>(containerForSource(name)); AppSource *source = qobject_cast<AppSource*>(containerForSource(name));
// if source does not exist, return null service // if source does not exist, return null service
if (!source) { if (!source) {
return Plasma::DataEngine::serviceForSource(name); return Plasma::DataEngine::serviceForSource(name);

View file

@ -43,7 +43,7 @@ StatusNotifierItemEngine::~StatusNotifierItemEngine()
Plasma::Service* StatusNotifierItemEngine::serviceForSource(const QString &name) Plasma::Service* StatusNotifierItemEngine::serviceForSource(const QString &name)
{ {
StatusNotifierItemSource *source = dynamic_cast<StatusNotifierItemSource*>(containerForSource(name)); StatusNotifierItemSource *source = qobject_cast<StatusNotifierItemSource*>(containerForSource(name));
// if source does not exist, return null service // if source does not exist, return null service
if (!source) { if (!source) {
return Plasma::DataEngine::serviceForSource(name); return Plasma::DataEngine::serviceForSource(name);

View file

@ -34,7 +34,7 @@ TasksEngine::~TasksEngine()
Plasma::Service *TasksEngine::serviceForSource(const QString &name) Plasma::Service *TasksEngine::serviceForSource(const QString &name)
{ {
TaskSource *source = dynamic_cast<TaskSource*>(containerForSource(name)); TaskSource *source = qobject_cast<TaskSource*>(containerForSource(name));
// if source does not exist or it represents a startup task, return a null service // if source does not exist or it represents a startup task, return a null service
if (!source || !source->task()) { if (!source || !source->task()) {
return Plasma::DataEngine::serviceForSource(name); return Plasma::DataEngine::serviceForSource(name);

View file

@ -268,7 +268,7 @@ void PanelAppletOverlay::mouseMoveEvent(QMouseEvent *event)
//kDebug() << "checking view" << view << m_applet->view(); //kDebug() << "checking view" << view << m_applet->view();
if (!view) { if (!view) {
view = dynamic_cast<Plasma::View*>(parent()); view = qobject_cast<Plasma::View*>(parent());
} }
if (!view) { if (!view) {

View file

@ -144,7 +144,7 @@ void SettingsBase::initToolBar()
setupGUI(Save|Create,QString()); setupGUI(Save|Create,QString());
menuBar()->hide(); menuBar()->hide();
// Toolbar & Configuration // Toolbar & Configuration
helpActionMenu->setMenu( dynamic_cast<KMenu*>( factory()->container("help", this) ) ); helpActionMenu->setMenu( qobject_cast<KMenu*>( factory()->container("help", this) ) );
setMinimumSize(620,430); setMinimumSize(620,430);
toolBar()->setMovable(false); // We don't allow any changes toolBar()->setMovable(false); // We don't allow any changes
changeToolBar( BaseMode::Search | BaseMode::Configure | BaseMode::Quit ); changeToolBar( BaseMode::Search | BaseMode::Configure | BaseMode::Quit );