Ejemplo n.º 1
0
        void SendShout()
        {
            if (!String.IsNullOrEmpty(shoutLineEdit.Text))
            {
                List <IShoutHandler> selectedHandlers = new List <IShoutHandler>();

                for (int x = 0; x < shoutHandlersContainer.Layout().Count(); x++)
                {
                    var item = shoutHandlersContainer.Layout().ItemAt(x);
                    if (item is QWidgetItem)
                    {
                        var check = ((ShoutHandlerCheckBox)((QWidgetItem)item).Widget());
                        if (check.Checked)
                        {
                            selectedHandlers.Add(check.Handler);
                        }
                    }
                }

                try {
                    var service = ServiceManager.Get <ShoutService>();
                    service.Shout(shoutLineEdit.Text, selectedHandlers.ToArray());
                    shoutLineEdit.Clear();
                } catch (UserException ex) {
                    QMessageBox.Critical(base.TopLevelWidget(), "Synapse", ex.Message);
                }
            }
        }
Ejemplo n.º 2
0
        private void on_saveAccountButton_clicked()
        {
            JID jid = null;

            if (String.IsNullOrEmpty(m_LoginLineEdit.Text))
            {
                QMessageBox.Critical(this.TopLevelWidget(), "Synapse", "Login may not be empty.");
            }
            else if (!JID.TryParse(m_LoginLineEdit.Text, out jid))
            {
                QMessageBox.Critical(this.TopLevelWidget(), "Synapse", "Login should look like 'user@server'.");
            }
            else if (String.IsNullOrEmpty(new JID(m_LoginLineEdit.Text).User))
            {
                QMessageBox.Critical(this.TopLevelWidget(), "Synapse", "Login should look like 'user@server'.");
            }
            else if (String.IsNullOrEmpty(m_PasswordLineEdit.Text))
            {
                QMessageBox.Critical(this.TopLevelWidget(), "Synapse", "Password may not be empty");
            }
            else
            {
                var            accountInfo = new AccountInfo(jid.User, jid.Server, m_PasswordLineEdit.Text, "Synapse");
                AccountService service     = ServiceManager.Get <AccountService>();
                service.AddAccount(accountInfo);
            }
        }
Ejemplo n.º 3
0
        private void DeleteContactsSim()
        {
            QMessageBox dmsg = new QMessageBox(QMessageBox.Icon.Question,
                                               MainClass.AppNameVer + " - " + GlobalObjUI.LMan.GetString("deletesimact"),
                                               GlobalObjUI.LMan.GetString("suredeletesim"),
                                               (uint)QMessageBox.StandardButton.Yes | (uint)QMessageBox.StandardButton.No);

            int respType = dmsg.Exec();

            dmsg.Close();
            dmsg.Dispose();


            if (respType != (uint)QMessageBox.StandardButton.Yes)
            {
                return;
            }


            // Delete sim
            ScanSimBefore();

            // Reset status values
            GlobalObjUI.SimADNStatus   = 1;
            GlobalObjUI.SimADNPosition = 0;
            GlobalObjUI.SimADNError    = "";

            // Start thread for reading process
            isReading = false;
            isEnd     = false;
            simThread = new System.Threading.Thread(new System.Threading.ThreadStart(GlobalObjUI.DeleteAllSimContactsList));
            simThread.Start();

            return;
        }
Ejemplo n.º 4
0
    private void AddExcludeDir()
    {
        string dir = QFileDialog.GetExistingDirectory(this,"Select path to exclude",PathFinder.HomeDir);

        if (dir == null)
        {
            return;
        }
        Console.WriteLine("Excluding '{0}'",dir);

        // Check if the new dir is already part of some excluded directory in the list
        bool seen = false;

        for (int i = 0; i < main.ExcludeDirList.Count; ++i)
        {
            if (main.ExcludeDirList.Item(i).Text().StartsWith(dir))
            {
                seen = true;
                QMessageBox.Critical(this,"Invalid directory","The selected path wasn't added. The list contains a path that is included in the new path.","OK");
            }
            else if (dir.StartsWith(main.ExcludeDirList.Item(i).Text()))
            {
                seen = true;
                QMessageBox.Critical(this,"Invalid directory","The selected path wasn't added. The path is already included in one of the paths in the list.","OK");
            }
        }

        if (!seen)
        {
            main.ExcludeDirList.AddItem(dir);
        }
    }
Ejemplo n.º 5
0
    private void ShowDirChooser()
    {
        string new_root = QFileDialog.GetExistingDirectory(this,"Choose new path for beagle to index","/");

        if (new_root == null)
        {
            return;
        }
        Console.WriteLine("Selected new root '{0}'",new_root);

        // Check if the new_root is already part of some root in the list
        bool seen = false;

        for (int i = 0; i < main.RootsList.Count; ++i)
        {
            Console.WriteLine("Checking against {0}",main.RootsList.Item(i).Text());
            if (main.RootsList.Item(i).Text().StartsWith(new_root))
            {
                seen = true;
                QMessageBox.Critical(this,"Invalid directory","The selected path wasn't added. The list contains a path that is included in the new path.","OK");
            }
            else if (new_root.StartsWith(main.RootsList.Item(i).Text()))
            {
                seen = true;
                QMessageBox.Critical(this,"Invalid directory","The selected path wasn't added. The path is already included in one of the paths in the list.","OK");
            }
        }

        if (!seen)
        {
            main.RootsList.AddItem(new_root);
        }
    }
Ejemplo n.º 6
0
        void on_editAccountButton_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 (!account.IsReadOnly)
                    {
                        var dialog = new EditAccountDialog(account.Info, this);
                        dialog.Show();
                        dialog.Exec();

                        accountsList.Update();
                    }
                    else
                    {
                        QMessageBox.Critical(this, "Error", "Cannot modify account while connected.");
                    }
                }
            }
        }
Ejemplo n.º 7
0
        void on_m_JoinChatButton_clicked()
        {
            Account selectedAccount = Gui.ShowAccountSelectMenu(m_JoinChatButton);

            if (selectedAccount != null)
            {
                JID    jid  = null;
                string nick = (!String.IsNullOrEmpty(mucNicknameLineEdit.Text)) ? mucNicknameLineEdit.Text : selectedAccount.ConferenceManager.DefaultNick;
                if (JID.TryParse(String.Format("{0}@{1}/{2}", mucRoomLineEdit.Text, mucServerLineEdit.Text, nick), out jid))
                {
                    if (!String.IsNullOrEmpty(jid.User) && !String.IsNullOrEmpty(jid.Server))
                    {
                        try {
                            selectedAccount.JoinMuc(jid, mucPasswordLineEdit.Text);
                        } catch (UserException ex) {
                            QMessageBox.Critical(this.TopLevelWidget(), "Synapse Error", ex.Message);
                        }
                    }
                    else
                    {
                        QMessageBox.Critical(null, "Synapse", "Invalid JID");
                    }
                }
                else
                {
                    QMessageBox.Critical(this.TopLevelWidget(), "Synapse Error", "Invalid conference room");
                }
            }
        }
Ejemplo n.º 8
0
 private void mRemoveButton_Clicked()
 {
     foreach (var index in mTableWidget.SelectionModel.SelectedRows())
     {
         try {
             var key = mTableWidget.Item(index.Row, 0)
                       .Data((int)Qt.ItemDataRole.UserRole) as ISshKey;
             mAgent.RemoveKey(key);
         } catch (AgentFailureException) {
             QMessageBox.Critical(this, Tr("Agent Failure"),
                                  Tr("Possible causes:") +
                                  "<ul>" +
                                  "<li>" + Tr("Agent is locked") + "</li>" +
                                  "<li>" + Tr("Key may have already been removed") + "</li>" +
                                  "</ul>"
                                  );
         } catch (Exception ex) {
             Debug.Fail(ex.ToString());
         }
     }
     if (mAgent is Agent)
     {
         UpdateUIState();
     }
     else
     {
         ReloadData();
     }
 }
Ejemplo n.º 9
0
        public override void Fail(string message, string detailMessage)
        {
            StackTrace       stack = new StackTrace();
            ManualResetEvent mutex = new ManualResetEvent(false);

            QApplication.Invoke(delegate {
                string msg = String.Format("{0}{1}{2}{1}{1}{3}", message, Environment.NewLine, detailMessage, stack);

                Console.Error.WriteLine("---");
                Console.Error.WriteLine("ASSERTION FAILED");
                Console.Error.WriteLine(msg);

                var result = QMessageBox.Critical(null, "Assertion Failed", msg,
                                                  (uint)QMessageBox.StandardButton.Abort |
                                                  (uint)QMessageBox.StandardButton.Ignore);

                if (result == Qyoto.QMessageBox.StandardButton.Abort)
                {
                    Thread.CurrentThread.Abort();
                }

                mutex.Set();
            });
            mutex.WaitOne();
        }
Ejemplo n.º 10
0
 void AddRosterItemComplete(object sender, jabber.protocol.client.IQ response, object data)
 {
     if (response.Type != jabber.protocol.client.IQType.set)
     {
         QApplication.Invoke(delegate {
             QMessageBox.Critical(Gui.MainWindow, "Failed to add octy", "Server returned an error.");
         });
     }
 }
Ejemplo n.º 11
0
 public void SlotAbout()
 {
     QMessageBox.About(this,"About MonoCov",
                       "<p>A Coverage Analysis program for MONO." +
                       "<p>By Zoltan Varga ([email protected])" +
                       "<p>Powered by" +
                       "<p>MONO (<a href>http://www.go-mono.com</a>)" +
                       "<p>and Qt# (<a href>http://qtcsharp.sourceforge.net</a>)");
 }
Ejemplo n.º 12
0
        public void ShowMessage(string message, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            QMessageBox.StandardButton nativeButtons;
            QMessageBox.Icon           nativeIcon;
            switch (buttons)
            {
            case Moai.Platform.UI.MessageBoxButtons.OK:
                nativeButtons = QMessageBox.StandardButton.Ok;
                break;

            case Moai.Platform.UI.MessageBoxButtons.OKCancel:
                nativeButtons = QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Cancel;
                break;

            case Moai.Platform.UI.MessageBoxButtons.YesNo:
                nativeButtons = QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No;
                break;

            default:
                throw new NotSupportedException();
            }
            switch (icon)
            {
            case Moai.Platform.UI.MessageBoxIcon.None:
                nativeIcon = QMessageBox.Icon.NoIcon;
                break;

            case Moai.Platform.UI.MessageBoxIcon.Information:
                nativeIcon = QMessageBox.Icon.Information;
                break;

            case Moai.Platform.UI.MessageBoxIcon.Warning:
                nativeIcon = QMessageBox.Icon.Warning;
                break;

            case Moai.Platform.UI.MessageBoxIcon.Error:
                nativeIcon = QMessageBox.Icon.Critical;
                break;

            default:
                throw new NotSupportedException();
            }

            QMessageBox dialog = new QMessageBox(nativeIcon, title, message, (uint)nativeButtons, (Central.Manager.IDE as LinuxIDE));

            dialog.Show();
            //MessageDialog dialog = new MessageDialog((Central.Manager.IDE as LinuxIDE), DialogFlags.Modal, nativeIcon, nativeButtons, message);
            //dialog.Show();
        }
Ejemplo n.º 13
0
 void AddRosterItemComplete(object sender, IQ response, object data)
 {
     if (response.Type == IQType.set)
     {
         QApplication.Invoke(delegate {
             Gui.MainWindow.HideLightbox();
         });
     }
     else
     {
         QApplication.Invoke(delegate {
             QMessageBox.Critical(base.TopLevelWidget(), "Failed to add user", "Server returned an error.");
         });
     }
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Show Message Window
 /// </summary>
 public static void ShowMessage(QWidget parent, string title, string message, MessageType mt)
 {
     // Gui Message
     if (mt == MainClass.MessageType.Info)
     {
         QMessageBox.Information(parent, title, message);
     }
     else if (mt == MainClass.MessageType.Warning)
     {
         QMessageBox.Warning(parent, title, message);
     }
     else if (mt == MainClass.MessageType.Error)
     {
         QMessageBox.Critical(parent, title, message);
     }
 }
Ejemplo n.º 15
0
 void on_mucTree_activated(QModelIndex index)
 {
     if (index.IsValid())
     {
         if (index.InternalPointer() is BookmarkConference)
         {
             Account            account = (Account)index.Parent().InternalPointer();
             BookmarkConference conf    = (BookmarkConference)index.InternalPointer();
             try {
                 account.JoinMuc(conf.JID, conf.Password);
             } catch (UserException e) {
                 QMessageBox.Critical(this.TopLevelWidget(), "Synapse", e.Message);
             }
         }
     }
 }
Ejemplo n.º 16
0
        void ShowDemo(string name)
        {
            if (demoWidgetContainer.Layout.Count <= 1)
            {
                demoWidgetContainer.Layout.RemoveWidget(demoWidget);
                var demoTypeInfo = demoDictionary[name];
                demoWidget.Dispose();

                demoWidget = (BaseDemoWidget)Activator.CreateInstance(demoTypeInfo);
                demoWidgetContainer.Layout.AddWidget(demoWidget);
                demoWidgetContainer.Repaint();
            }
            else
            {
                var info = new QMessageBox(icon: QMessageBox.Icon.Critical, title: "Error", text: "Invalid number of demo widgets");
                info.Show();
            }
        }
Ejemplo n.º 17
0
        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);
                }
            }
        }
