From 6cb9e72db7097a9c2f8d3e458e1f18b04e4ba2e8 Mon Sep 17 00:00:00 2001 From: Eugen Fischer Date: Sat, 6 Jan 2024 15:40:22 +0100 Subject: [PATCH] Patched stable --- src/gui/navigationpanehelper.cpp | 5 +- src/gui/socketapi/socketapi.cpp | 91 ++++++++++++++++++-------------- 2 files changed, 55 insertions(+), 41 deletions(-) diff --git a/src/gui/navigationpanehelper.cpp b/src/gui/navigationpanehelper.cpp index ce2bad09c2bb..cdf6f419927d 100644 --- a/src/gui/navigationpanehelper.cpp +++ b/src/gui/navigationpanehelper.cpp @@ -96,9 +96,10 @@ void NavigationPaneHelper::updateCloudStorageRegistry() QString namespacePath = QString() % R"(Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\)" % clsidStr; QString title = folder->shortGuiRemotePathOrAppName(); + title = title % " - " % folder->accountState()->account()->prettyName(); //Magenta Customization // Write the account name in the sidebar only when using more than one account. - if (AccountManager::instance()->accounts().size() > 1) - title = title % " - " % folder->accountState()->account()->displayName(); + //if (AccountManager::instance()->accounts().size() > 1) + // title = title % " - " % folder->accountState()->account()->displayName(); QString iconPath = QDir::toNativeSeparators(qApp->applicationFilePath()); QString targetFolderPath = QDir::toNativeSeparators(folder->cleanPath()); diff --git a/src/gui/socketapi/socketapi.cpp b/src/gui/socketapi/socketapi.cpp index e2e3c1a463fe..e0cd37434240 100644 --- a/src/gui/socketapi/socketapi.cpp +++ b/src/gui/socketapi/socketapi.cpp @@ -551,10 +551,21 @@ void SocketApi::processEncryptRequest(const QString &localFile) "Server replied with error: %2").arg(fileData.folderRelativePath, job->errorString())); Q_UNUSED(ret) } else { - const int ret = QMessageBox::information(nullptr, - tr("Folder encrypted successfully").arg(fileData.folderRelativePath), - tr("The following folder was encrypted successfully: \"%1\"").arg(fileData.folderRelativePath)); - Q_UNUSED(ret) + // const int ret = QMessageBox::information(nullptr, + // tr("Folder encrypted successfully").arg(fileData.folderRelativePath), + // tr("The following folder was encrypted successfully: \"%1\"").arg(fileData.folderRelativePath)); + // Q_UNUSED(ret) + + //Magenta customization + const auto messageBox = new QMessageBox; + messageBox->setAttribute(Qt::WA_DeleteOnClose); + messageBox->setWindowTitle(tr("Folder encrypted successfully").arg(fileData.folderRelativePath)); + messageBox->setText(tr("The following folder was encrypted successfully: \"%1\"").arg(fileData.folderRelativePath)); + const QIcon avatarIcon = QIcon::fromTheme("iconPath", QIcon(":/client/theme/lock.svg")); + QPixmap pixmap = avatarIcon.pixmap(QSize(24, 24)); + messageBox->setIconPixmap(pixmap); + messageBox->addButton(QMessageBox::NoButton); + messageBox->show(); } }); job->setProperty(encryptJobPropertyFolder, QVariant::fromValue(folder)); @@ -1168,38 +1179,39 @@ void SocketApi::sendSharingContextMenuOptions(const FileData &fileData, SocketLi // If sharing is globally disabled, do not show any sharing entries. // If there is no permission to share for this file, add a disabled entry saying so - if (isOnTheServer && !record._remotePerm.isNull() && !record._remotePerm.hasPermission(RemotePermissions::CanReshare)) { - listener->sendMessage(QLatin1String("MENU_ITEM:DISABLED:d:") + (!record.isDirectory() ? tr("Resharing this file is not allowed") : tr("Resharing this folder is not allowed"))); - } else { - listener->sendMessage(QLatin1String("MENU_ITEM:SHARE") + flagString + tr("Share options")); - - // Do we have public links? - bool publicLinksEnabled = theme->linkSharing() && capabilities.sharePublicLink(); - - // Is is possible to create a public link without user choices? - bool canCreateDefaultPublicLink = publicLinksEnabled - && !capabilities.sharePublicLinkEnforceExpireDate() - && !capabilities.sharePublicLinkAskOptionalPassword() - && !capabilities.sharePublicLinkEnforcePassword(); - - if (canCreateDefaultPublicLink) { - if (isSecureFileDropSupported) { - listener->sendMessage(QLatin1String("MENU_ITEM:COPY_SECUREFILEDROP_LINK") + QLatin1String("::") + tr("Copy secure file drop link")); - } else { - listener->sendMessage(QLatin1String("MENU_ITEM:COPY_PUBLIC_LINK") + flagString + tr("Copy public link")); - } - } else if (publicLinksEnabled) { - if (isSecureFileDropSupported) { - listener->sendMessage(QLatin1String("MENU_ITEM:MANAGE_PUBLIC_LINKS") + QLatin1String("::") + tr("Copy secure filedrop link")); - } else { - listener->sendMessage(QLatin1String("MENU_ITEM:MANAGE_PUBLIC_LINKS") + flagString + tr("Copy public link")); - } - } - } - - if (itemEncryptionFlag == SharingContextItemEncryptedFlag::NotEncryptedItem) { - listener->sendMessage(QLatin1String("MENU_ITEM:COPY_PRIVATE_LINK") + flagString + tr("Copy internal link")); - } + //Magenta customization + // if (isOnTheServer && !record._remotePerm.isNull() && !record._remotePerm.hasPermission(RemotePermissions::CanReshare)) { + // listener->sendMessage(QLatin1String("MENU_ITEM:DISABLED:d:") + (!record.isDirectory() ? tr("Resharing this file is not allowed") : tr("Resharing this folder is not allowed"))); + // } else { + // listener->sendMessage(QLatin1String("MENU_ITEM:SHARE") + flagString + tr("Share options")); + + // // Do we have public links? + // bool publicLinksEnabled = theme->linkSharing() && capabilities.sharePublicLink(); + + // // Is is possible to create a public link without user choices? + // bool canCreateDefaultPublicLink = publicLinksEnabled + // && !capabilities.sharePublicLinkEnforceExpireDate() + // && !capabilities.sharePublicLinkAskOptionalPassword() + // && !capabilities.sharePublicLinkEnforcePassword(); + + // if (canCreateDefaultPublicLink) { + // if (isSecureFileDropSupported) { + // listener->sendMessage(QLatin1String("MENU_ITEM:COPY_SECUREFILEDROP_LINK") + QLatin1String("::") + tr("Copy secure file drop link")); + // } else { + // listener->sendMessage(QLatin1String("MENU_ITEM:COPY_PUBLIC_LINK") + flagString + tr("Copy public link")); + // } + // } else if (publicLinksEnabled) { + // if (isSecureFileDropSupported) { + // listener->sendMessage(QLatin1String("MENU_ITEM:MANAGE_PUBLIC_LINKS") + QLatin1String("::") + tr("Copy secure filedrop link")); + // } else { + // listener->sendMessage(QLatin1String("MENU_ITEM:MANAGE_PUBLIC_LINKS") + flagString + tr("Copy public link")); + // } + // } + // } + + // if (itemEncryptionFlag == SharingContextItemEncryptedFlag::NotEncryptedItem) { + // listener->sendMessage(QLatin1String("MENU_ITEM:COPY_PRIVATE_LINK") + flagString + tr("Copy internal link")); + // } // Disabled: only providing email option for private links would look odd, // and the copy option is more general. @@ -1363,9 +1375,10 @@ void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListe const QFileInfo fileInfo(fileData.localPath); sendLockFileInfoMenuEntries(fileInfo, syncFolder, fileData, listener, record); - if (!fileInfo.isDir()) { - listener->sendMessage(QLatin1String("MENU_ITEM:ACTIVITY") + flagString + tr("Activity")); - } + //Magenta customization + // if (!fileInfo.isDir()) { + // listener->sendMessage(QLatin1String("MENU_ITEM:ACTIVITY") + flagString + tr("Activity")); + // } DirectEditor* editor = getDirectEditorForLocalFile(fileData.localPath); if (editor) {