m_handlersForItem.insert(item, handler);
connect(item, &QObject::destroyed, this, [this](QObject *obj) {
- auto item = static_cast<QQuickItem *>(obj);
+ auto item = dynamic_cast<QQuickItem *>(obj);
m_handlersForItem.remove(item);
});
connect(handler, &QObject::destroyed, this, [this](QObject *obj) {
- auto handler = static_cast<WheelHandler *>(obj);
+ auto handler = dynamic_cast<WheelHandler *>(obj);
removeItemHandlerAssociation(handler->target(), handler);
});
}
if (!item || !item->isEnabled()) {
return QObject::eventFilter(watched, event);
}
- auto we = static_cast<QWheelEvent *>(event);
+ auto we = dynamic_cast<QWheelEvent *>(event);
m_wheelEvent.initializeFromEvent(we);
bool shouldBlock = false;
bool Application::event(QEvent *event)
{
if (event->type() == QEvent::FileOpen) {
- const auto openEvent = static_cast<QFileOpenEvent *>(event);
+ const auto openEvent = dynamic_cast<QFileOpenEvent *>(event);
qCDebug(lcApplication) << "macOS: Received a QFileOpenEvent";
if(!openEvent->file().isEmpty()) {
#endif // WITH_WEBENGINE
}
- auto app = static_cast<Application *>(qApp);
+ auto app = dynamic_cast<Application *>(qApp);
connect(app, &Application::isShowingSettingsDialog, this, &WebFlowCredentialsDialog::slotShowSettingsDialog);
_errorLabel = new QLabel();
QFontMetrics fm(font);
QFontMetrics aliasFm(aliasFont);
- auto classif = static_cast<const FolderStatusModel *>(index.model())->classify(index);
+ auto classif = dynamic_cast<const FolderStatusModel *>(index.model())->classify(index);
if (classif == FolderStatusModel::AddButton) {
const int margins = aliasFm.height(); // same as 2*aliasMargin of paint
QFontMetrics fm(qApp->font("QPushButton"));
return;
}
- if (static_cast<const FolderStatusModel *>(index.model())->classify(index) != FolderStatusModel::RootFolder) {
+ if (dynamic_cast<const FolderStatusModel *>(index.model())->classify(index) != FolderStatusModel::RootFolder) {
return;
}
painter->save();
case QEvent::MouseButtonPress:
case QEvent::MouseMove:
if (const auto *view = qobject_cast<const QAbstractItemView *>(option.widget)) {
- auto *me = static_cast<QMouseEvent *>(event);
+ auto *me = dynamic_cast<QMouseEvent *>(event);
QModelIndex index;
if (me->buttons()) {
index = view->indexAt(me->pos());
qCDebug(lcWizard) << "webdav mkdir request finished";
showWarn(tr("Folder was successfully created on %1.").arg(Theme::instance()->appNameGUI()));
slotRefreshFolders();
- _ui.folderEntry->setText(static_cast<MkColJob *>(sender())->path());
+ _ui.folderEntry->setText(dynamic_cast<MkColJob *>(sender())->path());
slotLsColFolderEntry();
}
parent->setToolTip(0, path);
parent->setData(0, Qt::UserRole, path);
} else {
- auto *item = static_cast<SelectiveSyncTreeViewItem *>(findFirstChild(parent, pathTrail.first()));
+ auto *item = dynamic_cast<SelectiveSyncTreeViewItem *>(findFirstChild(parent, pathTrail.first()));
if (!item) {
item = new SelectiveSyncTreeViewItem(parent);
if (parent->checkState(0) == Qt::Checked
QScopedValueRollback<bool> isInserting(_inserting);
_inserting = true;
- auto *root = static_cast<SelectiveSyncTreeViewItem *>(_folderTree->topLevelItem(0));
+ auto *root = dynamic_cast<SelectiveSyncTreeViewItem *>(_folderTree->topLevelItem(0));
QUrl url = _account->davUrl();
QString pathToRemove = url.path();
void SettingsDialog::slotAccountAvatarChanged()
{
- auto *account = static_cast<Account *>(sender());
+ auto *account = dynamic_cast<Account *>(sender());
if (account && _actionForAccount.contains(account)) {
QAction *action = _actionForAccount[account];
if (action) {
void SettingsDialog::slotAccountDisplayNameChanged()
{
- auto *account = static_cast<Account *>(sender());
+ auto *account = dynamic_cast<Account *>(sender());
if (account && _actionForAccount.contains(account)) {
QAction *action = _actionForAccount[account];
if (action) {
void SocketApi::slotSocketDestroyed(QObject *obj)
{
- auto *socket = static_cast<QIODevice *>(obj);
+ auto *socket = dynamic_cast<QIODevice *>(obj);
_listeners.remove(socket);
}
bool ToolTipUpdater::eventFilter(QObject * /*obj*/, QEvent *ev)
{
if (ev->type() == QEvent::ToolTip) {
- auto *helpEvent = static_cast<QHelpEvent *>(ev);
+ auto *helpEvent = dynamic_cast<QHelpEvent *>(ev);
_toolTipPos = helpEvent->globalPos();
}
return false;
ActivityListModel* SortedActivityListModel::activityListModel() const
{
- return static_cast<ActivityListModel*>(sourceModel());
+ return dynamic_cast<ActivityListModel*>(sourceModel());
}
void SortedActivityListModel::setActivityListModel(ActivityListModel* activityListModel)
{
// Reset the credentials when the 'Back' button is used.
- AccountPtr account = static_cast<OwncloudWizard *>(wizard())->account();
+ AccountPtr account = dynamic_cast<OwncloudWizard *>(wizard())->account();
AbstractCredentials *creds = account->credentials();
if (creds) {
if (!creds->inherits("DummyCredentials")) {
// ensure "next" gets the focus, not obSelectLocalFolder
QTimer::singleShot(0, wizard()->button(QWizard::FinishButton), qOverload<>(&QWidget::setFocus));
- auto acc = static_cast<OwncloudWizard *>(wizard())->account();
+ auto acc = dynamic_cast<OwncloudWizard *>(wizard())->account();
auto quotaJob = new PropfindJob(acc, _remoteFolder, this);
quotaJob->setProperties(QList<QByteArray>() << "http://owncloud.org/ns:size");
QUrl OwncloudAdvancedSetupPage::serverUrl() const
{
- const QString urlString = static_cast<OwncloudWizard *>(wizard())->ocUrl();
- const QString user = static_cast<OwncloudWizard *>(wizard())->getCredentials()->user();
+ const QString urlString = dynamic_cast<OwncloudWizard *>(wizard())->ocUrl();
+ const QString user = dynamic_cast<OwncloudWizard *>(wizard())->getCredentials()->user();
QUrl url(urlString);
url.setUserName(user);
void OwncloudAdvancedSetupPage::slotSelectiveSyncClicked()
{
- AccountPtr acc = static_cast<OwncloudWizard *>(wizard())->account();
+ AccountPtr acc = dynamic_cast<OwncloudWizard *>(wizard())->account();
auto *dlg = new SelectiveSyncDialog(acc, _remoteFolder, _selectiveSyncBlacklist, this);
dlg->setAttribute(Qt::WA_DeleteOnClose);
job->setKey(kck);
job->setBinaryData(appPassword.toLatin1());
connect(job, &WritePasswordJob::finished, [this](Job *incoming) {
- auto *writeJob = static_cast<WritePasswordJob *>(incoming);
+ auto *writeJob = dynamic_cast<WritePasswordJob *>(incoming);
if (writeJob->error() == NoError)
qCInfo(lcAccount) << "appPassword stored in keychain";
else
job->setInsecureFallback(false);
job->setKey(kck);
connect(job, &ReadPasswordJob::finished, [this](Job *incoming) {
- auto *readJob = static_cast<ReadPasswordJob *>(incoming);
+ auto *readJob = dynamic_cast<ReadPasswordJob *>(incoming);
QString pwd("");
// Error or no valid public key error out
if (readJob->error() == NoError &&
job->setInsecureFallback(false);
job->setKey(kck);
connect(job, &DeletePasswordJob::finished, [this](Job *incoming) {
- auto *deleteJob = static_cast<DeletePasswordJob *>(incoming);
+ auto *deleteJob = dynamic_cast<DeletePasswordJob *>(incoming);
if (deleteJob->error() == NoError)
qCInfo(lcAccount) << "appPassword deleted from keychain";
else
void ClientSideEncryption::publicKeyFetched(Job *incoming)
{
- auto *readJob = static_cast<ReadPasswordJob *>(incoming);
+ auto *readJob = dynamic_cast<ReadPasswordJob *>(incoming);
auto account = readJob->property(accountProperty).value<AccountPtr>();
Q_ASSERT(account);
void ClientSideEncryption::privateKeyFetched(Job *incoming)
{
- auto *readJob = static_cast<ReadPasswordJob *>(incoming);
+ auto *readJob = dynamic_cast<ReadPasswordJob *>(incoming);
auto account = readJob->property(accountProperty).value<AccountPtr>();
Q_ASSERT(account);
void ClientSideEncryption::mnemonicKeyFetched(QKeychain::Job *incoming)
{
- auto *readJob = static_cast<ReadPasswordJob *>(incoming);
+ auto *readJob = dynamic_cast<ReadPasswordJob *>(incoming);
auto account = readJob->property(accountProperty).value<AccountPtr>();
Q_ASSERT(account);
void HttpCredentials::slotReadJobDone(QKeychain::Job *incoming)
{
- auto *job = static_cast<QKeychain::ReadPasswordJob *>(incoming);
+ auto *job = dynamic_cast<QKeychain::ReadPasswordJob *>(incoming);
QKeychain::Error error = job->error();
// If we can't find the credentials at the keys that include the account id,
void PropagatorCompositeJob::slotSubJobFinished(SyncFileItem::Status status)
{
- auto *subJob = static_cast<PropagatorJob *>(sender());
+ auto *subJob = dynamic_cast<PropagatorJob *>(sender());
ASSERT(subJob);
// Delete the job and remove it from our list of jobs.