Ejemplo n.º 18
0
        void HandleAddAccountButtonClicked()
        {
            bool error = false;
            JID  jid   = null;

            if (!JID.TryParse(jidLineEdit.Text, out jid))
            {
                QMessageBox.Critical(this, "Problem saving account", "JID is invalid");
                error = true;
            }
            else if (String.IsNullOrEmpty(jid.User))
            {
                QMessageBox.Critical(this, "Problem saving account", "JID must have a username");
                error = true;
            }
            else if (String.IsNullOrEmpty(jid.Server))
            {
                QMessageBox.Critical(this, "Problem saving account", "JID must have a server");
                error = true;
            }
            else if (passwordLineEdit.Text.Trim() == String.Empty)
            {
                QMessageBox.Critical(this, "Problem saving account", "Password may not be blank");
                error = true;
            }
            else if (resourceComboBox.CurrentText.Trim() == String.Empty)
            {
                QMessageBox.Critical(this, "Problem saving account", "Resource may not be blank");
                error = true;
            }

            if (error)
            {
                return;
            }

            var accountInfo = new AccountInfo(jid.User, jid.Server, passwordLineEdit.Text, resourceComboBox.CurrentText);

            accountInfo.AutoConnect = autoConnectCheckBox.Checked;
            ServiceManager.Get <AccountService>().AddAccount(accountInfo);

            base.Accept();
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Save file contacts on file.
        /// </summary>
        private void SaveContactsFile()
        {
            QMessageBox mdlg = null;

            if (GlobalObjUI.ContactsFilePath != "")
            {
                mdlg = new QMessageBox(QMessageBox.Icon.Question,
                                       MainClass.AppNameVer + " - " + GlobalObjUI.LMan.GetString("savefileact"),
                                       GlobalObjUI.LMan.GetString("override") + "\r\n" +
                                       Path.GetFileNameWithoutExtension(GlobalObjUI.ContactsFilePath),
                                       0x00400400, this);

                int respType = mdlg.Exec();

                if (respType == 0x00000400)
                {
                    // override (Ok)
                    mdlg.Close();
                    mdlg.Dispose();
                    mdlg = null;

                    WriteContactsOnFile(GlobalObjUI.ContactsFilePath, GlobalObjUI.FileContacts.SimContacts);
                    return;
                }

                mdlg.Close();
                mdlg.Dispose();
                mdlg = null;
            }

            // select new file to save
            string fileToSave = ChooseFileToSave(GlobalObjUI.LMan.GetString("savefileact"));

            if (fileToSave == "")
            {
                // no file selected
                return;
            }

            WriteContactsOnFile(fileToSave, GlobalObjUI.FileContacts.SimContacts);
            GlobalObjUI.ContactsFilePath = fileToSave;
        }
Ejemplo n.º 20
0
        void on_buttonBox_clicked(QAbstractButton button)
        {
            try {
                var role = buttonBox.buttonRole(button);
                if (role == QDialogButtonBox.ButtonRole.AcceptRole)
                {
                    JID jid = new JID(jidLineEdit.Text);

                    // FIXME: Start spinner

                    m_Account.AddRosterItem(jid, nameLineEdit.Text, groupsWidget.SelectedGroups, AddRosterItemComplete);
                }
                else
                {
                    Gui.MainWindow.HideLightbox();
                }
            } catch (Exception ex) {
                QMessageBox.Critical(base.TopLevelWidget(), "Failed to add user", ex.Message);
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Are you sure dialog
        /// </summary>
        private bool DeleteContactQuestion()
        {
            QMessageBox mdlg = new QMessageBox(QMessageBox.Icon.Question,
                                               MainClass.AppNameVer + " - " + GlobalObjUI.LMan.GetString("delcontacts"),
                                               GlobalObjUI.LMan.GetString("suredelcontact"),
                                               (uint)QMessageBox.StandardButton.Yes |
                                               (uint)QMessageBox.StandardButton.No);

            int respType = mdlg.Exec();

            mdlg.Close();
            mdlg.Dispose();
            mdlg = null;

            if (respType == (uint)QMessageBox.StandardButton.Yes)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 22
0
        void HandleActivityLinkClicked(QUrl url)
        {
            try {
                Uri uri = new Uri(url.ToString());
                if (uri.Scheme == "http" || uri.Scheme == "https")
                {
                    Util.Open(uri.ToString());
                }
                else
                {
                    if (uri.Scheme == "xmpp")
                    {
                        JID jid   = new JID(uri.AbsolutePath);
                        var query = XmppUriQueryInfo.ParseQuery(uri.Query);
                        switch (query.QueryType)
                        {
                        case "message":
                            // FIXME: Should not ask which account to use, should use whichever account generated the event.
                            var account = Gui.ShowAccountSelectMenu(this);
                            if (account != null)
                            {
                                Gui.TabbedChatsWindow.StartChat(account, jid);
                            }
                            break;

                        default:
                            throw new NotSupportedException("Unsupported query type: " + query.QueryType);
                        }
                    }
                    else if (uri.Scheme == "activity-item")
                    {
                        string itemId = uri.AbsolutePath;
                        string action = uri.Query.Substring(1);
                        m_ActivityFeedItems[itemId].TriggerAction(action);
                    }
                }
            } catch (Exception ex) {
                Console.Error.WriteLine(ex);
                QMessageBox.Critical(null, "Synapse Error", ex.Message);
            }
        }
Ejemplo n.º 23
0
        public static Account ShowAccountSelectMenu(QWidget attachWidget)
        {
            AccountService accountService = ServiceManager.Get <AccountService>();

            if (accountService.ConnectedAccounts.Count == 0)
            {
                var widget = (attachWidget != null) ? attachWidget.TopLevelWidget() : Gui.MainWindow;
                QMessageBox.Critical(widget, "Synapse", "You are not connected.");
                return(null);
            }

            Account selectedAccount = null;

            if (accountService.ConnectedAccounts.Count > 1)
            {
                QMenu menu = new QMenu();
                menu.AddAction("Select Account:").SetDisabled(true);

                foreach (Account account in accountService.ConnectedAccounts)
                {
                    QAction action = menu.AddAction(account.Jid.ToString());
                    if (menu.ActiveAction() == null)
                    {
                        menu.SetActiveAction(action);
                    }
                }

                var     pos            = (attachWidget != null) ? attachWidget.MapToGlobal(new QPoint(0, attachWidget.Height())) : QCursor.Pos();
                QAction selectedAction = menu.Exec(pos);
                if (selectedAction != null)
                {
                    selectedAccount = accountService.GetAccount(new jabber.JID(selectedAction.Text));
                }
            }
            else
            {
                selectedAccount = accountService.ConnectedAccounts[0];
            }
            return(selectedAccount);
        }
Ejemplo n.º 24
0
    private void SaveGoogleSettings()
    {
        Config google_config = Conf.Get("GoogleBackends");

        google_config.SetOption("GMailSearchFolder",main.GMailSearchFolder.Text);

        string username = main.GoogleUsername.Text.Trim();

        if (username != String.Empty)
        {
            username = username + "@gmail.com";
            google_config.SetOption("GMailUsername",username);
        }

        if (main.IsGoogleAppsAccount.Checked)
        {
            google_config.SetOption("GoogleAppsAccountName",main.GoogleAppsAccountName.Text);
        }
        else
        {
            google_config.SetOption("GoogleAppsAccountName",String.Empty);
        }

        if (main.OptionStorePasswordConf.Checked)
        {
            google_config.SetOption("GMailPasswordSource","conf-file");
            google_config.SetOption("GMailPassword",main.GooglePassword.Text);
        }
        else if (main.OptionStorePasswordKWallet.Checked && !String.IsNullOrEmpty(username))
        {
            try {
                KdeUtils.StorePasswordKDEWallet("beagle",username,main.GooglePassword.Text);
                google_config.SetOption("GMailPasswordSource","kdewallet");
            } catch (ArgumentException e) {
                QMessageBox.Warning(this,"KDEWallet",e.Message);
            }
        }

        Conf.Save(google_config);
    }
Ejemplo n.º 25
0
        void HandleLinkClicked(QUrl url)
        {
            // We don't open arbitrary links for security reasons.
            var validSchemes = new [] { "http", "https", "ftp", "xmpp" };

            if (validSchemes.Contains(url.Scheme().ToLower()))
            {
                Util.Open(url);
            }
            else if (url.Scheme().ToLower() == "xmpp")
            {
                // FIXME: Add xmpp: uri handler.
                QMessageBox.Information(this.TopLevelWidget(), "Not implenented", "xmpp: uris not yet supported.");

                // Ignore # urls.
            }
            else if (!url.HasFragment())
            {
                QMessageBox.Information(this.TopLevelWidget(), "Link Fragment", url.HasFragment() + " " + url.Fragment());
                QMessageBox.Information(this.TopLevelWidget(), "Link URL", url.ToString());
            }
        }
Ejemplo n.º 26
0
        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);
                    }
                }
            }
        }
Ejemplo n.º 27
0
 private void mUnlockButton_Clicked()
 {
     using (var dialog = new PassphraseDialog()) {
         dialog.Exec();
         if (dialog.Result == (int)QDialog.DialogCode.Rejected)
         {
             return;
         }
         var passphrase = dialog.GetPassphrase();
         try {
             mAgent.Unlock(passphrase);
         } catch (AgentLockedException) {
             QMessageBox.Critical(this, Tr("Error"), Tr("Agent is already locked"));
             Debug.Fail("Unlock button should have been disabled");
         } catch (AgentFailureException) {
             QMessageBox.Critical(this, Tr("Agent Failure"),
                                  Tr("Possible causes:") +
                                  "<ul>" +
                                  "<li>" + Tr("Passphrase was incorrect") + "</li>" +
                                  "<li>" + Tr("Agent is already unlocked") + "</li>" +
                                  "<li>" + Tr("Agent does not support locking") + "</li>" +
                                  "</ul>"
                                  );
         } catch (Exception ex) {
             Debug.Fail(ex.ToString());
         }
     }
     if (mAgent is Agent)
     {
         UpdateUIState();
     }
     else
     {
         ReloadData();
     }
 }
Ejemplo n.º 28
0
 private void mRemoveAllButton_Clicked()
 {
     try {
         mAgent.RemoveAllKeys();
     } catch (AgentFailureException) {
         QMessageBox.Critical(this, Tr("Agent Failure"),
                              Tr("Possible causes:") +
                              "<ul>" +
                              "<li>" + Tr("Agent is locked") + "</li>" +
                              "<li>" + Tr("Agent does not support removing all keys") + "</li>" +
                              "</ul>"
                              );
     } catch (Exception ex) {
         Debug.Fail(ex.ToString());
     }
     if (mAgent is Agent)
     {
         UpdateUIState();
     }
     else
     {
         ReloadData();
     }
 }
