示例#1
0
 void on_textBrowser_anchorClicked(QUrl link)
 {
     if (link.ToString() == "#message-eric")
     {
         var account = Gui.ShowAccountSelectMenu(null);
         if (account != null)
         {
             Gui.TabbedChatsWindow.StartChat(account, new jabber.JID("*****@*****.**"));
         }
     }
 }
示例#2
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);
            }
        }
示例#3
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());
            }
        }
示例#4
0
 void on_webView_linkClicked(QUrl url)
 {
     RequestUrl(new Uri(url.ToString()));
 }