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

Hostname validation and sync start if proxy settings changes #6140

Closed
wants to merge 4 commits into from

Conversation

BergerVi
Copy link

@BergerVi BergerVi commented Nov 5, 2017

(good first issue)

  1. Issue:
    [Proxy Settings] Validate for empty hostname when manual proxy is selected [Proxy Settings] Validate for empty hostname when manual proxy is selected #5885

  2. Issue:
    Proxy change in Settings dialog should trigger sync Proxy change in Settings dialog should trigger sync #3233

@CLAassistant
Copy link

CLAassistant commented Nov 5, 2017

CLA assistant check
All committers have signed the CLA.

@ckamm
Copy link
Contributor

ckamm commented Nov 6, 2017

@wiggiBe This looks good!

  1. Did you sign the contribution agreement already? Can I help with this?

  2. I'm not sure startScheduledSyncSoon is the right choice here. Wouldn't you want to schedule all folders? But that happens automatically when an account becomes connected. So maybe the actual thing you want to trigger is an account-connectivity-check? (so you don't have to wait for 30s)

AccountState::checkConnectivity() would do that.

@ckamm ckamm self-requested a review November 6, 2017 11:52
@ckamm ckamm added this to the 2.5.0 milestone Nov 6, 2017
@ckamm ckamm self-assigned this Nov 6, 2017
@BergerVi
Copy link
Author

BergerVi commented Nov 6, 2017

Sorry, I didn't. I will sign it right away.

Oh, I see. I thought it would trigger a almost instant sync in all folders which are scheduled.
Do AccountState::checkConnectivity() really trigger a sync for a signed account?

@ckamm
Copy link
Contributor

ckamm commented Nov 7, 2017

@wiggiBe In the use case of "The account is disconnected and the user enters the proxy information" it would do it - the account will connect and all folders will be scheduled.

You also want to schedule all folders in cases where the account was already connected? (say, switching between two working proxys)

In that case you'd need to set the AccountState to Disconnected first. Then checkConnectivity would attempt using the new proxy and, if successful, set the state to Connected again and schedule all folders.

@BergerVi
Copy link
Author

BergerVi commented Nov 7, 2017

That wasn't my intention but it makes sense to disconnect first and connect the account again.
I will do that.
Thank you.

@@ -277,9 +280,6 @@ private slots:
/* unloads a folder object, does not delete it */
void unloadFolder(Folder *);

/** Will start a sync after a bit of delay. */
void startScheduledSyncSoon();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you move this? :-)
Use git show before pushing to see the commit if it makes sense.
You can use git commit --amend to change your existing commit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was private and needed to be public. Should be undone when the Account reconnection is used instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ckamm Meh, github didn't display the context properly. I thought he changed it from "private slots" to not being a slot.

Copy link
Author

@BergerVi BergerVi Nov 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ckamm Indeed I will undo that.

@guruz Thank you for you help. :)
Unfortunately git commit --amend dont work because in my last commit I deleted some comments but I allready changed the postion of startScheduledSyncSoon().

@BergerVi
Copy link
Author

BergerVi commented Nov 9, 2017

@ckamm Do I have to do a connectivity check for every saved account? (So I have to get a list of all accounts from accountmanager)

@ckamm
Copy link
Contributor

ckamm commented Nov 10, 2017

@wiggiBe Yes, I'd iterate through the accounts, disconnect them (there's no function for that yet, you need to add one) and trigger the connectivity check.

Copy link
Contributor

@ogoffart ogoffart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do
git rebase -i origin/master
to squash the commit.

After doing that, please do
git-clang-format origin/master
to fix the coding style.

}
else
{
_ui->hostLineEdit->setStyleSheet("border: 1px solid black"); // or blue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean "border: native" ?
or just _ui->hostLineEdit->setStyleSheet(QString())

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thank you. "border: native" is very good.

@ogoffart
Copy link
Contributor

The change does not build:

Jenkins error:

/var/lib/jenkins/workspace/cloud-client_client_PR-6140-VJ2XIDBENLXHDCMPYD3F44RPONFPGAIGK6ABLT3J66BPSU4OUQQQ/src/gui/networksettings.cpp: In member function ‘void OCC::NetworkSettings::saveProxySettings()’:
/var/lib/jenkins/workspace/cloud-client_client_PR-6140-VJ2XIDBENLXHDCMPYD3F44RPONFPGAIGK6ABLT3J66BPSU4OUQQQ/src/gui/networksettings.cpp:192:33: error: base operand of ‘->’ has non-pointer type ‘QList<QExplicitlySharedDataPointer<OCC::AccountState> >’
     for(int i=0; i < accountList->count(); i++)
                                 ^
/var/lib/jenkins/workspace/cloud-client_client_PR-6140-VJ2XIDBENLXHDCMPYD3F44RPONFPGAIGK6ABLT3J66BPSU4OUQQQ/src/gui/networksettings.cpp:196:13: error: ‘acouuntList’ was not declared in this scope
             acouuntList[i]->disconnectByProxySettings();
             ^

FolderMan::instance()->startScheduledSyncSoon();
QList<AccountStatePtr> accountList = AccountManager::instance()->accounts();

for(int i=0; i < accountList->count(); i++)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for (auto account : accountList) {

@ogoffart
Copy link
Contributor

@wiggiBe are you still working on this?

ckamm added a commit that referenced this pull request Jan 4, 2018
Where 'validation' currently just means "check whether it's empty".

Code adapted from wiggiBe's original PR #6140
@ckamm
Copy link
Contributor

ckamm commented Jan 4, 2018

I've reworked and merged it to master!

@ckamm ckamm closed this Jan 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants