Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorClaudio Cambra <claudio.cambra@nextcloud.com>2022-10-01 11:26:06 +0300
committerClaudio Cambra <claudio.cambra@nextcloud.com>2022-10-31 20:06:07 +0300
commit685a0362fca890507bd69bfa896b6adc12f6f673 (patch)
treefa30ea469e969747e5e6645558d024505718f9f9 /src
parentf97f39375b7143bc52dce25436648a0317eb2fc9 (diff)
Refactor generation of dialogs, remove need for QSharedPointer and reduce use of pointers
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/systray.cpp22
-rw-r--r--src/gui/systray.h2
2 files changed, 11 insertions, 13 deletions
diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp
index d3cb9a22c..38ef32dbf 100644
--- a/src/gui/systray.cpp
+++ b/src/gui/systray.cpp
@@ -291,13 +291,13 @@ bool Systray::raiseDialogs()
return false;
}
- QVector<QSharedPointer<QQuickWindow>> liveDialogs;
+ QVector<QQuickWindow*> liveDialogs;
- for(const auto &dialog : _dialogs) {
- if(dialog.isNull()) {
+ for(const auto dialog : _dialogs) {
+ if(!dialog) {
continue;
} else if(!dialog->isVisible()) {
- destroyDialog(dialog.data());
+ destroyDialog(dialog);
continue;
}
@@ -334,13 +334,13 @@ void Systray::createFileDetailsDialog(const QString &localPath)
{"localPath", localPath},
};
- const auto fileDetailsDialog = new QQmlComponent(_trayEngine, QStringLiteral("qrc:/qml/src/gui/filedetails/FileDetailsWindow.qml"));
+ QQmlComponent fileDetailsDialog(_trayEngine, QStringLiteral("qrc:/qml/src/gui/filedetails/FileDetailsWindow.qml"));
- if (fileDetailsDialog && !fileDetailsDialog->isError()) {
- const auto createdDialog = fileDetailsDialog->createWithInitialProperties(initialProperties);
- const QSharedPointer<QQuickWindow> dialog(qobject_cast<QQuickWindow*>(createdDialog));
+ if (!fileDetailsDialog.isError()) {
+ const auto createdDialog = fileDetailsDialog.createWithInitialProperties(initialProperties);
+ const auto dialog = qobject_cast<QQuickWindow*>(createdDialog);
- if(dialog.isNull()) {
+ if(!dialog) {
qCWarning(lcSystray) << "File details dialog window resulted in creation of object that was not a window!";
return;
}
@@ -351,10 +351,8 @@ void Systray::createFileDetailsDialog(const QString &localPath)
dialog->raise();
dialog->requestActivate();
- } else if (fileDetailsDialog) {
- qCWarning(lcSystray) << fileDetailsDialog->errorString();
} else {
- qCWarning(lcSystray) << "Unable to open share dialog for unknown reasons...";
+ qCWarning(lcSystray) << fileDetailsDialog.errorString();
}
}
diff --git a/src/gui/systray.h b/src/gui/systray.h
index 3578a977f..7522d9177 100644
--- a/src/gui/systray.h
+++ b/src/gui/systray.h
@@ -173,7 +173,7 @@ private:
QSet<qlonglong> _callsAlreadyNotified;
QPointer<QObject> _editFileLocallyLoadingDialog;
- QVector<QSharedPointer<QQuickWindow>> _dialogs;
+ QVector<QQuickWindow*> _dialogs;
};
} // namespace OCC