Merge lp:~mandel/ubuntuone-windows-installer/smart_context_menu into lp:ubuntuone-windows-installer/beta

Proposed by Manuel de la Peña
Status: Merged
Approved by: John Lenton
Approved revision: 178
Merged at revision: 134
Proposed branch: lp:~mandel/ubuntuone-windows-installer/smart_context_menu
Merge into: lp:ubuntuone-windows-installer/beta
Prerequisite: lp:~mandel/ubuntuone-windows-installer/manual_sync_does_nothing
Diff against target: 438 lines (+149/-44) (has conflicts)
11 files modified
src/Canonical.Ubuntu.SSO/ISSOCredentialsProvider.cs (+7/-0)
src/Canonical.Ubuntu.SSO/SSOCredentialsProvider.cs (+19/-4)
src/Canonical.UbuntuOne.Client.Views.Tests/NotifyIconFixture.cs (+2/-1)
src/Canonical.UbuntuOne.Client.Views/NotifyIcon.xaml (+9/-5)
src/Canonical.UbuntuOne.Client.Views/NotifyIcon.xaml.cs (+47/-20)
src/Canonical.UbuntuOne.Client.Views/Resources/Resources.resx (+3/-0)
src/Canonical.UbuntuOne.Client.Views/Resources/Resources1.Designer.cs (+9/-0)
src/Canonical.UbuntuOne.Client.Views/objects.xml (+2/-3)
src/Canonical.UbuntuOne.Client/Notification/INotificationIconPresenter.cs (+10/-0)
src/Canonical.UbuntuOne.Client/Notification/INotificationIconView.cs (+6/-0)
src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs (+35/-11)
Text conflict in src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs
To merge this branch: bzr merge lp:~mandel/ubuntuone-windows-installer/smart_context_menu
Reviewer Review Type Date Requested Status
John Lenton (community) Approve
Review via email: mp+40667@code.launchpad.net

Description of the change

Made the context menu smarter to show diff content according to the status of the user credentials.

To post a comment you must log in.
178. By Manuel de la Peña

Ensures that method is executed in the correct thread.

