diff --git a/doc/release-notes.md b/doc/release-notes.md --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -41,3 +41,8 @@ -------------------- The minimum supported miniUPnPc version is set to 1.9 (API version 10). + +GUI changes +----------- + +- The "Start Bitcoin Core on system login" option has been removed on macOS. diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -49,10 +49,6 @@ #include #if defined(Q_OS_MAC) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - -#include void ForceActivation(); #endif @@ -702,95 +698,6 @@ return true; } -#elif defined(Q_OS_MAC) -// based on: -// https://github.com/Mozketo/LaunchAtLoginController/blob/master/LaunchAtLoginController.m - -// NB: caller must release returned ref if it's not NULL -LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, - CFURLRef findUrl); -LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, - CFURLRef findUrl) { - LSSharedFileListItemRef foundItem = nullptr; - // loop through the list of startup items and try to find the bitcoin app - CFArrayRef listSnapshot = LSSharedFileListCopySnapshot(list, nullptr); - for (int i = 0; !foundItem && i < CFArrayGetCount(listSnapshot); ++i) { - LSSharedFileListItemRef item = - (LSSharedFileListItemRef)CFArrayGetValueAtIndex(listSnapshot, i); - UInt32 resolutionFlags = kLSSharedFileListNoUserInteraction | - kLSSharedFileListDoNotMountVolumes; - CFURLRef currentItemURL = nullptr; - -#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && \ - MAC_OS_X_VERSION_MAX_ALLOWED >= 10100 - if (&LSSharedFileListItemCopyResolvedURL) { - currentItemURL = LSSharedFileListItemCopyResolvedURL( - item, resolutionFlags, nullptr); - } -#if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \ - MAC_OS_X_VERSION_MIN_REQUIRED < 10100 - else { - LSSharedFileListItemResolve(item, resolutionFlags, ¤tItemURL, - nullptr); - } -#endif -#else - LSSharedFileListItemResolve(item, resolutionFlags, ¤tItemURL, - nullptr); -#endif - - if (currentItemURL && CFEqual(currentItemURL, findUrl)) { - // found - CFRetain(foundItem = item); - } - if (currentItemURL) { - CFRelease(currentItemURL); - } - } - CFRelease(listSnapshot); - return foundItem; -} - -bool GetStartOnSystemStartup() { - CFURLRef bitcoinAppUrl = CFBundleCopyBundleURL(CFBundleGetMainBundle()); - LSSharedFileListRef loginItems = LSSharedFileListCreate( - nullptr, kLSSharedFileListSessionLoginItems, nullptr); - LSSharedFileListItemRef foundItem = - findStartupItemInList(loginItems, bitcoinAppUrl); - // findStartupItemInList retains the item it returned, need to release - if (foundItem) { - CFRelease(foundItem); - } - CFRelease(loginItems); - CFRelease(bitcoinAppUrl); - return foundItem; -} - -bool SetStartOnSystemStartup(bool fAutoStart) { - CFURLRef bitcoinAppUrl = CFBundleCopyBundleURL(CFBundleGetMainBundle()); - LSSharedFileListRef loginItems = LSSharedFileListCreate( - nullptr, kLSSharedFileListSessionLoginItems, nullptr); - LSSharedFileListItemRef foundItem = - findStartupItemInList(loginItems, bitcoinAppUrl); - - if (fAutoStart && !foundItem) { - // add bitcoin app to startup item list - LSSharedFileListInsertItemURL(loginItems, - kLSSharedFileListItemBeforeFirst, nullptr, - nullptr, bitcoinAppUrl, nullptr, nullptr); - } else if (!fAutoStart && foundItem) { - // remove item - LSSharedFileListItemRemove(loginItems, foundItem); - } - // findStartupItemInList retains the item it returned, need to release - if (foundItem) { - CFRelease(foundItem); - } - CFRelease(loginItems); - CFRelease(bitcoinAppUrl); - return true; -} -#pragma GCC diagnostic pop #else bool GetStartOnSystemStartup() { diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -74,6 +74,10 @@ #ifdef Q_OS_MAC /* remove Window tab on Mac */ ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow)); + /* hide launch at startup option on macOS */ + ui->bitcoinAtStartup->setVisible(false); + ui->verticalLayout_Main->removeWidget(ui->bitcoinAtStartup); + ui->verticalLayout_Main->removeItem(ui->horizontalSpacer_0_Main); #endif /* remove Wallet tab in case of -disablewallet */