diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c1a568b5e54..ce399de24726 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ project(client) include(FeatureSummary) set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/qml) include(${CMAKE_SOURCE_DIR}/NEXTCLOUD.cmake) diff --git a/resources.qrc b/resources.qrc index 16864dfa1488..0aa14347cad2 100644 --- a/resources.qrc +++ b/resources.qrc @@ -1,5 +1,5 @@ - + src/gui/UserStatusSelector.qml src/gui/UserStatusSelectorPage.qml src/gui/EmojiPicker.qml diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e3999f85c7a8..fe799104b3cf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,6 +28,18 @@ set_package_properties(Qt${QT_VERSION_MAJOR}Concurrent PROPERTIES TYPE REQUIRED ) +find_package(Qt${QT_VERSION_MAJOR}WebSockets ${REQUIRED_QT_VERSION} CONFIG QUIET) +set_package_properties(Qt${QT_VERSION_MAJOR}WebSockets PROPERTIES + DESCRIPTION "Qt${QT_VERSION_MAJOR} WebSockets component." + TYPE REQUIRED +) + +find_package(Qt${QT_VERSION_MAJOR}Core5Compat ${REQUIRED_QT_VERSION} CONFIG QUIET) +set_package_properties(Qt${QT_VERSION_MAJOR}Core5Compat PROPERTIES + DESCRIPTION "Qt${QT_VERSION_MAJOR} Core5Compat component." + TYPE REQUIRED +) + find_package(Qt${QT_VERSION_MAJOR}WebEngineWidgets ${REQUIRED_QT_VERSION} CONFIG QUIET) if(APPLE) set_package_properties(Qt${QT_VERSION_MAJOR}WebEngineWidgets PROPERTIES diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index fad2ed6ed0a1..d4293efb5a7a 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -14,9 +14,6 @@ target_link_libraries(cmdCore Qt::Network ) -# Need tokenizer for netrc parser -target_include_directories(cmdCore PRIVATE ${CMAKE_SOURCE_DIR}/src/3rdparty/qtokenizer) - if(UNIX AND NOT APPLE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE") diff --git a/src/cmd/netrcparser.cpp b/src/cmd/netrcparser.cpp index a89eb762289f..266fe4f3e29f 100644 --- a/src/cmd/netrcparser.cpp +++ b/src/cmd/netrcparser.cpp @@ -15,8 +15,7 @@ #include #include #include - -#include +#include #include @@ -59,33 +58,32 @@ bool NetrcParser::parse() } QString content = netrc.readAll(); - QStringTokenizer tokenizer(content, " \n\t"); - tokenizer.setQuoteCharacters("\"'"); + auto tokenizer = QStringTokenizer{content, u" \n\t"}; LoginPair pair; QString machine; bool isDefault = false; - while (tokenizer.hasNext()) { - QString key = tokenizer.next(); + for(auto itToken = tokenizer.cbegin(); itToken != tokenizer.cend(); ++itToken) { + const auto key = *itToken; if (key == defaultKeyword) { tryAddEntryAndClear(machine, pair, isDefault); isDefault = true; continue; // don't read a value } - if (!tokenizer.hasNext()) { + if (itToken != tokenizer.cend()) { qDebug() << "error fetching value for" << key; return false; } - QString value = tokenizer.next(); + auto value = *(++itToken); if (key == machineKeyword) { tryAddEntryAndClear(machine, pair, isDefault); - machine = value; + machine = value.toString(); } else if (key == loginKeyword) { - pair.first = value; + pair.first = value.toString(); } else if (key == passwordKeyword) { - pair.second = value; + pair.second = value.toString(); } // ignore unsupported tokens } tryAddEntryAndClear(machine, pair, isDefault); diff --git a/src/common/filesystembase.cpp b/src/common/filesystembase.cpp index 3f54a6880df6..616ff49be704 100644 --- a/src/common/filesystembase.cpp +++ b/src/common/filesystembase.cpp @@ -326,7 +326,7 @@ bool FileSystem::fileExists(const QString &filename, const QFileInfo &fileInfo) #ifdef Q_OS_WIN QString FileSystem::fileSystemForPath(const QString &path) { - // See also QStorageInfo (Qt >=5.4) and GetVolumeInformationByHandleW (>= Vista) + // See also QStorageInfo (Qt${QT_VERSION_MAJOR} >=5.4) and GetVolumeInformationByHandleW (>= Vista) QString drive = path.left(2); if (!drive.endsWith(QLatin1Char(':'))) return QString(); diff --git a/src/common/utility.cpp b/src/common/utility.cpp index 8cf05493d825..c1af6a850fa5 100644 --- a/src/common/utility.cpp +++ b/src/common/utility.cpp @@ -245,7 +245,7 @@ qint64 Utility::freeDiskSpace(const QString &path) QString Utility::compactFormatDouble(double value, int prec, const QString &unit) { QLocale locale = QLocale::system(); - QChar decPoint = locale.decimalPoint(); + auto decPoint = locale.decimalPoint(); QString str = locale.toString(value, 'f', prec); while (str.endsWith(QLatin1Char('0')) || str.endsWith(decPoint)) { if (str.endsWith(decPoint)) { diff --git a/src/common/utility_unix.cpp b/src/common/utility_unix.cpp index 27e66dc73aad..67b2f1b14878 100644 --- a/src/common/utility_unix.cpp +++ b/src/common/utility_unix.cpp @@ -85,7 +85,6 @@ void setLaunchOnStartup_private(const QString &appName, const QString &guiName, const QString executablePath = runningInsideAppImage ? appImagePath : QCoreApplication::applicationFilePath(); QTextStream ts(&iniFile); - ts.setCodec("UTF-8"); ts << QLatin1String("[Desktop Entry]\n") << QLatin1String("Name=") << guiName << QLatin1Char('\n') << QLatin1String("GenericName=") << QLatin1String("File Synchronizer\n") diff --git a/src/gui/BasicComboBox.qml b/src/gui/BasicComboBox.qml index 8917260d3c9e..5d58230524ab 100644 --- a/src/gui/BasicComboBox.qml +++ b/src/gui/BasicComboBox.qml @@ -13,10 +13,9 @@ */ import QtQuick 2.15 -import QtQuick.Dialogs 1.3 import QtQuick.Layouts 1.15 import QtQuick.Controls 2.15 -import QtGraphicalEffects 1.0 +import Qt5Compat.GraphicalEffects import Style 1.0 diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index a3dd2a540ccf..61c2b59ddd2a 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -1,6 +1,7 @@ project(gui) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Svg Qml Quick QuickControls2 Xml Network) -find_package(KF5Archive REQUIRED) + +set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/qml) if(QUICK_COMPILER) if (${QT_VERSION_MAJOR} STREQUAL "6") @@ -357,10 +358,6 @@ set( final_src ${3rdparty_MOC} ) -if(Qt5Keychain_FOUND) - list(APPEND libsync_LINK_TARGETS qt5keychain) -endif() - # add executable icon on windows and osx include(GenerateIconsUtils) @@ -519,7 +516,6 @@ target_link_libraries(nextcloudCore Qt::Qml Qt::Quick Qt::QuickControls2 - KF5::Archive ) add_subdirectory(socketapi) @@ -534,6 +530,71 @@ set_target_properties(nextcloudCore AUTOMOC ON ) +qt_add_library(desktopclientQmlStyle STATIC) +set_target_properties(desktopclientQmlStyle + PROPERTIES + AUTOUIC ON + AUTOMOC ON +) +target_link_libraries(nextcloudCore PUBLIC desktopclientQmlStyle) +qt_add_qml_module(desktopclientQmlStyle + URI Style + OUTPUT_DIRECTORY Style + VERSION 1.0 + QML_FILES + ../../theme/Style/Style.qml +) + +qt_add_library(desktopclientQml STATIC) +set_target_properties(desktopclientQml + PROPERTIES + AUTOUIC ON + AUTOMOC ON +) +target_link_libraries(nextcloudCore PUBLIC desktopclientQml) +qt_add_qml_module(desktopclientQml + URI com.nextcloud.desktopclient + OUTPUT_DIRECTORY com/nextcloud/desktopclient + VERSION 1.0 + QML_FILES + UserStatusSelector.qml + UserStatusSelectorPage.qml + EmojiPicker.qml + UserStatusSelectorButton.qml + PredefinedStatusButton.qml + BasicComboBox.qml + ErrorBox.qml + tray/Window.qml + tray/UserLine.qml + tray/HeaderButton.qml + tray/SyncStatus.qml + tray/ActivityActionButton.qml + tray/ActivityItem.qml + tray/AutoSizingMenu.qml + tray/ActivityList.qml + tray/FileActivityDialog.qml + tray/UnifiedSearchInputContainer.qml + tray/UnifiedSearchResultFetchMoreTrigger.qml + tray/UnifiedSearchResultItem.qml + tray/UnifiedSearchResultItemSkeleton.qml + tray/UnifiedSearchResultItemSkeletonContainer.qml + tray/UnifiedSearchResultItemSkeletonGradientRectangle.qml + tray/UnifiedSearchResultListItem.qml + tray/UnifiedSearchResultNothingFound.qml + tray/UnifiedSearchResultSectionItem.qml + tray/CustomButton.qml + tray/NCButtonContents.qml + tray/NCButtonBackground.qml + tray/TextButtonContents.qml + tray/ActivityItemContextMenu.qml + tray/ActivityItemActions.qml + tray/ActivityItemContent.qml + tray/TalkReplyTextField.qml + tray/CallNotificationDialog.qml + tray/NCBusyIndicator.qml + tray/NCToolTip.qml +) + target_include_directories(nextcloudCore PUBLIC ${CMAKE_SOURCE_DIR}/src/3rdparty/QProgressIndicator diff --git a/src/gui/PredefinedStatusButton.qml b/src/gui/PredefinedStatusButton.qml index 416f7e752a5b..2815bca5ee0f 100644 --- a/src/gui/PredefinedStatusButton.qml +++ b/src/gui/PredefinedStatusButton.qml @@ -13,7 +13,6 @@ */ import QtQuick 2.15 -import QtQuick.Dialogs 1.3 import QtQuick.Layouts 1.15 import QtQuick.Controls 2.15 diff --git a/src/gui/UserStatusSelector.qml b/src/gui/UserStatusSelector.qml index e7c40e44616f..0dd67fa2b040 100644 --- a/src/gui/UserStatusSelector.qml +++ b/src/gui/UserStatusSelector.qml @@ -12,8 +12,8 @@ * for more details. */ -import QtQuick 2.6 -import QtQuick.Dialogs 1.3 +import QtQml +import QtQuick import QtQuick.Layouts 1.15 import QtQuick.Controls 2.15 import QtQuick.Window 2.15 diff --git a/src/gui/UserStatusSelectorButton.qml b/src/gui/UserStatusSelectorButton.qml index 91310839dea5..8236c250c20f 100644 --- a/src/gui/UserStatusSelectorButton.qml +++ b/src/gui/UserStatusSelectorButton.qml @@ -13,7 +13,6 @@ */ import QtQuick 2.6 -import QtQuick.Dialogs 1.3 import QtQuick.Layouts 1.15 import QtQuick.Controls 2.15 diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index c928c365fb61..d302343cc386 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -197,7 +197,7 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent) addAction(syncNowAction); auto *syncNowWithRemoteDiscovery = new QAction(this); - syncNowWithRemoteDiscovery->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F6)); + syncNowWithRemoteDiscovery->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_F6)); connect(syncNowWithRemoteDiscovery, &QAction::triggered, this, &AccountSettings::slotScheduleCurrentFolderForceRemoteDiscovery); addAction(syncNowWithRemoteDiscovery); diff --git a/src/gui/application.cpp b/src/gui/application.cpp index 31d3c218a63c..56b5e2a55950 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -203,7 +203,7 @@ Application::Application(int &argc, char **argv) { _startedAt.start(); - QRandomGenerator::global()->seed(std::random_device()()); +// QRandomGenerator::global()->seed(std::random_device()()); #ifdef Q_OS_WIN // Ensure OpenSSL config file is only loaded from app directory @@ -219,7 +219,7 @@ Application::Application(int &argc, char **argv) setOrganizationDomain(QLatin1String(APPLICATION_REV_DOMAIN)); // setDesktopFilename to provide wayland compatibility (in general: conformance with naming standards) - // but only on Qt >= 5.7, where setDesktopFilename was introduced + // but only on Qt${QT_VERSION_MAJOR} >= 5.7, where setDesktopFilename was introduced #if (QT_VERSION >= 0x050700) QString desktopFileName = QString(QLatin1String(LINUX_APPLICATION_ID) + QLatin1String(".desktop")); @@ -382,7 +382,7 @@ Application::Application(int &argc, char **argv) QTimer::singleShot(0, this, &Application::slotCheckConnection); // Can't use onlineStateChanged because it is always true on modern systems because of many interfaces - connect(&_networkConfigurationManager, &QNetworkConfigurationManager::configurationChanged, + connect(QNetworkInformation::instance(), &QNetworkInformation::reachabilityChanged, this, &Application::slotSystemOnlineConfigurationChanged); #if defined(BUILD_UPDATER) @@ -468,9 +468,10 @@ void Application::slotCleanup() // FIXME: This is not ideal yet since a ConnectionValidator might already be running and is in // progress of timing out in some seconds. // Maybe we need 2 validators, one triggered by timer, one by network configuration changes? -void Application::slotSystemOnlineConfigurationChanged(QNetworkConfiguration cnf) +void Application::slotSystemOnlineConfigurationChanged() { - if (cnf.state() & QNetworkConfiguration::Active) { + if (QNetworkInformation::instance()->reachability() == QNetworkInformation::Reachability::Site || + QNetworkInformation::instance()->reachability() == QNetworkInformation::Reachability::Online) { const auto list = AccountManager::instance()->accounts(); for (const auto &accountState : list) { accountState->systemOnlineConfigurationChanged(); diff --git a/src/gui/application.h b/src/gui/application.h index 6c00f6a506c5..a9dd133c79dc 100644 --- a/src/gui/application.h +++ b/src/gui/application.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include "qtsingleapplication.h" @@ -106,7 +106,7 @@ protected slots: void slotCleanup(); void slotAccountStateAdded(AccountState *accountState); void slotAccountStateRemoved(AccountState *accountState); - void slotSystemOnlineConfigurationChanged(QNetworkConfiguration); + void slotSystemOnlineConfigurationChanged(); void slotGuiIsShowingSettings(); private: @@ -144,7 +144,6 @@ protected slots: ClientProxy _proxy; - QNetworkConfigurationManager _networkConfigurationManager; QTimer _checkConnectionTimer; #if defined(WITH_CRASHREPORTER) diff --git a/src/gui/folderstatusdelegate.cpp b/src/gui/folderstatusdelegate.cpp index 41fdec7c9583..0b919b4d5863 100644 --- a/src/gui/folderstatusdelegate.cpp +++ b/src/gui/folderstatusdelegate.cpp @@ -321,7 +321,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem & pBarOpt.minimum = 0; pBarOpt.maximum = 100; pBarOpt.progress = overallPercent; - pBarOpt.orientation = Qt::Horizontal; +// pBarOpt.orientation = Qt::Horizontal; pBarOpt.rect = QStyle::visualRect(option.direction, option.rect, pBRect); QApplication::style()->drawControl(QStyle::CE_ProgressBar, &pBarOpt, painter, option.widget); diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp index e1373339832a..0cf415f679e8 100644 --- a/src/gui/folderwizard.cpp +++ b/src/gui/folderwizard.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp index 8834c3567c3f..8c104910c2b0 100644 --- a/src/gui/generalsettings.cpp +++ b/src/gui/generalsettings.cpp @@ -45,7 +45,7 @@ #include #include -#include +//#include #define QTLEGACY (QT_VERSION < QT_VERSION_CHECK(5,9,0)) @@ -110,24 +110,24 @@ QVector createDebugArchiveFileList() void createDebugArchive(const QString &filename) { - const auto entries = createDebugArchiveFileList(); +// const auto entries = createDebugArchiveFileList(); - KZip zip(filename); - zip.open(QIODevice::WriteOnly); +// KZip zip(filename); +// zip.open(QIODevice::WriteOnly); - for (const auto &entry : entries) { - zip.addLocalFile(entry.localFilename, entry.zipFilename); - } +// for (const auto &entry : entries) { +// zip.addLocalFile(entry.localFilename, entry.zipFilename); +// } - const auto clientParameters = QCoreApplication::arguments().join(' ').toUtf8(); - zip.prepareWriting("__nextcloud_client_parameters.txt", {}, {}, clientParameters.size()); - zip.writeData(clientParameters, clientParameters.size()); - zip.finishWriting(clientParameters.size()); +// const auto clientParameters = QCoreApplication::arguments().join(' ').toUtf8(); +// zip.prepareWriting("__nextcloud_client_parameters.txt", {}, {}, clientParameters.size()); +// zip.writeData(clientParameters, clientParameters.size()); +// zip.finishWriting(clientParameters.size()); - const auto buildInfo = QString(OCC::Theme::instance()->about() + "\n\n" + OCC::Theme::instance()->aboutDetails()).toUtf8(); - zip.prepareWriting("__nextcloud_client_buildinfo.txt", {}, {}, buildInfo.size()); - zip.writeData(buildInfo, buildInfo.size()); - zip.finishWriting(buildInfo.size()); +// const auto buildInfo = QString(OCC::Theme::instance()->about() + "\n\n" + OCC::Theme::instance()->aboutDetails()).toUtf8(); +// zip.prepareWriting("__nextcloud_client_buildinfo.txt", {}, {}, buildInfo.size()); +// zip.writeData(buildInfo, buildInfo.size()); +// zip.finishWriting(buildInfo.size()); } } diff --git a/src/gui/main.cpp b/src/gui/main.cpp index d5d106efd0b4..7df2f5e0a526 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -52,9 +52,6 @@ void warnSystray() int main(int argc, char **argv) { - qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-gpu --no-sandbox"); - QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); - #ifdef Q_OS_WIN SetDllDirectory(L""); #endif @@ -66,12 +63,8 @@ int main(int argc, char **argv) // the platformtheme plugin won't try to force qqc2-desktops-style // anymore. // Can be removed once the bug in qqc2-desktop-style is gone. - QQuickStyle::setStyle("Default"); - - // OpenSSL 1.1.0: No explicit initialisation or de-initialisation is necessary. +// QQuickStyle::setStyle("Default"); - QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); #ifdef Q_OS_MAC Mac::CocoaInitializer cocoaInit; // RIIA #endif diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index ab96fe8315e0..f77e118d48ff 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -58,6 +58,7 @@ #include #include #include +#include namespace OCC { @@ -129,8 +130,6 @@ ownCloudGui::ownCloudGui(Application *parent) qmlRegisterUncreatableType("com.nextcloud.desktopclient", 1, 0, "UnifiedSearchResultsListModel", "UnifiedSearchResultsListModel"); qmlRegisterUncreatableType("com.nextcloud.desktopclient", 1, 0, "UserStatus", "Access to Status enum"); - qRegisterMetaTypeStreamOperators(); - qRegisterMetaType("ActivityListModel*"); qRegisterMetaType("UnifiedSearchResultsListModel*"); qRegisterMetaType("UserStatus"); diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index e66cd2a96218..4c3e56573dac 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -39,6 +39,7 @@ #include #include #include +#include namespace { const QString TOOLBAR_CSS() @@ -150,7 +151,7 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) addAction(showLogWindow); auto *showLogWindow2 = new QAction(this); - showLogWindow2->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); + showLogWindow2->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_L)); connect(showLogWindow2, &QAction::triggered, gui, &ownCloudGui::slotToggleLogBrowser); addAction(showLogWindow2); diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp index 3f6b437a62ae..bd97a7a0f8e4 100644 --- a/src/gui/sharelinkwidget.cpp +++ b/src/gui/sharelinkwidget.cpp @@ -32,6 +32,7 @@ #include #include #include +#include namespace { const char *passwordIsSetPlaceholder = "●●●●●●●●"; diff --git a/src/gui/socketapi/socketapi.cpp b/src/gui/socketapi/socketapi.cpp index 4fcf3955c369..9946acac2f58 100644 --- a/src/gui/socketapi/socketapi.cpp +++ b/src/gui/socketapi/socketapi.cpp @@ -277,7 +277,7 @@ SocketApi::SocketApi(QObject *parent) qCDebug(lcSocketApi) << "creating" << info.dir().path() << result; if (result) { QFile::setPermissions(socketPath, - QFile::Permissions(QFile::ReadOwner + QFile::WriteOwner + QFile::ExeOwner)); + QFile::Permissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner)); } } } @@ -371,7 +371,7 @@ void SocketApi::slotReadSocket() } else { functionWithArguments += command + QByteArrayLiteral("(QString,SocketListener*)"); } - Q_ASSERT(staticQtMetaObject.normalizedSignature(functionWithArguments) == functionWithArguments); + Q_ASSERT(staticMetaObject.normalizedSignature(functionWithArguments) == functionWithArguments); const auto out = staticMetaObject.indexOfMethod(functionWithArguments); if (out == -1) { listener->sendError(QStringLiteral("Function %1 not found").arg(QString::fromUtf8(functionWithArguments))); diff --git a/src/gui/socketapi/socketapi.h b/src/gui/socketapi/socketapi.h index f3529f870d49..df6cf633372f 100644 --- a/src/gui/socketapi/socketapi.h +++ b/src/gui/socketapi/socketapi.h @@ -26,7 +26,6 @@ class QUrl; class QLocalSocket; -class QStringList; class QFileInfo; namespace OCC { diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index ee5200038651..f27b5e49e026 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -112,7 +112,8 @@ void Systray::create() _trayEngine->rootContext()->setContextProperty("activityModel", UserModel::instance()->currentActivityModel()); } - QQmlComponent trayWindowComponent(_trayEngine, QStringLiteral("qrc:/qml/src/gui/tray/Window.qml")); + _trayEngine->addImportPath(QStringLiteral(":/")); + QQmlComponent trayWindowComponent(_trayEngine, QStringLiteral("com/nextcloud/desktopclient/Window.qml")); if(trayWindowComponent.isError()) { qCWarning(lcSystray) << trayWindowComponent.errorString(); diff --git a/src/gui/tray/ActivityItemContent.qml b/src/gui/tray/ActivityItemContent.qml index 4ba1b95e8f18..0a8795a941d5 100644 --- a/src/gui/tray/ActivityItemContent.qml +++ b/src/gui/tray/ActivityItemContent.qml @@ -3,7 +3,7 @@ import QtQuick 2.15 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.2 import Style 1.0 -import QtGraphicalEffects 1.15 +import Qt5Compat.GraphicalEffects import com.nextcloud.desktopclient 1.0 RowLayout { diff --git a/src/gui/tray/CallNotificationDialog.qml b/src/gui/tray/CallNotificationDialog.qml index 3d71c8451f24..ad75b76c18f2 100644 --- a/src/gui/tray/CallNotificationDialog.qml +++ b/src/gui/tray/CallNotificationDialog.qml @@ -20,7 +20,7 @@ import com.nextcloud.desktopclient 1.0 import QtQuick.Layouts 1.2 import QtMultimedia 5.15 import QtQuick.Controls 2.15 -import QtGraphicalEffects 1.15 +import Qt5Compat.GraphicalEffects Window { id: root diff --git a/src/gui/tray/HeaderButton.qml b/src/gui/tray/HeaderButton.qml index c101188774da..66a5e57d3fcd 100644 --- a/src/gui/tray/HeaderButton.qml +++ b/src/gui/tray/HeaderButton.qml @@ -4,7 +4,7 @@ import QtQuick 2.9 import QtQuick.Window 2.3 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.2 -import QtGraphicalEffects 1.0 +import Qt5Compat.GraphicalEffects // Custom qml modules are in /theme (and included by resources.qrc) import Style 1.0 diff --git a/src/gui/tray/UnifiedSearchInputContainer.qml b/src/gui/tray/UnifiedSearchInputContainer.qml index 6dc0e17a72d3..75eb4009385b 100644 --- a/src/gui/tray/UnifiedSearchInputContainer.qml +++ b/src/gui/tray/UnifiedSearchInputContainer.qml @@ -1,7 +1,7 @@ import QtQml 2.15 import QtQuick 2.15 import QtQuick.Controls 2.3 -import QtGraphicalEffects 1.0 +import Qt5Compat.GraphicalEffects import Style 1.0 import com.nextcloud.desktopclient 1.0 diff --git a/src/gui/tray/UnifiedSearchResultItem.qml b/src/gui/tray/UnifiedSearchResultItem.qml index 1cf843137678..47f5cdf9020b 100644 --- a/src/gui/tray/UnifiedSearchResultItem.qml +++ b/src/gui/tray/UnifiedSearchResultItem.qml @@ -2,7 +2,7 @@ import QtQml 2.15 import QtQuick 2.9 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.2 -import QtGraphicalEffects 1.0 +import Qt5Compat.GraphicalEffects import Style 1.0 diff --git a/src/gui/tray/UnifiedSearchResultItemSkeleton.qml b/src/gui/tray/UnifiedSearchResultItemSkeleton.qml index a5d845752b8f..85cbf00df425 100644 --- a/src/gui/tray/UnifiedSearchResultItemSkeleton.qml +++ b/src/gui/tray/UnifiedSearchResultItemSkeleton.qml @@ -1,7 +1,7 @@ import QtQml 2.15 import QtQuick 2.15 import QtQuick.Layouts 1.2 -import QtGraphicalEffects 1.15 +import Qt5Compat.GraphicalEffects import Style 1.0 RowLayout { diff --git a/src/gui/tray/UnifiedSearchResultItemSkeletonContainer.qml b/src/gui/tray/UnifiedSearchResultItemSkeletonContainer.qml index 6855cd622a78..a4adc4ec6048 100644 --- a/src/gui/tray/UnifiedSearchResultItemSkeletonContainer.qml +++ b/src/gui/tray/UnifiedSearchResultItemSkeletonContainer.qml @@ -1,7 +1,7 @@ import QtQml 2.15 import QtQuick 2.15 import QtQuick.Layouts 1.15 -import QtGraphicalEffects 1.15 +import Qt5Compat.GraphicalEffects import Style 1.0 diff --git a/src/gui/tray/UnifiedSearchResultItemSkeletonGradientRectangle.qml b/src/gui/tray/UnifiedSearchResultItemSkeletonGradientRectangle.qml index 1450eaf04530..3f0bc1bc1db1 100644 --- a/src/gui/tray/UnifiedSearchResultItemSkeletonGradientRectangle.qml +++ b/src/gui/tray/UnifiedSearchResultItemSkeletonGradientRectangle.qml @@ -15,7 +15,7 @@ import QtQml 2.15 import QtQuick 2.15 import QtQuick.Layouts 1.15 -import QtGraphicalEffects 1.15 +import Qt5Compat.GraphicalEffects import Style 1.0 diff --git a/src/gui/tray/UserLine.qml b/src/gui/tray/UserLine.qml index 204a7c86e615..2dffb7e27ed3 100644 --- a/src/gui/tray/UserLine.qml +++ b/src/gui/tray/UserLine.qml @@ -142,95 +142,95 @@ AbstractButton { color: userMoreButton.hovered || userMoreButton.visualFocus ? Style.lightHover : "transparent" } - AutoSizingMenu { - id: userMoreButtonMenu - closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape - - background: Rectangle { - border.color: Style.menuBorder - color: Style.backgroundColor - radius: 2 - } - - MenuItem { - visible: model.isConnected && model.serverHasUserStatus - height: visible ? implicitHeight : 0 - text: qsTr("Set status") - font.pixelSize: Style.topLinePixelSize - palette.windowText: Style.ncTextColor - hoverEnabled: true - onClicked: showUserStatusSelector(index) - - background: Item { - height: parent.height - width: parent.menu.width - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: parent.parent.hovered ? Style.lightHover : "transparent" - } - } - } - - MenuItem { - text: model.isConnected ? qsTr("Log out") : qsTr("Log in") - font.pixelSize: Style.topLinePixelSize - palette.windowText: Style.ncTextColor - hoverEnabled: true - onClicked: { - model.isConnected ? UserModel.logout(index) : UserModel.login(index) - accountMenu.close() - } - - background: Item { - height: parent.height - width: parent.menu.width - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: parent.parent.hovered ? Style.lightHover : "transparent" - } - } - - Accessible.role: Accessible.Button - Accessible.name: model.isConnected ? qsTr("Log out") : qsTr("Log in") - - onPressed: { - if (model.isConnected) { - UserModel.logout(index) - } else { - UserModel.login(index) - } - accountMenu.close() - } - } - - MenuItem { - id: removeAccountButton - text: qsTr("Remove account") - font.pixelSize: Style.topLinePixelSize - palette.windowText: Style.ncTextColor - hoverEnabled: true - onClicked: { - UserModel.removeAccount(index) - accountMenu.close() - } - - background: Item { - height: parent.height - width: parent.menu.width - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: parent.parent.hovered ? Style.lightHover : "transparent" - } - } - - Accessible.role: Accessible.Button - Accessible.name: text - Accessible.onPressAction: removeAccountButton.clicked() - } - } +// AutoSizingMenu { +// id: userMoreButtonMenu +// closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape + +// background: Rectangle { +// border.color: Style.menuBorder +// color: Style.backgroundColor +// radius: 2 +// } + +// MenuItem { +// visible: model.isConnected && model.serverHasUserStatus +// height: visible ? implicitHeight : 0 +// text: qsTr("Set status") +// font.pixelSize: Style.topLinePixelSize +// palette.windowText: Style.ncTextColor +// hoverEnabled: true +// onClicked: showUserStatusSelector(index) + +// background: Item { +// height: parent.height +// width: parent.menu.width +// Rectangle { +// anchors.fill: parent +// anchors.margins: 1 +// color: parent.parent.hovered ? Style.lightHover : "transparent" +// } +// } +// } + +// MenuItem { +// text: model.isConnected ? qsTr("Log out") : qsTr("Log in") +// font.pixelSize: Style.topLinePixelSize +// palette.windowText: Style.ncTextColor +// hoverEnabled: true +// onClicked: { +// model.isConnected ? UserModel.logout(index) : UserModel.login(index) +// accountMenu.close() +// } + +// background: Item { +// height: parent.height +// width: parent.menu.width +// Rectangle { +// anchors.fill: parent +// anchors.margins: 1 +// color: parent.parent.hovered ? Style.lightHover : "transparent" +// } +// } + +// Accessible.role: Accessible.Button +// Accessible.name: model.isConnected ? qsTr("Log out") : qsTr("Log in") + +// onPressed: { +// if (model.isConnected) { +// UserModel.logout(index) +// } else { +// UserModel.login(index) +// } +// accountMenu.close() +// } +// } + +// MenuItem { +// id: removeAccountButton +// text: qsTr("Remove account") +// font.pixelSize: Style.topLinePixelSize +// palette.windowText: Style.ncTextColor +// hoverEnabled: true +// onClicked: { +// UserModel.removeAccount(index) +// accountMenu.close() +// } + +// background: Item { +// height: parent.height +// width: parent.menu.width +// Rectangle { +// anchors.fill: parent +// anchors.margins: 1 +// color: parent.parent.hovered ? Style.lightHover : "transparent" +// } +// } + +// Accessible.role: Accessible.Button +// Accessible.name: text +// Accessible.onPressAction: removeAccountButton.clicked() +// } +// } } } } // MenuItem userLine diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml index 66a5adf6e298..475baf9df157 100644 --- a/src/gui/tray/Window.qml +++ b/src/gui/tray/Window.qml @@ -2,8 +2,8 @@ import QtQuick 2.15 import QtQuick.Window 2.3 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.2 -import QtGraphicalEffects 1.0 import Qt.labs.platform 1.1 as NativeDialogs +import Qt5Compat.GraphicalEffects import "../" // Custom qml modules are in /theme (and included by resources.qrc) @@ -102,19 +102,6 @@ ApplicationWindow { } } - OpacityMask { - anchors.fill: parent - source: ShaderEffectSource { - sourceItem: trayWindowMainItem - hideSource: true - } - maskSource: Rectangle { - width: trayWindow.width - height: trayWindow.height - radius: Systray.useNormalWindow ? 0.0 : Style.trayWindowRadius - } - } - Drawer { id: userStatusDrawer width: parent.width @@ -204,183 +191,183 @@ ApplicationWindow { } } - Menu { - id: accountMenu - - // x coordinate grows towards the right - // y coordinate grows towards the bottom - x: (currentAccountButton.x + 2) - y: (currentAccountButton.y + Style.trayWindowHeaderHeight + 2) - - width: (Style.currentAccountButtonWidth - 2) - height: Math.min(implicitHeight, maxMenuHeight) - closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape - palette: Style.palette - - background: Rectangle { - border.color: Style.menuBorder - color: Style.backgroundColor - radius: Style.currentAccountButtonRadius - } - - contentItem: ScrollView { - id: accMenuScrollView - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - - data: WheelHandler { - target: accMenuScrollView.contentItem - } - ListView { - implicitHeight: contentHeight - model: accountMenu.contentModel - interactive: true - clip: true - currentIndex: accountMenu.currentIndex - } - } - - onClosed: { - // HACK: reload account Instantiator immediately by restting it - could be done better I guess - // see also onVisibleChanged above - userLineInstantiator.active = false; - userLineInstantiator.active = true; - } - - Instantiator { - id: userLineInstantiator - model: UserModel - delegate: UserLine { - onShowUserStatusSelector: { - userStatusDrawer.openUserStatusDrawer(model.index); - accountMenu.close(); - } - onClicked: UserModel.currentUserId = model.index; - } - onObjectAdded: accountMenu.insertItem(index, object) - onObjectRemoved: accountMenu.removeItem(object) - } - - MenuItem { - id: addAccountButton - height: Style.addAccountButtonHeight - hoverEnabled: true - palette: Theme.systemPalette - - background: Item { - height: parent.height - width: parent.menu.width - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: parent.parent.hovered || parent.parent.visualFocus ? Style.lightHover : "transparent" - } - } - - RowLayout { - anchors.fill: parent - spacing: 0 - - Image { - Layout.leftMargin: 12 - verticalAlignment: Qt.AlignCenter - source: Theme.darkMode ? "qrc:///client/theme/white/add.svg" : "qrc:///client/theme/black/add.svg" - sourceSize.width: Style.headerButtonIconSize - sourceSize.height: Style.headerButtonIconSize - } - Label { - Layout.leftMargin: 14 - text: qsTr("Add account") - color: Style.ncTextColor - font.pixelSize: Style.topLinePixelSize - } - // Filler on the right - Item { - Layout.fillWidth: true - Layout.fillHeight: true - } - } - onClicked: UserModel.addAccount() - - Accessible.role: Accessible.MenuItem - Accessible.name: qsTr("Add new account") - Accessible.onPressAction: addAccountButton.clicked() - } - - Rectangle { - anchors.left: parent.left - anchors.right: parent.right - implicitHeight: 1 - color: Style.menuBorder - } - - MenuItem { - id: syncPauseButton - font.pixelSize: Style.topLinePixelSize - palette.windowText: Style.ncTextColor - hoverEnabled: true - onClicked: Systray.syncIsPaused = !Systray.syncIsPaused - - background: Item { - height: parent.height - width: parent.menu.width - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: parent.parent.hovered || parent.parent.visualFocus ? Style.lightHover : "transparent" - } - } - - Accessible.role: Accessible.MenuItem - Accessible.name: Systray.syncIsPaused ? qsTr("Resume sync for all") : qsTr("Pause sync for all") - Accessible.onPressAction: syncPauseButton.clicked() - } - - MenuItem { - id: settingsButton - text: qsTr("Settings") - font.pixelSize: Style.topLinePixelSize - palette.windowText: Style.ncTextColor - hoverEnabled: true - onClicked: Systray.openSettings() - - background: Item { - height: parent.height - width: parent.menu.width - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: parent.parent.hovered || parent.parent.visualFocus ? Style.lightHover : "transparent" - } - } - - Accessible.role: Accessible.MenuItem - Accessible.name: text - Accessible.onPressAction: settingsButton.clicked() - } - - MenuItem { - id: exitButton - text: qsTr("Exit"); - font.pixelSize: Style.topLinePixelSize - palette.windowText: Style.ncTextColor - hoverEnabled: true - onClicked: Systray.shutdown() - - background: Item { - height: parent.height - width: parent.menu.width - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: parent.parent.hovered || parent.parent.visualFocus ? Style.lightHover : "transparent" - } - } - - Accessible.role: Accessible.MenuItem - Accessible.name: text - Accessible.onPressAction: exitButton.clicked() - } - } +// Menu { +// id: accountMenu + +// // x coordinate grows towards the right +// // y coordinate grows towards the bottom +// x: (currentAccountButton.x + 2) +// y: (currentAccountButton.y + Style.trayWindowHeaderHeight + 2) + +// width: (Style.currentAccountButtonWidth - 2) +// height: Math.min(implicitHeight, maxMenuHeight) +// closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape +// palette: Style.palette + +// background: Rectangle { +// border.color: Style.menuBorder +// color: Style.backgroundColor +// radius: Style.currentAccountButtonRadius +// } + +// contentItem: ScrollView { +// id: accMenuScrollView +// ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + +// data: WheelHandler { +// target: accMenuScrollView.contentItem +// } +// ListView { +// implicitHeight: contentHeight +// model: accountMenu.contentModel +// interactive: true +// clip: true +// currentIndex: accountMenu.currentIndex +// } +// } + +// onClosed: { +// // HACK: reload account Instantiator immediately by restting it - could be done better I guess +// // see also onVisibleChanged above +// userLineInstantiator.active = false; +// userLineInstantiator.active = true; +// } + +// Instantiator { +// id: userLineInstantiator +// model: UserModel +// delegate: UserLine { +// onShowUserStatusSelector: { +// userStatusDrawer.openUserStatusDrawer(model.index); +// accountMenu.close(); +// } +// onClicked: UserModel.currentUserId = model.index; +// } +// onObjectAdded: accountMenu.insertItem(index, object) +// onObjectRemoved: accountMenu.removeItem(object) +// } + +// MenuItem { +// id: addAccountButton +// height: Style.addAccountButtonHeight +// hoverEnabled: true +// palette: Theme.systemPalette + +// background: Item { +// height: parent.height +// width: parent.menu.width +// Rectangle { +// anchors.fill: parent +// anchors.margins: 1 +// color: parent.parent.hovered || parent.parent.visualFocus ? Style.lightHover : "transparent" +// } +// } + +// RowLayout { +// anchors.fill: parent +// spacing: 0 + +// Image { +// Layout.leftMargin: 12 +// verticalAlignment: Qt.AlignCenter +// source: Theme.darkMode ? "qrc:///client/theme/white/add.svg" : "qrc:///client/theme/black/add.svg" +// sourceSize.width: Style.headerButtonIconSize +// sourceSize.height: Style.headerButtonIconSize +// } +// Label { +// Layout.leftMargin: 14 +// text: qsTr("Add account") +// color: Style.ncTextColor +// font.pixelSize: Style.topLinePixelSize +// } +// // Filler on the right +// Item { +// Layout.fillWidth: true +// Layout.fillHeight: true +// } +// } +// onClicked: UserModel.addAccount() + +// Accessible.role: Accessible.MenuItem +// Accessible.name: qsTr("Add new account") +// Accessible.onPressAction: addAccountButton.clicked() +// } + +// Rectangle { +// anchors.left: parent.left +// anchors.right: parent.right +// implicitHeight: 1 +// color: Style.menuBorder +// } + +// MenuItem { +// id: syncPauseButton +// font.pixelSize: Style.topLinePixelSize +// palette.windowText: Style.ncTextColor +// hoverEnabled: true +// onClicked: Systray.syncIsPaused = !Systray.syncIsPaused + +// background: Item { +// height: parent.height +// width: parent.menu.width +// Rectangle { +// anchors.fill: parent +// anchors.margins: 1 +// color: parent.parent.hovered || parent.parent.visualFocus ? Style.lightHover : "transparent" +// } +// } + +// Accessible.role: Accessible.MenuItem +// Accessible.name: Systray.syncIsPaused ? qsTr("Resume sync for all") : qsTr("Pause sync for all") +// Accessible.onPressAction: syncPauseButton.clicked() +// } + +// MenuItem { +// id: settingsButton +// text: qsTr("Settings") +// font.pixelSize: Style.topLinePixelSize +// palette.windowText: Style.ncTextColor +// hoverEnabled: true +// onClicked: Systray.openSettings() + +// background: Item { +// height: parent.height +// width: parent.menu.width +// Rectangle { +// anchors.fill: parent +// anchors.margins: 1 +// color: parent.parent.hovered || parent.parent.visualFocus ? Style.lightHover : "transparent" +// } +// } + +// Accessible.role: Accessible.MenuItem +// Accessible.name: text +// Accessible.onPressAction: settingsButton.clicked() +// } + +// MenuItem { +// id: exitButton +// text: qsTr("Exit"); +// font.pixelSize: Style.topLinePixelSize +// palette.windowText: Style.ncTextColor +// hoverEnabled: true +// onClicked: Systray.shutdown() + +// background: Item { +// height: parent.height +// width: parent.menu.width +// Rectangle { +// anchors.fill: parent +// anchors.margins: 1 +// color: parent.parent.hovered || parent.parent.visualFocus ? Style.lightHover : "transparent" +// } +// } + +// Accessible.role: Accessible.MenuItem +// Accessible.name: text +// Accessible.onPressAction: exitButton.clicked() +// } +// } background: Rectangle { color: parent.hovered || parent.visualFocus ? UserModel.currentUser.headerTextColor : "transparent" @@ -499,23 +486,6 @@ ApplicationWindow { } } } - - ColorOverlay { - cached: true - color: UserModel.currentUser.headerTextColor - width: source.width - height: source.height - source: Image { - Layout.alignment: Qt.AlignRight - verticalAlignment: Qt.AlignCenter - Layout.margins: Style.accountDropDownCaretMargin - source: "qrc:///client/theme/white/caret-down.svg" - sourceSize.width: Style.accountDropDownCaretSize - sourceSize.height: Style.accountDropDownCaretSize - Accessible.role: Accessible.PopupMenu - Accessible.name: qsTr("Account switcher and settings menu") - } - } } } @@ -614,64 +584,64 @@ ApplicationWindow { Accessible.name: qsTr("More apps") Accessible.onPressAction: trayWindowAppsButton.clicked() - Menu { - id: appsMenu - x: -2 - y: (trayWindowAppsButton.y + trayWindowAppsButton.height + 2) - width: Style.trayWindowWidth * 0.35 - height: implicitHeight + y > Style.trayWindowHeight ? Style.trayWindowHeight - y : implicitHeight - closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape - - background: Rectangle { - border.color: Style.menuBorder - color: Style.backgroundColor - radius: 2 - } - - contentItem: ScrollView { - id: appsMenuScrollView - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - - data: WheelHandler { - target: appsMenuScrollView.contentItem - } - ListView { - id: appsMenuListView - implicitHeight: contentHeight - model: UserAppsModel - interactive: true - clip: true - currentIndex: appsMenu.currentIndex - delegate: MenuItem { - id: appEntry - anchors.left: parent.left - anchors.right: parent.right - - text: model.appName - font.pixelSize: Style.topLinePixelSize - palette.windowText: Style.ncTextColor - icon.source: model.appIconUrl - icon.color: Style.ncTextColor - onTriggered: UserAppsModel.openAppUrl(appUrl) - hoverEnabled: true - - background: Item { - height: parent.height - width: parent.width - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: parent.parent.hovered || parent.parent.visualFocus ? Style.lightHover : "transparent" - } - } - - Accessible.role: Accessible.MenuItem - Accessible.name: qsTr("Open %1 in browser").arg(model.appName) - Accessible.onPressAction: appEntry.triggered() - } - } - } - } +// Menu { +// id: appsMenu +// x: -2 +// y: (trayWindowAppsButton.y + trayWindowAppsButton.height + 2) +// width: Style.trayWindowWidth * 0.35 +// height: implicitHeight + y > Style.trayWindowHeight ? Style.trayWindowHeight - y : implicitHeight +// closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape + +// background: Rectangle { +// border.color: Style.menuBorder +// color: Style.backgroundColor +// radius: 2 +// } + +// contentItem: ScrollView { +// id: appsMenuScrollView +// ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + +// data: WheelHandler { +// target: appsMenuScrollView.contentItem +// } +// ListView { +// id: appsMenuListView +// implicitHeight: contentHeight +// model: UserAppsModel +// interactive: true +// clip: true +// currentIndex: appsMenu.currentIndex +// delegate: MenuItem { +// id: appEntry +// anchors.left: parent.left +// anchors.right: parent.right + +// text: model.appName +// font.pixelSize: Style.topLinePixelSize +// palette.windowText: Style.ncTextColor +// icon.source: model.appIconUrl +// icon.color: Style.ncTextColor +// onTriggered: UserAppsModel.openAppUrl(appUrl) +// hoverEnabled: true + +// background: Item { +// height: parent.height +// width: parent.width +// Rectangle { +// anchors.fill: parent +// anchors.margins: 1 +// color: parent.parent.hovered || parent.parent.visualFocus ? Style.lightHover : "transparent" +// } +// } + +// Accessible.role: Accessible.MenuItem +// Accessible.name: qsTr("Open %1 in browser").arg(model.appName) +// Accessible.onPressAction: appEntry.triggered() +// } +// } +// } +// } } } } // Rectangle trayWindowHeaderBackground diff --git a/src/gui/wizard/linklabel.cpp b/src/gui/wizard/linklabel.cpp index 918e9dc7f91c..e95171528bad 100644 --- a/src/gui/wizard/linklabel.cpp +++ b/src/gui/wizard/linklabel.cpp @@ -27,7 +27,7 @@ void LinkLabel::setUrl(const QUrl &url) this->url = url; } -void LinkLabel::enterEvent(QEvent * /*event*/) +void LinkLabel::enterEvent(QEnterEvent * /*event*/) { setFontUnderline(true); setCursor(Qt::PointingHandCursor); diff --git a/src/gui/wizard/linklabel.h b/src/gui/wizard/linklabel.h index eb4ba0f814c6..c97e67f9373d 100644 --- a/src/gui/wizard/linklabel.h +++ b/src/gui/wizard/linklabel.h @@ -31,7 +31,7 @@ class LinkLabel : public QLabel void clicked(); protected: - void enterEvent(QEvent *event) override; + void enterEvent(QEnterEvent *event) override; void leaveEvent(QEvent *event) override; diff --git a/src/libsync/CMakeLists.txt b/src/libsync/CMakeLists.txt index b7b504190eb2..92459a1b6c75 100644 --- a/src/libsync/CMakeLists.txt +++ b/src/libsync/CMakeLists.txt @@ -166,8 +166,6 @@ IF (NOT APPLE) ) ENDIF(NOT APPLE) -find_package(Qt6 ${REQUIRED_QT_VERSION} COMPONENTS REQUIRED WebSockets) - add_library(nextcloudsync SHARED ${libsync_SRCS}) add_library(Nextcloud::sync ALIAS nextcloudsync) @@ -180,11 +178,12 @@ target_link_libraries(nextcloudsync Qt::Core Qt::Network Qt::WebSockets + Qt::Core5Compat ) if (NOT TOKEN_AUTH_ONLY) find_package(Qt6 ${REQUIRED_QT_VERSION} COMPONENTS REQUIRED Widgets Svg) - target_link_libraries(nextcloudsync PUBLIC Qt::Widgets Qt::Svg qt5keychain) + target_link_libraries(nextcloudsync PUBLIC Qt::Widgets Qt::Svg Qt6Keychain::Qt6Keychain) endif() if(Inotify_FOUND) diff --git a/src/libsync/accessmanager.cpp b/src/libsync/accessmanager.cpp index 00b08d3f585a..4c5de659b20e 100644 --- a/src/libsync/accessmanager.cpp +++ b/src/libsync/accessmanager.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include "cookiejar.h" diff --git a/src/libsync/bandwidthmanager.cpp b/src/libsync/bandwidthmanager.cpp index a8dd2a6b11c5..38ebe82d6f0f 100644 --- a/src/libsync/bandwidthmanager.cpp +++ b/src/libsync/bandwidthmanager.cpp @@ -31,7 +31,7 @@ namespace OCC { Q_LOGGING_CATEGORY(lcBandwidthManager, "nextcloud.sync.bandwidthmanager", QtInfoMsg) -// Because of the many layers of buffering inside Qt (and probably the OS and the network) +// Because of the many layers of buffering inside Qt${QT_VERSION_MAJOR} (and probably the OS and the network) // we cannot lower this value much more. If we do, the estimated bw will be very high // because the buffers fill fast while the actual network algorithms are not relevant yet. static qint64 relativeLimitMeasuringTimerIntervalMsec = 1000 * 2; diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index 1f4576564207..00a7b7f511b5 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -414,7 +414,9 @@ static void propertyMapToRemoteInfo(const QMap &map, RemoteInf if (property == QLatin1String("resourcetype")) { result.isDirectory = value.contains(QLatin1String("collection")); } else if (property == QLatin1String("getlastmodified")) { + value.replace("GMT", "+0000"); const auto date = QDateTime::fromString(value, Qt::RFC2822Date); + qCInfo(lcDiscovery()) << value << date << date.isValid() << QDateTime::currentDateTime().toString(Qt::RFC2822Date); Q_ASSERT(date.isValid()); result.modtime = 0; if (date.toSecsSinceEpoch() > 0) { diff --git a/src/libsync/logger.cpp b/src/libsync/logger.cpp index 294ad2bb6b70..fdf6eefcf7f4 100644 --- a/src/libsync/logger.cpp +++ b/src/libsync/logger.cpp @@ -83,7 +83,7 @@ void Logger::postGuiMessage(const QString &title, const QString &message) bool Logger::isLoggingToFile() const { QMutexLocker lock(&_mutex); - return _logstream; + return static_cast(_logstream); } void Logger::doLog(QtMsgType type, const QMessageLogContext &ctx, const QString &message) @@ -179,7 +179,6 @@ void Logger::setLogFile(const QString &name) } _logstream.reset(new QTextStream(&_logFile)); - _logstream->setCodec(QTextCodec::codecForName("UTF-8")); } void Logger::setLogExpire(int expire) diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index c39d63989306..0f7f8e1fd2b1 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -516,7 +516,7 @@ void SyncEngine::startSync() qCInfo(lcEngine) << "Sync with existing sync journal"; } - QString verStr("Using Qt "); + QString verStr("Using Qt${QT_VERSION_MAJOR} "); verStr.append(qVersion()); verStr.append(" SSL library ").append(QSslSocket::sslLibraryVersionString().toUtf8().data()); diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index 4419bc8b18d0..ee2005b431e6 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -498,7 +498,7 @@ QString Theme::gitSHA1() const const QString gitSha1(QLatin1String(GIT_SHA1)); devString = QCoreApplication::translate("nextcloudTheme::about()", "

Built from Git revision %2" - " on %3, %4 using Qt %5, %6

") + " on %3, %4 using Qt${QT_VERSION_MAJOR} %5, %6

") .arg(githubPrefix + gitSha1) .arg(gitSha1.left(6)) .arg(__DATE__) @@ -769,7 +769,7 @@ QString Theme::versionSwitchOutput() const #ifdef GIT_SHA1 stream << "Git revision " << GIT_SHA1 << Qt::endl; #endif - stream << "Using Qt " << qVersion() << ", built against Qt " << QT_VERSION_STR << Qt::endl; + stream << "Using Qt${QT_VERSION_MAJOR} " << qVersion() << ", built against Qt${QT_VERSION_MAJOR} " << QT_VERSION_STR << Qt::endl; if(!QGuiApplication::platformName().isEmpty()) stream << "Using Qt platform plugin '" << QGuiApplication::platformName() << "'" << Qt::endl; diff --git a/test/syncenginetestutils.cpp b/test/syncenginetestutils.cpp index 70b87bb5a9d6..d5d507c819c2 100644 --- a/test/syncenginetestutils.cpp +++ b/test/syncenginetestutils.cpp @@ -979,31 +979,31 @@ QNetworkReply *FakeQNAM::createRequest(QNetworkAccessManager::Operation op, cons FileInfo &info = isUpload ? _uploadFileInfo : _remoteRootFileInfo; auto verb = newRequest.attribute(QNetworkRequest::CustomVerbAttribute); - if (verb == QLatin1String("PROPFIND")) { + if (verb == QByteArray("PROPFIND")) { // Ignore outgoingData always returning somethign good enough, works for now. reply = new FakePropfindReply { info, op, newRequest, this }; - } else if (verb == QLatin1String("GET") || op == QNetworkAccessManager::GetOperation) { + } else if (verb == QByteArray("GET") || op == QNetworkAccessManager::GetOperation) { reply = new FakeGetReply { info, op, newRequest, this }; - } else if (verb == QLatin1String("PUT") || op == QNetworkAccessManager::PutOperation) { + } else if (verb == QByteArray("PUT") || op == QNetworkAccessManager::PutOperation) { if (request.hasRawHeader(QByteArrayLiteral("X-OC-Mtime")) && request.rawHeader(QByteArrayLiteral("X-OC-Mtime")).toLongLong() <= 0) { reply = new FakeErrorReply { op, request, this, 500 }; } else { reply = new FakePutReply { info, op, newRequest, outgoingData->readAll(), this }; } - } else if (verb == QLatin1String("MKCOL")) { + } else if (verb == QByteArray("MKCOL")) { reply = new FakeMkcolReply { info, op, newRequest, this }; - } else if (verb == QLatin1String("DELETE") || op == QNetworkAccessManager::DeleteOperation) { + } else if (verb == QByteArray("DELETE") || op == QNetworkAccessManager::DeleteOperation) { reply = new FakeDeleteReply { info, op, newRequest, this }; - } else if (verb == QLatin1String("MOVE") && !isUpload) { + } else if (verb == QByteArray("MOVE") && !isUpload) { reply = new FakeMoveReply { info, op, newRequest, this }; - } else if (verb == QLatin1String("MOVE") && isUpload) { + } else if (verb == QByteArray("MOVE") && isUpload) { reply = new FakeChunkMoveReply { info, _remoteRootFileInfo, op, newRequest, this }; - } else if (verb == QLatin1String("POST") || op == QNetworkAccessManager::PostOperation) { + } else if (verb == QByteArray("POST") || op == QNetworkAccessManager::PostOperation) { if (contentType.startsWith(QStringLiteral("multipart/related; boundary="))) { reply = new FakePutMultiFileReply { info, op, newRequest, contentType, outgoingData->readAll(), this }; } - } else if (verb == QLatin1String("LOCK") || verb == QLatin1String("UNLOCK")) { + } else if (verb == QByteArray("LOCK") || verb == QByteArray("UNLOCK")) { reply = new FakeFileLockReply{info, op, newRequest, this}; } else { qDebug() << verb << outgoingData; diff --git a/test/testactivitydata.cpp b/test/testactivitydata.cpp index 28def53293a1..c9ce335ba133 100644 --- a/test/testactivitydata.cpp +++ b/test/testactivitydata.cpp @@ -38,7 +38,7 @@ class TestActivityData : public QObject const auto path = QStringLiteral("path/test.").append(fileFormat); const auto fileName = QStringLiteral("test.").append(fileFormat); const auto activityType = QStringLiteral("file"); - const auto activityId = 90000; + const auto activityId = QStringLiteral("90000"); const auto message = QStringLiteral(); const auto objectName = QStringLiteral("test.").append(fileFormat); const auto link = account->url().toString().append(QStringLiteral("/f/")).append(activityId); diff --git a/test/testchunkingng.cpp b/test/testchunkingng.cpp index 66f5a2d432c6..602f2da5a54f 100644 --- a/test/testchunkingng.cpp +++ b/test/testchunkingng.cpp @@ -577,7 +577,6 @@ private slots: } void testPercentEncoding() { - QTextCodec::codecForLocale()->setCodecForLocale(QTextCodec::codecForName("UTF-8")); FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()}; fakeFolder.syncEngine().account()->setCapabilities({ { "dav", QVariantMap{ {"chunking", "1.0"} } } }); const int size = 5 * 1000 * 1000; diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp index 7a562bca5fb7..c0359c1c3dee 100644 --- a/test/testsyncengine.cpp +++ b/test/testsyncengine.cpp @@ -9,6 +9,7 @@ #include "syncenginetestutils.h" #include #include +#include using namespace OCC;