Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable-3.12] nmc/2003-FolderView_Settings_Dialog #251

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,6 @@ convert.exe
*-w10startmenu.png
*state-*.png
theme.qrc

# Ignore specific folders
shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ set(CMAKE_XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES)

set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

set(NMC_RCC_FILE "nmctheme_v1.rcc")
configure_file(${CMAKE_SOURCE_DIR}/${NMC_RCC_FILE} "${BIN_OUTPUT_DIRECTORY}/${NMC_RCC_FILE}" COPYONLY)

include(${CMAKE_SOURCE_DIR}/NEXTCLOUD.cmake)

# CfAPI Shell Extensions
Expand Down Expand Up @@ -301,6 +304,7 @@ configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
if(BUILD_OWNCLOUD_OSX_BUNDLE)
install(FILES sync-exclude.lst DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
configure_file(sync-exclude.lst bin/${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY)
install(FILES nmctheme_v1.rcc DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
elseif(BUILD_CLIENT)
install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} )
configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY)
Expand Down
Binary file added nmctheme_v1.rcc
Binary file not shown.
8 changes: 8 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ project(gui)
find_package(Qt5 REQUIRED COMPONENTS Widgets Svg Qml Quick QuickControls2 Xml Network)
find_package(KF5Archive REQUIRED)

#NMC change, its needed to find the ui file in a different location than the header file
set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui")

if(QUICK_COMPILER)
find_package(Qt5QuickCompiler)
set_package_properties(Qt5QuickCompiler PROPERTIES
Expand Down Expand Up @@ -260,6 +263,10 @@ set(client_SRCS
wizard/linklabel.cpp
)

file(GLOB NMC_FILES "nmcgui/*")
set(NMC_SRCS ${NMC_FILES})
list(APPEND client_SRCS ${NMC_SRCS})

if (Qt5WebEngine_FOUND AND Qt5WebEngineWidgets_FOUND)
list(APPEND client_SRCS
wizard/webviewpage.h
Expand Down Expand Up @@ -590,6 +597,7 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
install(FILES ${VISUAL_ELEMENTS} DESTINATION bin/visualelements)
install(FILES "${theme_dir}/${APPLICATION_EXECUTABLE}.VisualElementsManifest.xml" DESTINATION bin)
install(FILES ${client_I18N} DESTINATION i18n)
install(FILES ${CMAKE_SOURCE_DIR}/nmctheme_v1.rcc DESTINATION bin)
endif()

# we may not add MACOSX_BUNDLE here, if not building one
Expand Down
84 changes: 45 additions & 39 deletions src/gui/accountsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class MouseCursorChanger : public QObject
const auto index = folderList->indexAt(pos);
if (model->classify(index) == FolderStatusModel::RootFolder &&
(FolderStatusDelegate::errorsListRect(folderList->visualRect(index)).contains(pos) ||
FolderStatusDelegate::optionsButtonRect(folderList->visualRect(index),folderList->layoutDirection()).contains(pos))) {
FolderStatusDelegate::moreRectPos(folderList->visualRect(index)).contains(pos))) {
shape = Qt::PointingHandCursor;
}
folderList->setCursor(shape);
Expand Down Expand Up @@ -564,8 +564,9 @@ void AccountSettings::slotSubfolderContextMenuRequested(const QModelIndex& index
}
}

ac = menu.addAction(tr("Edit Ignored Files"));
connect(ac, &QAction::triggered, this, &AccountSettings::slotEditCurrentLocalIgnoredFiles);
//NMC customization
// ac = menu.addAction(tr("Edit Ignored Files"));
// connect(ac, &QAction::triggered, this, &AccountSettings::slotEditCurrentLocalIgnoredFiles);

ac = menu.addAction(tr("Create new folder"));
connect(ac, &QAction::triggered, this, &AccountSettings::slotOpenMakeFolderDialog);
Expand Down Expand Up @@ -634,8 +635,9 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos)
auto ac = menu->addAction(tr("Open folder"));
connect(ac, &QAction::triggered, this, &AccountSettings::slotOpenCurrentFolder);

ac = menu->addAction(tr("Edit Ignored Files"));
connect(ac, &QAction::triggered, this, &AccountSettings::slotEditCurrentIgnoredFiles);
//NMC customization
// ac = menu->addAction(tr("Edit Ignored Files"));
// connect(ac, &QAction::triggered, this, &AccountSettings::slotEditCurrentIgnoredFiles);

ac = menu->addAction(tr("Create new folder"));
connect(ac, &QAction::triggered, this, &AccountSettings::slotOpenMakeFolderDialog);
Expand Down Expand Up @@ -677,51 +679,55 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos)
ac->setDisabled(Theme::instance()->enforceVirtualFilesSyncFolder());
}

if (Theme::instance()->showVirtualFilesOption() && !folder->virtualFilesEnabled() && Vfs::checkAvailability(folder->path())) {
const auto mode = bestAvailableVfsMode();
if (mode == Vfs::WindowsCfApi || ConfigFile().showExperimentalOptions()) {
ac = menu->addAction(tr("Enable virtual file support %1 …").arg(mode == Vfs::WindowsCfApi ? QString() : tr("(experimental)")));
// TODO: remove when UX decision is made
ac->setEnabled(!Utility::isPathWindowsDrivePartitionRoot(folder->path()));
//
connect(ac, &QAction::triggered, this, &AccountSettings::slotEnableVfsCurrentFolder);
}
}
// if (Theme::instance()->showVirtualFilesOption() && !folder->virtualFilesEnabled() && Vfs::checkAvailability(folder->path())) {
// const auto mode = bestAvailableVfsMode();
// if (mode == Vfs::WindowsCfApi || ConfigFile().showExperimentalOptions()) {
// ac = menu->addAction(tr("Enable virtual file support %1 …").arg(mode == Vfs::WindowsCfApi ? QString() : tr("(experimental)")));
// // TODO: remove when UX decision is made
// ac->setEnabled(!Utility::isPathWindowsDrivePartitionRoot(folder->path()));
// //
// connect(ac, &QAction::triggered, this, &AccountSettings::slotEnableVfsCurrentFolder);
// }
// }


menu->popup(treeView->mapToGlobal(pos));
}

void AccountSettings::slotFolderListClicked(const QModelIndex &indx)
{
if (indx.data(FolderStatusDelegate::AddButton).toBool()) {
// "Add Folder Sync Connection"
const auto treeView = _ui->_folderList;
const auto pos = treeView->mapFromGlobal(QCursor::pos());
QStyleOptionViewItem opt;
opt.initFrom(treeView);
const auto btnRect = treeView->visualRect(indx);
const auto btnSize = treeView->itemDelegate(indx)->sizeHint(opt, indx);
const auto actual = QStyle::visualRect(opt.direction, btnRect, QRect(btnRect.topLeft(), btnSize));
if (!actual.contains(pos)) {
return;
}

if (indx.flags() & Qt::ItemIsEnabled) {
slotAddFolder();
} else {
QToolTip::showText(
QCursor::pos(),
_model->data(indx, Qt::ToolTipRole).toString(),
this);
}
return;
}
//NMC Customization
//We dont need to look for the "new folder" button. This piece of code calls a function, on where the button should be, and not if it really exists or not.
//Thats why we can not just make the button invisible, the button is drawn in in the paint function (overriden and its not the case), but lacks functionality, its implemented this way.

// if (indx.data(FolderStatusDelegate::AddButton).toBool()) {
// // "Add Folder Sync Connection"
// const auto treeView = _ui->_folderList;
// const auto pos = treeView->mapFromGlobal(QCursor::pos());
// QStyleOptionViewItem opt;
// opt.initFrom(treeView);
// const auto btnRect = treeView->visualRect(indx);
// const auto btnSize = treeView->itemDelegate(indx)->sizeHint(opt, indx);
// const auto actual = QStyle::visualRect(opt.direction, btnRect, QRect(btnRect.topLeft(), btnSize));
// if (!actual.contains(pos)) {
// return;
// }

// if (indx.flags() & Qt::ItemIsEnabled) {
// slotAddFolder();
// } else {
// QToolTip::showText(
// QCursor::pos(),
// _model->data(indx, Qt::ToolTipRole).toString(),
// this);
// }
// return;
// }
if (_model->classify(indx) == FolderStatusModel::RootFolder) {
// tries to find if we clicked on the '...' button.
const auto treeView = _ui->_folderList;
const auto pos = treeView->mapFromGlobal(QCursor::pos());
if (FolderStatusDelegate::optionsButtonRect(treeView->visualRect(indx), layoutDirection()).contains(pos)) {
if (FolderStatusDelegate::moreRectPos(treeView->visualRect(indx)).contains(pos)) {
slotCustomContextMenuRequested(pos);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/accountsetupcommandlinemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ void AccountSetupCommandLineManager::setupAccountFromCommandLine()
_serverUrl.clear();
_remoteDirPath.clear();
_localDirPath.clear();
_isVfsEnabled = true;
_isVfsEnabled = false;
}
}
Loading