Merge pull request #571 from nextcloud/issues/mac-build

Fixes mac build.
This commit is contained in:
Camila Ayres 2018-08-21 22:47:41 +02:00 committed by GitHub
commit ff9177edc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 10 deletions

2
.gitmodules vendored
View File

@ -1,6 +1,6 @@
[submodule "src/3rdparty/qtmacgoodies"]
path = src/3rdparty/qtmacgoodies
url = https://github.com/guruz/qtmacgoodies.git
url = https://github.com/camilasan/qtmacgoodies.git
[submodule "binary"]
path = binary
url = git://github.com/owncloud/owncloud-client-binary.git

View File

@ -58,7 +58,6 @@
namespace OCC {
const char propertyAccountC[] = "oc_account";
const char propertyMenuC[] = "oc_account_menu";
ownCloudGui::ownCloudGui(Application *parent)
: QObject(parent)
@ -617,11 +616,11 @@ void ownCloudGui::updateContextMenu()
_contextMenu->addMenu(accountMenu);
addAccountContextMenu(account, accountMenu, true);
fetchNavigationApps(account, accountMenu);
fetchNavigationApps(account);
}
} else if (accountList.count() == 1) {
addAccountContextMenu(accountList.first(), _contextMenu.data(), false);
fetchNavigationApps(accountList.first(), _contextMenu.data());
fetchNavigationApps(accountList.first());
}
_contextMenu->addSeparator();
@ -769,10 +768,9 @@ void ownCloudGui::slotEtagResponseHeaderReceived(const QByteArray &value, int st
}
}
void ownCloudGui::fetchNavigationApps(AccountStatePtr account, QMenu *accountMenu){
void ownCloudGui::fetchNavigationApps(AccountStatePtr account){
OcsNavigationAppsJob *job = new OcsNavigationAppsJob(account->account());
job->setProperty(propertyAccountC, QVariant::fromValue(account));
job->setProperty(propertyMenuC, QVariant::fromValue(accountMenu));
job->addRawHeader("If-None-Match", account->navigationAppsEtagResponseHeader());
connect(job, &OcsNavigationAppsJob::appsJobFinished, this, &ownCloudGui::slotNavigationAppsFetched);
connect(job, &OcsNavigationAppsJob::etagResponseHeaderReceived, this, &ownCloudGui::slotEtagResponseHeaderReceived);
@ -829,9 +827,18 @@ void ownCloudGui::slotNavigationAppsFetched(const QJsonDocument &reply, int stat
}
}
if(QObject *accountMenuObj = qvariant_cast<QObject*>(sender()->property(propertyMenuC))){
if(QMenu *accountMenu = dynamic_cast<QMenu*>(accountMenuObj))
buildNavigationAppsMenu(account, accountMenu);
// TODO see pull #523
auto accountList = AccountManager::instance()->accounts();
if(accountList.size() > 1){
// the list of apps will be displayed under the account that it belongs to
foreach (QMenu *accountMenu, _accountMenus) {
if(accountMenu->title() == account->account()->displayName()){
buildNavigationAppsMenu(account, accountMenu);
break;
}
}
} else if(accountList.size() == 1){
buildNavigationAppsMenu(account, _contextMenu.data());
}
}
}

View File

@ -127,7 +127,7 @@ private:
void setPauseOnAllFoldersHelper(bool pause);
void setupActions();
void addAccountContextMenu(AccountStatePtr accountState, QMenu *menu, bool separateMenu);
void fetchNavigationApps(AccountStatePtr account, QMenu *accountMenu);
void fetchNavigationApps(AccountStatePtr account);
void buildNavigationAppsMenu(AccountStatePtr account, QMenu *accountMenu);
QPointer<Systray> _tray;