Revision history for this message
John Lenton (chipaca) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Canonical.Ubuntu.SSO/ISSOCredentialsProvider.cs'
--- src/Canonical.Ubuntu.SSO/ISSOCredentialsProvider.cs 2010-10-18 10:53:55 +0000
+++ src/Canonical.Ubuntu.SSO/ISSOCredentialsProvider.cs 2010-11-12 14:29:04 +0000
@@ -72,6 +72,13 @@
72 /// </summary>72 /// </summary>
73 void LoginOrRegisterToGetCredentials();73 void LoginOrRegisterToGetCredentials();
7474
75 /// <summary>
76 /// Gets if the credentials are present in the system.
77 /// </summary>
78 /// <param name="applicationName">The name of the applications whose credentials we want to
79 /// get.</param>
80 bool CredentialsArePresent(string applicationName);
81
75 #endregion82 #endregion
7683
77 }84 }
7885
=== modified file 'src/Canonical.Ubuntu.SSO/SSOCredentialsProvider.cs'
--- src/Canonical.Ubuntu.SSO/SSOCredentialsProvider.cs 2010-10-20 11:32:24 +0000
+++ src/Canonical.Ubuntu.SSO/SSOCredentialsProvider.cs 2010-11-12 14:29:04 +0000
@@ -82,12 +82,12 @@
82 if (LoginView.ViewDispatcher.Dispatch(() => LoginView.IsShown))82 if (LoginView.ViewDispatcher.Dispatch(() => LoginView.IsShown))
83 return;83 return;
8484
85 if (LoginView.ViewDispatcher.Dispatch( () => LoginView.ShowDialog() != MessageBoxResult.Cancel))85 if (LoginView.ViewDispatcher.Dispatch(() => LoginView.ShowDialog() != MessageBoxResult.Cancel))
86 {86 {
87 var tokenName = string.Format(ApplicationTokenName, Environment.MachineName);87 var tokenName = string.Format(ApplicationTokenName, Environment.MachineName);
88 secret = SSOLoginProcessor.Login(88 secret = SSOLoginProcessor.Login(
89 LoginView.ViewDispatcher.Dispatch(() => LoginView.EmailAddress),89 LoginView.ViewDispatcher.Dispatch(() => LoginView.EmailAddress),
90 LoginView.ViewDispatcher.Dispatch(() => LoginView.Password), 90 LoginView.ViewDispatcher.Dispatch(() => LoginView.Password),
91 tokenName);91 tokenName);
92 // save the credentials in the keyring92 // save the credentials in the keyring
93 // TODO: We have an issue here since we have more than one listening for the same credntials of Ubuntu One93 // TODO: We have an issue here since we have more than one listening for the same credntials of Ubuntu One
@@ -101,10 +101,10 @@
101 }101 }
102 return;102 return;
103 }103 }
104 104
105 }105 }
106 // we execute the credentials found event106 // we execute the credentials found event
107 if(!string.IsNullOrEmpty(secret) && OnCredentialsFound != null)107 if (!string.IsNullOrEmpty(secret) && OnCredentialsFound != null)
108 {108 {
109 string token;109 string token;
110 string tokenSecret;110 string tokenSecret;
@@ -157,6 +157,21 @@
157 throw new NotImplementedException();157 throw new NotImplementedException();
158 }158 }
159159
160 /// <summary>
161 /// Returns if the credentials of a given application are present.
162 /// </summary>
163 /// <param name="applicationName">The name of the application whose credentials we want
164 /// to get.</param>
165 /// <returns>A bool value stating if the credentials are present.</returns>
166 public bool CredentialsArePresent(string applicationName)
167 {
168 //TODO: Currently application name is hardcoded!!!!
169 // try to get the credentials from the keyring
170 var secret = Keyring.GetSecretByName(KeyringName, ApplicationName);
171 return secret != null;
172
173 }
174
160 #endregion175 #endregion
161 }176 }
162}177}
163178
=== modified file 'src/Canonical.UbuntuOne.Client.Views.Tests/NotifyIconFixture.cs'
--- src/Canonical.UbuntuOne.Client.Views.Tests/NotifyIconFixture.cs 2010-10-20 23:27:32 +0000
+++ src/Canonical.UbuntuOne.Client.Views.Tests/NotifyIconFixture.cs 2010-11-12 14:29:04 +0000
@@ -43,7 +43,8 @@
43 {43 {
44 _moks = new MockRepository();44 _moks = new MockRepository();
45 _presenter = _moks.StrictMock<INotificationIconPresenter>();45 _presenter = _moks.StrictMock<INotificationIconPresenter>();
46 _icon = new UbuntuOneNotifyIcon {NotificationIconPresenter = _presenter};46 _icon = new UbuntuOneNotifyIcon (_presenter);
47 _moks.BackToRecordAll();
47 }48 }
4849
49 #endregion50 #endregion
5051
=== modified file 'src/Canonical.UbuntuOne.Client.Views/NotifyIcon.xaml'
--- src/Canonical.UbuntuOne.Client.Views/NotifyIcon.xaml 2010-10-21 11:41:25 +0000
+++ src/Canonical.UbuntuOne.Client.Views/NotifyIcon.xaml 2010-11-12 14:29:04 +0000
@@ -70,7 +70,11 @@
70 <av:NotifyIcon Name="NotifyIcon" Icon="/Canonical.UbuntuOne.Client.Views;component/Resources/ubuntu-logo-22x22.png" 70 <av:NotifyIcon Name="NotifyIcon" Icon="/Canonical.UbuntuOne.Client.Views;component/Resources/ubuntu-logo-22x22.png"
71 Text="Ubuntu One"> <!-- TODO: Add icon Icon="/AvalonLibraryTestPages;component/Properties/App.ico" Open preferences when click -->71 Text="Ubuntu One"> <!-- TODO: Add icon Icon="/AvalonLibraryTestPages;component/Properties/App.ico" Open preferences when click -->
72 <FrameworkElement.ContextMenu >72 <FrameworkElement.ContextMenu >
73 <ContextMenu StaysOpen="False">73 <ContextMenu StaysOpen="False" >
74 <MenuItem x:Uid="AddComputer"
75 Name="AddComputer"
76 Header="{x:Static resx:Resources.NotificationIconAddComputerLabel}"
77 Click="OnAddComputerClick"/>
74 <MenuItem x:Uid="UbuntuOneManualSync" 78 <MenuItem x:Uid="UbuntuOneManualSync"
75 Name="UbuntuOneManualSync" 79 Name="UbuntuOneManualSync"
76 Header="{x:Static resx:Resources.NotificationIconUbuntuOneManualSyncLabel}" 80 Header="{x:Static resx:Resources.NotificationIconUbuntuOneManualSyncLabel}"
@@ -87,10 +91,10 @@
87 Name="OpenSyncMenuItem" 91 Name="OpenSyncMenuItem"
88 Header="{x:Static resx:Resources.NotificationIconOpenSyncLabel}" 92 Header="{x:Static resx:Resources.NotificationIconOpenSyncLabel}"
89 Click="OnOpenSyncMenuItemClick"/>93 Click="OnOpenSyncMenuItemClick"/>
90 <Separator />94 <Separator Name="OptionsSeparator" />
91 <MenuItem Name="StateMenuItem" 95 <Label Name="StateMenuItem"
92 Header="State"/> 96 Content="State: Idle"/>
93 <Separator />97 <Separator Name="HelpSeparator" />
94 <MenuItem x:Uid="HelpMenuItem" 98 <MenuItem x:Uid="HelpMenuItem"
95 Name="HelpMenuItem" 99 Name="HelpMenuItem"
96 Header="{x:Static resx:Resources.NotificationIconHelpLabel}" 100 Header="{x:Static resx:Resources.NotificationIconHelpLabel}"
97101
=== modified file 'src/Canonical.UbuntuOne.Client.Views/NotifyIcon.xaml.cs'
--- src/Canonical.UbuntuOne.Client.Views/NotifyIcon.xaml.cs 2010-10-21 13:11:36 +0000
+++ src/Canonical.UbuntuOne.Client.Views/NotifyIcon.xaml.cs 2010-11-12 14:29:04 +0000
@@ -36,25 +36,18 @@
36 private IDispatcher _dispatcher;36 private IDispatcher _dispatcher;
37 private readonly object _dispatcherLock = new object();37 private readonly object _dispatcherLock = new object();
38 private Storyboard _iconAnimation;38 private Storyboard _iconAnimation;
3939 private INotificationIconPresenter _presenter;
40 #endregion
41
42 #region DI Properties
43
44 /// <summary>
45 /// Gets and sets the presenter that contains the logic that is used by the notification icon.
46 /// </summary>
47 public INotificationIconPresenter NotificationIconPresenter { get; set; }
48
49 #endregion40 #endregion
5041
51 /// <summary>42 /// <summary>
52 /// Initializes a new instance of the UbuntuOneNotifyIcon class.43 /// Initializes a new instance of the UbuntuOneNotifyIcon class.
53 /// </summary>44 /// </summary>
54 public UbuntuOneNotifyIcon()45 public UbuntuOneNotifyIcon(INotificationIconPresenter presenter)
55 {46 {
56 InitializeComponent();47 InitializeComponent();
57 _iconAnimation = Resources["IconAnimation"] as Storyboard;48 _iconAnimation = Resources["IconAnimation"] as Storyboard;
49 _presenter = presenter;
50 _presenter.InitializeView();
58 }51 }
5952
60 #region Implementation of INotificationIconView53 #region Implementation of INotificationIconView
@@ -114,6 +107,34 @@
114 NotifyIcon.ShowBalloonTip(timeout, title, text, icon);107 NotifyIcon.ShowBalloonTip(timeout, title, text, icon);
115 }108 }
116109
110 public void ShowAsAddedComputer(bool isAddedComputer)
111 {
112 if(isAddedComputer)
113 {
114 // show all the menu items
115 UbuntuOneManualSync.Visibility = System.Windows.Visibility.Visible;
116 UbuntuOnePreferencesMenuItem.Visibility = System.Windows.Visibility.Visible;
117 OpenShareManueItem.Visibility = System.Windows.Visibility.Visible;
118 OpenSyncMenuItem.Visibility = System.Windows.Visibility.Visible;
119 OptionsSeparator.Visibility = System.Windows.Visibility.Visible;
120 HelpSeparator.Visibility = System.Windows.Visibility.Visible;
121 // we do not need to add the computer
122 AddComputer.Visibility = System.Windows.Visibility.Collapsed;
123 }
124 else
125 {
126 // Hide all the diff menu items
127 UbuntuOneManualSync.Visibility = System.Windows.Visibility.Collapsed;
128 UbuntuOnePreferencesMenuItem.Visibility = System.Windows.Visibility.Collapsed;
129 OpenShareManueItem.Visibility = System.Windows.Visibility.Collapsed;
130 OpenSyncMenuItem.Visibility = System.Windows.Visibility.Collapsed;
131 OptionsSeparator.Visibility = System.Windows.Visibility.Collapsed;
132 HelpSeparator.Visibility = System.Windows.Visibility.Collapsed;
133 // provide the user a way to add the computer
134 AddComputer.Visibility = System.Windows.Visibility.Visible;
135 }
136 }
137
117 /// <summary>138 /// <summary>
118 /// Gets and sets the list of recently modified files.139 /// Gets and sets the list of recently modified files.
119 /// </summary>140 /// </summary>
@@ -128,10 +149,10 @@
128 /// </summary>149 /// </summary>
129 public string State150 public string State
130 {151 {
131 get { return (string)StateMenuItem.Header; }152 get { return (string)StateMenuItem.Content; }
132 set153 set
133 {154 {
134 StateMenuItem.Header = value;155 StateMenuItem.Content = value;
135 Title = value;156 Title = value;
136 }157 }
137 }158 }
@@ -169,34 +190,40 @@
169190
170 internal void OnUbuntuOneManualSyncClick(object sender, System.Windows.RoutedEventArgs e)191 internal void OnUbuntuOneManualSyncClick(object sender, System.Windows.RoutedEventArgs e)
171 {192 {
172 var thread = new Thread(NotificationIconPresenter.ManualSync);193 var thread = new Thread(_presenter.ManualSync);
173 thread.Start();194 thread.Start();
174 }195 }
175196
176 internal void OnExitMenuItemClick(object sender, System.Windows.RoutedEventArgs e)197 internal void OnExitMenuItemClick(object sender, System.Windows.RoutedEventArgs e)
177 {198 {
178 NotificationIconPresenter.Exit();199 _presenter.Exit();
179 }200 }
180201
181 internal void OnHelpMenuItemClick(object sender, System.Windows.RoutedEventArgs e)202 internal void OnHelpMenuItemClick(object sender, System.Windows.RoutedEventArgs e)
182 {203 {
183 NotificationIconPresenter.OpenHelp();204 _presenter.OpenHelp();
184 }205 }
185206
186 internal void OnMoreSpaceMenuItemClick(object sender, System.Windows.RoutedEventArgs e)207 internal void OnMoreSpaceMenuItemClick(object sender, System.Windows.RoutedEventArgs e)
187 {208 {
188 NotificationIconPresenter.OpenUpgradeOption();209 _presenter.OpenUpgradeOption();
189 }210 }
190211
191 internal void OnOpenSyncMenuItemClick(object sender, System.Windows.RoutedEventArgs e)212 internal void OnOpenSyncMenuItemClick(object sender, System.Windows.RoutedEventArgs e)
192 {213 {
193 NotificationIconPresenter.OpenSyncsLocation();214 _presenter.OpenSyncsLocation();
194 }215 }
195216
196 internal void OnUbuntuOnePreferencesMenuItemClick(object sender, System.Windows.RoutedEventArgs e)217 internal void OnUbuntuOnePreferencesMenuItemClick(object sender, System.Windows.RoutedEventArgs e)
197 {218 {
198 NotificationIconPresenter.OpenUbuntuOnePreferences();219 _presenter.OpenUbuntuOnePreferences();
199 }220 }
221
222 private void OnAddComputerClick(object sender, System.Windows.RoutedEventArgs e)
223 {
224 _presenter.AddComputer();
225 }
226
200227
201 }228 }
202}229}
203230
=== modified file 'src/Canonical.UbuntuOne.Client.Views/Resources/Resources.resx'
--- src/Canonical.UbuntuOne.Client.Views/Resources/Resources.resx 2010-10-13 09:56:20 +0000
+++ src/Canonical.UbuntuOne.Client.Views/Resources/Resources.resx 2010-11-12 14:29:04 +0000
@@ -155,6 +155,9 @@
155 <value>Downloading updates...</value>155 <value>Downloading updates...</value>
156 <comment>The title of the downloading dialog.</comment>156 <comment>The title of the downloading dialog.</comment>
157 </data>157 </data>
158 <data name="NotificationIconAddComputerLabel" xml:space="preserve">
159 <value>Add this computer</value>
160 </data>
158 <data name="NotificationIconExitLabel" xml:space="preserve">161 <data name="NotificationIconExitLabel" xml:space="preserve">
159 <value>Exit</value>162 <value>Exit</value>
160 <comment>The title of the exit menu item.</comment>163 <comment>The title of the exit menu item.</comment>
161164
=== modified file 'src/Canonical.UbuntuOne.Client.Views/Resources/Resources1.Designer.cs'
--- src/Canonical.UbuntuOne.Client.Views/Resources/Resources1.Designer.cs 2010-10-13 09:56:20 +0000
+++ src/Canonical.UbuntuOne.Client.Views/Resources/Resources1.Designer.cs 2010-11-12 14:29:04 +0000
@@ -151,6 +151,15 @@
151 }151 }
152 152
153 /// <summary>153 /// <summary>
154 /// Looks up a localized string similar to Add this computer.
155 /// </summary>
156 public static string NotificationIconAddComputerLabel {
157 get {
158 return ResourceManager.GetString("NotificationIconAddComputerLabel", resourceCulture);
159 }
160 }
161
162 /// <summary>
154 /// Looks up a localized string similar to Exit.163 /// Looks up a localized string similar to Exit.
155 /// </summary>164 /// </summary>
156 public static string NotificationIconExitLabel {165 public static string NotificationIconExitLabel {
157166
=== modified file 'src/Canonical.UbuntuOne.Client.Views/objects.xml'
--- src/Canonical.UbuntuOne.Client.Views/objects.xml 2010-10-13 10:38:57 +0000
+++ src/Canonical.UbuntuOne.Client.Views/objects.xml 2010-11-12 14:29:04 +0000
@@ -8,9 +8,8 @@
8 type="Canonical.UbuntuOne.Client.Views.Update.UpdatingView, Canonical.UbuntuOne.Client.Views" />8 type="Canonical.UbuntuOne.Client.Views.Update.UpdatingView, Canonical.UbuntuOne.Client.Views" />
99
10 <object id="UbuntuOneNotifyIcon"10 <object id="UbuntuOneNotifyIcon"
11 type="Canonical.UbuntuOne.Client.Views.UbuntuOneNotifyIcon, Canonical.UbuntuOne.Client.Views" >11 type="Canonical.UbuntuOne.Client.Views.UbuntuOneNotifyIcon, Canonical.UbuntuOne.Client.Views" depends-on="NotificationIconPresenter">
12 <property name="NotificationIconPresenter"12 <constructor-arg name="presenter" ref="NotificationIconPresenter"/>
13 ref="NotificationIconPresenter" />
14 </object>13 </object>
1514
16 <object id="PreferencesView"15 <object id="PreferencesView"
1716
=== modified file 'src/Canonical.UbuntuOne.Client/Notification/INotificationIconPresenter.cs'
--- src/Canonical.UbuntuOne.Client/Notification/INotificationIconPresenter.cs 2010-10-21 13:11:36 +0000
+++ src/Canonical.UbuntuOne.Client/Notification/INotificationIconPresenter.cs 2010-11-12 14:29:04 +0000
@@ -26,6 +26,16 @@
26 public interface INotificationIconPresenter26 public interface INotificationIconPresenter
27 {27 {
28 /// <summary>28 /// <summary>
29 /// Initializes the view to ensure that shows the correct data.
30 /// </summary>
31 void InitializeView();
32
33 /// <summary>
34 /// Action taken when the user wants to add the current computer to his machine.
35 /// </summary>
36 void AddComputer();
37
38 /// <summary>
29 /// When implemented this method should for the sync of the ubuntu one folder.39 /// When implemented this method should for the sync of the ubuntu one folder.
30 /// </summary>40 /// </summary>
31 void ManualSync();41 void ManualSync();
3242
=== modified file 'src/Canonical.UbuntuOne.Client/Notification/INotificationIconView.cs'
--- src/Canonical.UbuntuOne.Client/Notification/INotificationIconView.cs 2010-10-21 13:11:36 +0000
+++ src/Canonical.UbuntuOne.Client/Notification/INotificationIconView.cs 2010-11-12 14:29:04 +0000
@@ -50,6 +50,12 @@
50 void ShowNotification(int timeout, string title, string text, NotificationType type);50 void ShowNotification(int timeout, string title, string text, NotificationType type);
5151
52 /// <summary>52 /// <summary>
53 /// Tells the view to display as if the computer was already added to the service.
54 /// </summary>
55 /// <param name="isAddedComputer">States if the computer was added.</param>
56 void ShowAsAddedComputer(bool isAddedComputer);
57
58 /// <summary>
53 /// Gets and sets the list of recently modified files.59 /// Gets and sets the list of recently modified files.
54 /// </summary>60 /// </summary>
55 IList<string> RecentlyModifiedFiles { get; set; }61 IList<string> RecentlyModifiedFiles { get; set; }
5662
=== modified file 'src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs'
--- src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs 2010-11-11 11:43:38 +0000
+++ src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs 2010-11-12 14:29:04 +0000
@@ -51,9 +51,16 @@
51 private ISSOCredentialsProvider _ssoProvider;51 private ISSOCredentialsProvider _ssoProvider;
52 private ILog _logger;52 private ILog _logger;
53 private readonly object _loggerLock = new object();53 private readonly object _loggerLock = new object();
54<<<<<<< TREE
54 private const string EventName = "UbuntuOneNotificationIconPresenter";55 private const string EventName = "UbuntuOneNotificationIconPresenter";
55 private const string ApplicationName = "UbuntuOne";56 private const string ApplicationName = "UbuntuOne";
5657
58=======
59 private static string ManualSyncEvent = "UbuntuOneNotificationIconPresenter.ManualSync";
60 private static string AddComputerEvent = "UbuntuOneNotificationIconPresenter.AddComputer";
61 private static string ApplicationName = "UbuntuOne";
62 private INotificationIconView _view;
63>>>>>>> MERGE-SOURCE
57 #endregion64 #endregion
5865
59 #region Di properties66 #region Di properties
@@ -107,6 +114,7 @@
107 _ssoProvider.OnCredentialsFound += OnCredentialsFound;114 _ssoProvider.OnCredentialsFound += OnCredentialsFound;
108 _ssoProvider.OnCredentialsError += OnCredentialsError;115 _ssoProvider.OnCredentialsError += OnCredentialsError;
109 _ssoProvider.OnCredetialsDenied += OnCredentialsDenied;116 _ssoProvider.OnCredetialsDenied += OnCredentialsDenied;
117 InitializeView();
110 }118 }
111 }119 }
112120
@@ -229,16 +237,18 @@
229 [DebugLogged]237 [DebugLogged]
230 private void OnCredentialsFound(object sender, CredentialsFoundEventArgs args)238 private void OnCredentialsFound(object sender, CredentialsFoundEventArgs args)
231 {239 {
232 // check if the credentials are for us240 // we got credentials, no matter what we tell the ui to be ready
233 if (args.ApplicationName != EventName) return;241 NotificationIconView.ViewDispatcher.Dispatch(() => NotificationIconView.ShowAsAddedComputer(true));
242 // check if the credentials are for us);
243 if (args.ApplicationName != ManualSyncEvent) return;
234 NotificationIconView.ViewDispatcher.Dispatch(244 NotificationIconView.ViewDispatcher.Dispatch(
235 () =>245 () =>
236 {246 {
237 NotificationIconView.IsManualSyncEnabled = false;247 NotificationIconView.IsManualSyncEnabled = false;
238 NotificationIconView.State = "Syncing";248 NotificationIconView.State = "Syncing";
239 }249 }
240 );250 );
241 251
242 Logger.Info("Got the UbuntuOne credentials!");252 Logger.Info("Got the UbuntuOne credentials!");
243 var oneDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),253 var oneDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
244 Resources.DefaulDirectoryName);254 Resources.DefaulDirectoryName);
@@ -262,14 +272,14 @@
262 [DebugLogged]272 [DebugLogged]
263 private void OnCredentialsDenied(object sender, CredentialsDeniedEventArgs args)273 private void OnCredentialsDenied(object sender, CredentialsDeniedEventArgs args)
264 {274 {
265 if (args.ApplicationName != EventName) return;275 if (args.ApplicationName != ManualSyncEvent) return;
266 MessageBox.ShowWarning("You need to login to be able to sync your files.");276 MessageBox.ShowWarning("You need to login to be able to sync your files.");
267 }277 }
268278
269 [DebugLogged]279 [DebugLogged]
270 private void OnCredentialsError(object sender, CredentialsErrorEventArgs args)280 private void OnCredentialsError(object sender, CredentialsErrorEventArgs args)
271 {281 {
272 if (args.ApplicationName != EventName) return;282 if (args.ApplicationName != ManualSyncEvent) return;
273 MessageBox.ShowError(string.Format("An error courred when trying to retrieve your credentials: {0}", args.ErrorMessage));283 MessageBox.ShowError(string.Format("An error courred when trying to retrieve your credentials: {0}", args.ErrorMessage));
274 Logger.ErrorFormat("The error was {0}, {1}", args.ErrorMessage, args.DetailedErrorMessage);284 Logger.ErrorFormat("The error was {0}, {1}", args.ErrorMessage, args.DetailedErrorMessage);
275 }285 }
@@ -278,14 +288,28 @@
278288
279 #region Implementation of INotificationIconPresenter289 #region Implementation of INotificationIconPresenter
280290
291 public void InitializeView()
292 {
293 if (SSOCredentialsProvider != null)
294 if (SSOCredentialsProvider.CredentialsArePresent(ApplicationName))
295 NotificationIconView.ShowAsAddedComputer(true);
296 else
297 NotificationIconView.ShowAsAddedComputer(false);
298 }
299
300 public void AddComputer()
301 {
302 // call the sso credentials provider but with a diff event so that we do not perform a manual sync
303 SSOCredentialsProvider.LoginToGetCredentials(AddComputerEvent, ApplicationName);
304 }
305
281 /// <summary>306 /// <summary>
282 /// When implemented this method should for the sync of the ubuntu one folder.307 /// When implemented this method should for the sync of the ubuntu one folder.
283 /// </summary>308 /// </summary>
284 public void ManualSync()309 public void ManualSync()
285 {310 {
286
287 // we get the credentials, because we have register an action to the credetials aquired, we do nothing besides this311 // we get the credentials, because we have register an action to the credetials aquired, we do nothing besides this
288 SSOCredentialsProvider.LoginToGetCredentials(EventName, ApplicationName);312 SSOCredentialsProvider.LoginToGetCredentials(ManualSyncEvent, ApplicationName);
289 }313 }
290314
291 /// <summary>315 /// <summary>

Subscribers

People subscribed via source and target branches

to all changes: