void HandleRosterItemMenuTriggered(QAction action) { // FIXME: Actions should be handled in the controller. if (m_MenuDownItem == null) { return; } if (action == m_ViewProfileAction) { var window = new ProfileWindow(m_MenuDownItem.Account, m_MenuDownItem.Item.JID); window.Show(); } else if (action == m_IMAction) { Gui.TabbedChatsWindow.StartChat(m_MenuDownItem.Account, m_MenuDownItem.Item.JID); } else if (m_InviteActions.Contains(action)) { foreach (Room room in m_MenuDownItem.Account.ConferenceManager.Rooms) { if (room.JID.Bare == action.Text) { Console.WriteLine("Invite: " + m_MenuDownItem.Item.JID); room.Invite(m_MenuDownItem.Item.JID, String.Empty); return; } } } else if (action == m_EditGroupsAction) { var win = new EditGroupsWindow(m_MenuDownItem.Account, m_MenuDownItem.Item); win.Show(); } else if (action == m_RemoveAction) { if (QMessageBox.Question(this.TopLevelWidget(), "Synapse", "Are you sure you want to remove this friend?", (uint)QMessageBox.StandardButton.Yes | (uint)QMessageBox.StandardButton.No) == QMessageBox.StandardButton.Yes) { m_MenuDownItem.Account.RemoveRosterItem(m_MenuDownItem.Item.JID); } } }
void on_removeAccountButton_clicked() { var selected = accountsList.SelectionModel().SelectedIndexes(); if (selected.Count > 0) { var data = accountsList.Model().Data(selected[0], (int)Qt.ItemDataRole.DisplayRole); var jid = new jabber.JID((string)data); var accountService = ServiceManager.Get <AccountService>(); Account account = accountService.GetAccount(jid); if (account != null) { if (QMessageBox.Question(this, "Remove Account", "Are you sure you want to remove this account?", (uint)QMessageBox.StandardButton.Yes | (uint)QMessageBox.StandardButton.No, QMessageBox.StandardButton.No) == QMessageBox.StandardButton.Yes) { accountService.RemoveAccount(account); } } } }
private void QuestionButton_Clicked(bool obj) { QMessageBox.Question(this, "Question", "This is Question dialog. Are you sure ?"); }