Index: XWord/AddinSettingsForm.cs =================================================================== --- XWord/AddinSettingsForm.cs (revision 18302) +++ XWord/AddinSettingsForm.cs (working copy) @@ -112,6 +112,14 @@ Addin.password = Password; LoginData loginData = new LoginData(); Addin.Client = new XWikiHTTPClient(ServerURL, UserName, Password); + // if the login fails, then disables the ribbon buttons + // which allows the user to work with the documents from XWiki server + // else enbles them + if (!Addin.Client.LoggedIn) + Globals.Ribbons.XWikiRibbon.disableAllConnectionNeededButtons(); + else + Globals.Ribbons.XWikiRibbon.enableAllConnectionNeededButtons(); + //TODO if login fails then... //AddTaskPanes(); TODO: Sync all taskpanes if (Addin.XWikiTaskPane != null) Index: XWord/XWikiAddIn.cs =================================================================== --- XWord/XWikiAddIn.cs (revision 18302) +++ XWord/XWikiAddIn.cs (working copy) @@ -537,6 +537,10 @@ if (result == DialogResult.OK) { Client = new XWikiHTTPClient(serverURL, username, password); + // if the login fails, then disables the ribbon buttons + // which allows the user to work with the documents from XWiki server + if (!Client.LoggedIn) + Globals.Ribbons.XWikiRibbon.disableAllConnectionNeededButtons(); AddTaskPanes(); } } @@ -586,6 +590,11 @@ username = credentials[1]; password = credentials[2]; client = new XWikiHTTPClient(serverURL, username, password); + // if the login fails, then disables the ribbon buttons + // which allows the user to work with the documents from XWiki server + if (!client.IsLoggedIn) + Globals.Ribbons.XWikiRibbon.disableAllConnectionNeededButtons(); + AddTaskPanes(); } return canAutoLogin; Index: XWord/XWikiRibbon.cs =================================================================== --- XWord/XWikiRibbon.cs (revision 18302) +++ XWord/XWikiRibbon.cs (working copy) @@ -36,7 +36,63 @@ { } + /// + /// Disables all the buttons from the ribbon, that need a connection to a XWiki server + /// in order to be functional + /// The uploadAtt and downloadAtt options, are special, they don;t need only a connection + /// so they are not treated here + /// + public void disableAllConnectionNeededButtons() + { + btnNewPage.Enabled = false; + btnEditPage.Enabled = false; + btnPublishDocument.Enabled = false; + btnAddPage.Enabled = false; + btnEditPage.Enabled = false; + btnUpload.Enabled = false; + btnDownload.Enabled = false; + btnDownloadAndOpen.Enabled = false; + btnShowAttachments.Enabled = false; + btnShowPages.Enabled = false; + btnViewInBrowser.Enabled = false; + galMyRecentlyCreated.Enabled = false; + galMyRecentlyModified.Enabled = false; + galMyRecentlyViewed.Enabled = false; + galTeamRecentlyCreated.Enabled = false; + galTeamRecentlyModified.Enabled = false; + galTeamRecentlyView.Enabled = false; + + } + + /// + /// Enables all the buttons from the ribbon, that need a connection to a XWiki server + /// in order to be functional + /// The uploadAtt and downloadAtt options, are special, they don;t need only a connection + /// so they are not treated here + /// + public void enableAllConnectionNeededButtons() + { + btnNewPage.Enabled = true; + btnEditPage.Enabled = true; + btnPublishDocument.Enabled = true; + btnAddPage.Enabled = true; + btnEditPage.Enabled = true; + btnUpload.Enabled = true; + btnDownload.Enabled = true; + btnDownloadAndOpen.Enabled = true; + btnShowAttachments.Enabled = true; + btnShowPages.Enabled = true; + btnViewInBrowser.Enabled = true; + + galMyRecentlyCreated.Enabled = true; + galMyRecentlyModified.Enabled = true; + galMyRecentlyViewed.Enabled = true; + galTeamRecentlyCreated.Enabled = true; + galTeamRecentlyModified.Enabled = true; + galTeamRecentlyView.Enabled = true; + } + private void SyncSaving_Click(object sender, RibbonControlEventArgs e) { if (syncSaving.Checked)