Ejemplo n.º 29
0
        public AccountStatusWidget(Account account, RosterWidget parent, MainWindow parentWindow) : base(parent)
        {
            SetupUi();

            m_ParentWindow = parentWindow;

            m_EditProfileDialog = new EditProfileDialog(account, this.TopLevelWidget());

            m_AvatarLabel.Cursor   = new QCursor(CursorShape.PointingHandCursor);
            m_AvatarLabel.Clicked += delegate {
                if (m_Account.ConnectionState == AccountConnectionState.Connected)
                {
                    m_EditProfileDialog.Show(2);
                    m_EditProfileDialog.ActivateWindow();
                }
                else
                {
                    // FIXME: It really wouldn't be so hard to make this work.
                    // On connect, check to see if it was changed and update server.
                    QMessageBox.Warning(this.TopLevelWidget(), "Synapse", "Cannot edit avatar when you're not connected.");
                }
            };

            m_Account = account;
            m_Account.ConnectionStateChanged      += OnAccountStateChanged;
            m_Account.StatusChanged               += OnAccountStateChanged;
            m_Account.MyVCardUpdated              += HandleMyVCardUpdated;
            m_Account.AvatarManager.AvatarUpdated += HandleAvatarUpdated;
            OnAccountStateChanged(account);

            HandleAvatarUpdated(m_Account.Jid.Bare, null);

            HandleMyVCardUpdated(null, EventArgs.Empty);
            m_NameLabel.TextFormat = TextFormat.RichText;

            HandleAvatarUpdated(m_Account.Jid.Bare, m_Account.GetProperty("AvatarHash"));

            m_PresenceMenu = new QMenu(this);
            QObject.Connect(m_PresenceMenu, Qt.SIGNAL("aboutToShow()"), HandlePresenceMenuAboutToShow);
            QObject.Connect <QAction>(m_PresenceMenu, Qt.SIGNAL("triggered(QAction*)"), HandlePresenceMenuTriggered);

            QActionGroup group = new QActionGroup(this);

            group.Exclusive = true;

            m_AvailableAction = m_PresenceMenu.AddAction("Available");
            group.AddAction(m_AvailableAction);
            m_AvailableAction.Checkable = true;

            m_FreeToChatAction = m_PresenceMenu.AddAction("Free To Chat");
            group.AddAction(m_FreeToChatAction);
            m_FreeToChatAction.Checkable = true;

            m_AwayAction = m_PresenceMenu.AddAction("Away");
            group.AddAction(m_AwayAction);
            m_AwayAction.Checkable = true;

            m_ExtendedAwayAction = m_PresenceMenu.AddAction("Extended Away");
            group.AddAction(m_ExtendedAwayAction);
            m_ExtendedAwayAction.Checkable = true;

            m_DoNotDisturbAction = m_PresenceMenu.AddAction("Do Not Disturb");
            group.AddAction(m_DoNotDisturbAction);
            m_DoNotDisturbAction.Checkable = true;

            m_PresenceMenu.AddSeparator();

            m_OfflineAction = m_PresenceMenu.AddAction("Offline");
            group.AddAction(m_OfflineAction);
            m_OfflineAction.Checkable = true;
        }
