Bug 338558 - Network Access setting not remembered
Summary: Network Access setting not remembered
Status: RESOLVED FIXED
Alias: None
Product: trojita
Classification: Applications
Component: Desktop GUI (show other bugs)
Version: git
Platform: Other Microsoft Windows
: NOR wishlist
Target Milestone: ---
Assignee: Trojita default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-25 21:43 UTC by Thomas Braun
Modified: 2014-12-25 19:54 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Braun 2014-08-25 21:43:44 UTC
Version: v0.4.1-321-gbed8ef7
Windows 7 x32
windows binaries as supplied by http://corvus.eu.org/trojita-win-builds/.

I'm on a mobile LTE connection with my notebook and use Trojita.
Setting "Network Access" to "Expensive connection" is only remembered for the current sessions, as soon as I close and reopen trojita the default of "Free Access" is selected again.

I would expect that the setting is remembered after closing.
Comment 1 Jan Kundrát 2014-09-04 09:22:42 UTC
That makes sense. Do you think you could come up with a patch fixing this?
Comment 2 Thomas Braun 2014-09-14 14:31:07 UTC
I can have a try.
Could you give a pointer where to start?
I'm fluent in C++ so a few class names should be sufficient.
Comment 3 Jan Kundrát 2014-09-16 12:11:22 UTC
Sorry for a late reply. These are great news. Look for usages of Common::SettingsNames::imapStartOffline. This bool should probably be extended to be a tri-state enum (reusing the int values of the actual Imap::Mailbox::NetworkPolicy should be OK). This requires a migration of the settings, to be done within Imap::migrateSettings.

The value of that pref is reused within ImapAccess.cpp, ImapAccess::doConnect where it controls an invokeMethod() for triggering an appropriate slot for actually propagating the policy.

Then you also need to remember the user's prefs. The NetworkWatcher.h should be extended with a signal informing about changes in the desired network policy (if you find the difference between effective and desired network policy confusing, doc patches are welcome as well). Then you just should listen to that signal (probably within ImapAccess) and update the on-disk prefs when user changes their mind. When this is done, the checkbox in the SettingsDialog.cpp/xxxPage.ui can be removed as it will be obsolete by that time.

Hope this is all. Oh, and patches are most welcome to be submitted through https://techbase.kde.org/Development/Gerrit .

Looking forward to your patch!
Comment 4 Jan Kundrát 2014-12-25 19:54:01 UTC
Git commit a760ac6fff3bba477c6716677afed7345eda34f6 by Jan Kundrát, on behalf of Toby Chen.
Committed on 16/12/2014 at 20:29.
Pushed by gerrit into branch 'master'.

Add support for remembering network state
Change-Id: If37d135d04ad25d8155cc6e5c68e32e0e1a9ee97

M  +2    -1    src/Common/SettingsNames.cpp
M  +2    -2    src/Common/SettingsNames.h
M  +1    -2    src/Gui/SettingsDialog.cpp
M  +5    -28   src/Gui/SettingsImapPage.ui
M  +2    -1    src/Gui/Window.cpp
M  +18   -4    src/Imap/Model/ImapAccess.cpp
M  +1    -0    src/Imap/Model/ImapAccess.h
M  +3    -0    src/Imap/Model/NetworkWatcher.cpp
M  +1    -0    src/Imap/Model/NetworkWatcher.h
M  +7    -0    src/Imap/Model/Utils.cpp

http://commits.kde.org/trojita/a760ac6fff3bba477c6716677afed7345eda34f6