Ejemplo n.º 30
0
    private void LoadGoogleSettings()
    {
        Config google_config = Conf.Get("GoogleBackends");

        main.GMailSearchFolder.Text = google_config.GetOption("GMailSearchFolder",null);

        string username = google_config.GetOption("GMailUsername",null);

        if (!username.EndsWith("@gmail.com"))
        {
            username = null;
        }
        else
        {
            main.GoogleUsername.Text = username.Remove(username.Length - 10);
        }

        string google_apps_domain = google_config.GetOption("GoogleAppsAccountName",null);

        if (google_apps_domain != null)
        {
            google_apps_domain = google_apps_domain.Trim();
        }
        if (String.IsNullOrEmpty(google_apps_domain))
        {
            main.IsGoogleAppsAccount.Checked = false;
            main.GoogleAppsAccountName.SetDisabled(true);
        }
        else
        {
            main.IsGoogleAppsAccount.Checked = true;
            main.GoogleAppsAccountName.SetDisabled(false);
            main.GoogleAppsAccountName.Text = google_apps_domain;
        }

        string password_source = google_config.GetOption("GMailPasswordSource","conf-file");

        if (password_source == "gnome-keyring")
        {
            QMessageBox.Critical(this,"Google password storage option","Gnome keyring support not available from beagle-settings-qt");
            return;
        }

        if (password_source == "kdewallet")
        {
            if (String.IsNullOrEmpty(username))
            {
                return;
            }

            try {
                string password = KdeUtils.ReadPasswordKDEWallet("beagle",username);
                main.GooglePassword.Text = password;
                main.OptionStorePasswordKWallet.SetChecked(true);
            } catch (ArgumentException e) {
                QMessageBox.Warning(this,"KDEWallet",e.Message);
            }
            return;
        }

        if (password_source != "conf-file")
        {
            QMessageBox.Warning(this,"Google password storage option","Unknown password storage option.");
            return;
        }

        main.GooglePassword.Text = google_config.GetOption("GMailPassword",null);
        main.OptionStorePasswordConf.SetChecked(true);
    }