diff --git a/retroshare-gui/src/gui/ForumsDialog.cpp b/retroshare-gui/src/gui/ForumsDialog.cpp index 5776c7fa4..ff1847e68 100644 --- a/retroshare-gui/src/gui/ForumsDialog.cpp +++ b/retroshare-gui/src/gui/ForumsDialog.cpp @@ -26,7 +26,6 @@ #include #include "ForumsDialog.h" -#include "RetroShareLink.h" #include "forums/CreateForum.h" #include "forums/CreateForumMsg.h" #include "forums/ForumDetails.h" @@ -154,7 +153,6 @@ ForumsDialog::ForumsDialog(QWidget *parent) connect( ui.threadTreeWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( changedThread () ) ); connect( ui.threadTreeWidget, SIGNAL( itemClicked(QTreeWidgetItem*,int)), this, SLOT( clickedThread (QTreeWidgetItem*,int) ) ); connect( ui.viewBox, SIGNAL( currentIndexChanged ( int ) ), this, SLOT( changedViewBox () ) ); - connect( ui.postText, SIGNAL( anchorClicked(const QUrl &)), SLOT(anchorClicked(const QUrl &))); connect(ui.expandButton, SIGNAL(clicked()), this, SLOT(togglethreadview())); connect(ui.previousButton, SIGNAL(clicked()), this, SLOT(previousMessage())); @@ -200,9 +198,6 @@ ForumsDialog::ForumsDialog(QWidget *parent) forummenu->addSeparator(); ui.forumpushButton->setMenu(forummenu); - ui.postText->setOpenExternalLinks ( false ); - ui.postText->setOpenLinks ( false ); - /* create forum tree */ m_ItemFont = QFont("ARIAL", 10); m_ItemFont.setBold(true); @@ -1721,15 +1716,6 @@ void ForumsDialog::replytomessage() } } -void ForumsDialog::anchorClicked (const QUrl& link ) -{ - #ifdef FORUM_DEBUG - std::cerr << "ForumsDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl; - #endif - - RetroShareLink::processUrl(link, RSLINK_PROCESS_NOTIFY_ALL); -} - void ForumsDialog::filterRegExpChanged() { // QRegExp regExp(ui.filterPatternLineEdit->text(), Qt::CaseInsensitive , QRegExp::FixedString); diff --git a/retroshare-gui/src/gui/ForumsDialog.h b/retroshare-gui/src/gui/ForumsDialog.h index 8ea3c24b4..cb827ee8b 100644 --- a/retroshare-gui/src/gui/ForumsDialog.h +++ b/retroshare-gui/src/gui/ForumsDialog.h @@ -38,7 +38,6 @@ public: virtual void updateDisplay(); private slots: - void anchorClicked (const QUrl &); /** Create the context popup menu and it's submenus */ void forumListCustomPopupMenu( QPoint point ); void threadListCustomPopupMenu( QPoint point ); diff --git a/retroshare-gui/src/gui/ForumsDialog.ui b/retroshare-gui/src/gui/ForumsDialog.ui index 8383a7c2e..411706e53 100644 --- a/retroshare-gui/src/gui/ForumsDialog.ui +++ b/retroshare-gui/src/gui/ForumsDialog.ui @@ -1228,7 +1228,10 @@ border-image: url(:/images/closepressed.png) - false + true + + + true diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index b07cdb83f..bcbc23f98 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -25,6 +25,8 @@ #include #include #include +#include +#include #ifdef BLOGS #include "gui/unfinished/blogs/BlogsDialog.h" @@ -51,6 +53,7 @@ #include "bwgraph/bwgraph.h" #include "help/browser/helpbrowser.h" #include "chat/PopupChatDialog.h" +#include "RetroShareLink.h" #ifdef UNFINISHED #include "unfinished/ApplicationWindow.h" @@ -155,6 +158,9 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) setWindowTitle(tr("RetroShare %1 a secure decentralised communication platform").arg(retroshareVersion())); + /* add url handler for RetroShare links */ + QDesktopServices::setUrlHandler("retroshare", this, "linkActivated"); + // Setting icons this->setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png"))); @@ -1181,3 +1187,8 @@ void MainWindow::statusChangedComboBox(int index) /* no object known */ setStatus(NULL, statusComboBox->itemData(index, Qt::UserRole).toInt()); } + +void MainWindow::linkActivated(const QUrl &url) +{ + RetroShareLink::processUrl(url, RSLINK_PROCESS_NOTIFY_ALL); +} diff --git a/retroshare-gui/src/gui/MainWindow.h b/retroshare-gui/src/gui/MainWindow.h index 7cfe04c39..d0cf54384 100644 --- a/retroshare-gui/src/gui/MainWindow.h +++ b/retroshare-gui/src/gui/MainWindow.h @@ -196,6 +196,7 @@ private slots: void on_actionQuick_Start_Wizard_activated(); + void linkActivated(const QUrl &url); private: diff --git a/retroshare-gui/src/gui/MessagesDialog.cpp b/retroshare-gui/src/gui/MessagesDialog.cpp index 33a6e462b..7e617aa19 100644 --- a/retroshare-gui/src/gui/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/MessagesDialog.cpp @@ -33,7 +33,6 @@ #include "MessagesDialog.h" #include "msgs/MessageComposer.h" -#include "gui/RetroShareLink.h" #include "util/printpreview.h" #include "settings/rsharesettings.h" #include "util/misc.h" @@ -238,8 +237,6 @@ MessagesDialog::MessagesDialog(QWidget *parent) connect(ui.expandFilesButton, SIGNAL(clicked()), this, SLOT(togglefileview())); connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getallrecommended())); - connect( ui.msgText, SIGNAL( anchorClicked(const QUrl &)), SLOT(anchorClicked(const QUrl &))); - connect(ui.actionTextBesideIcon, SIGNAL(triggered()), this, SLOT(buttonstextbesideicon())); connect(ui.actionIconOnly, SIGNAL(triggered()), this, SLOT(buttonsicononly())); connect(ui.actionTextUnderIcon, SIGNAL(triggered()), this, SLOT(buttonstextundericon())); @@ -256,8 +253,6 @@ MessagesDialog::MessagesDialog(QWidget *parent) connect(ui.ccText, SIGNAL(linkActivated(QString)), this, SLOT(linkActivated(QString))); connect(ui.bccText, SIGNAL(linkActivated(QString)), this, SLOT(linkActivated(QString))); - ui.msgText->setOpenLinks(false); - m_eListMode = LIST_NOTHING; mCurrCertId = ""; @@ -1844,13 +1839,6 @@ void MessagesDialog::printpreview() preview->show(); } -void MessagesDialog::anchorClicked (const QUrl& link ) -{ - std::cerr << "MessagesDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl; - - RetroShareLink::processUrl(link, RSLINK_PROCESS_NOTIFY_ALL); -} - bool MessagesDialog::fileSave() { if (fileName.isEmpty()) diff --git a/retroshare-gui/src/gui/MessagesDialog.h b/retroshare-gui/src/gui/MessagesDialog.h index 118fca555..51f727be0 100644 --- a/retroshare-gui/src/gui/MessagesDialog.h +++ b/retroshare-gui/src/gui/MessagesDialog.h @@ -87,8 +87,6 @@ private slots: void emptyTrash(); - void anchorClicked (const QUrl &); - void getcurrentrecommended(); void getallrecommended(); diff --git a/retroshare-gui/src/gui/MessagesDialog.ui b/retroshare-gui/src/gui/MessagesDialog.ui index 916cffcb0..4cfce3fc7 100644 --- a/retroshare-gui/src/gui/MessagesDialog.ui +++ b/retroshare-gui/src/gui/MessagesDialog.ui @@ -1303,6 +1303,9 @@ padding: 4px; true + + true + diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index 5201bc50d..717a8814b 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -135,7 +135,6 @@ PeersDialog::PeersDialog(QWidget *parent) connect( ui.actionSet_your_Avatar, SIGNAL(triggered()), this, SLOT(getAvatar())); connect( ui.actionSet_your_Personal_Message, SIGNAL(triggered()), this, SLOT(statusmessage())); connect( ui.addfileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile())); - connect( ui.msgText, SIGNAL(anchorClicked(const QUrl &)), SLOT(anchorClicked(const QUrl &))); connect(ui.actionAdd_Friend, SIGNAL(triggered()), this, SLOT(addFriend())); connect(ui.action_Hide_Offline_Friends, SIGNAL(triggered()), this, SLOT(insertPeers())); @@ -227,9 +226,6 @@ PeersDialog::PeersDialog(QWidget *parent) ui.menupushButton->setMenu(menu); - //ui.msgText->setOpenExternalLinks ( false ); - //ui.msgText->setOpenLinks ( false ); - setAcceptDrops(true); ui.lineEdit->setAcceptDrops(false); @@ -1868,15 +1864,6 @@ void PeersDialog::fileHashingFinished(AttachFileItem* file) setFont(); } -void PeersDialog::anchorClicked (const QUrl& link ) -{ - #ifdef PEERS_DEBUG - std::cerr << "PeersDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl; - #endif - - RetroShareLink::processUrl(link, RSLINK_PROCESS_NOTIFY_ALL); -} - void PeersDialog::dropEvent(QDropEvent *event) { if (!(Qt::CopyAction & event->possibleActions())) diff --git a/retroshare-gui/src/gui/PeersDialog.h b/retroshare-gui/src/gui/PeersDialog.h index b46ff18f8..393c860f5 100644 --- a/retroshare-gui/src/gui/PeersDialog.h +++ b/retroshare-gui/src/gui/PeersDialog.h @@ -155,7 +155,6 @@ private slots: void loadmypersonalstatus(); void addExtraFile(); - void anchorClicked (const QUrl &); void addAttachment(std::string); bool fileSave(); diff --git a/retroshare-gui/src/gui/PeersDialog.ui b/retroshare-gui/src/gui/PeersDialog.ui index f839627e7..77278324b 100644 --- a/retroshare-gui/src/gui/PeersDialog.ui +++ b/retroshare-gui/src/gui/PeersDialog.ui @@ -721,9 +721,6 @@ background: white;} 200 - - 200 - Friends @@ -958,7 +955,7 @@ background: white;} true - false + true diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp index 52934e578..bd25be315 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp @@ -126,7 +126,6 @@ PopupChatDialog::PopupChatDialog(const std::string &id, const QString &name, QWi connect(ui.actionSave_Chat_History, SIGNAL(triggered()), this, SLOT(fileSaveAs())); connect(ui.actionClearOfflineMessages, SIGNAL(triggered()), this, SLOT(clearOfflineMessages())); - connect(ui.textBrowser, SIGNAL(anchorClicked(const QUrl &)), SLOT(anchorClicked(const QUrl &))); connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&, int)), this, SLOT(updateStatus(const QString&, int))); connect(NotifyQt::getInstance(), SIGNAL(peerHasNewCustomStateString(const QString&, const QString&)), this, SLOT(updatePeersCustomStateString(const QString&, const QString&))); @@ -138,9 +137,6 @@ PopupChatDialog::PopupChatDialog(const std::string &id, const QString &name, QWi // Create the status bar resetStatusBar(); - //ui.textBrowser->setOpenExternalLinks ( false ); - //ui.textBrowser->setOpenLinks ( false ); - ui.textboldButton->setIcon(QIcon(QString(":/images/edit-bold.png"))); ui.textunderlineButton->setIcon(QIcon(QString(":/images/edit-underline.png"))); ui.textitalicButton->setIcon(QIcon(QString(":/images/edit-italic.png"))); @@ -1002,7 +998,7 @@ void PopupChatDialog::fileHashingFinished(AttachFileItem* file) message+= RetroShareLink(QString::fromUtf8(file->FileName().c_str()),file->FileSize(),QString::fromStdString(file->FileHash())).toHtmlSize(); #ifdef CHAT_DEBUG - std::cerr << "PopupChatDialog::anchorClicked message : " << message.toStdString() << std::endl; + std::cerr << "PopupChatDialog::fileHashingFinished message : " << message.toStdString() << std::endl; #endif std::wstring msg = message.toStdWString(); @@ -1013,16 +1009,6 @@ void PopupChatDialog::fileHashingFinished(AttachFileItem* file) } } -void PopupChatDialog::anchorClicked (const QUrl& link ) -{ -#ifdef CHAT_DEBUG - std::cerr << "PopupChatDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl; -#endif - - std::list srcIds; - RetroShareLink::processUrl(link, RSLINK_PROCESS_NOTIFY_ALL); -} - void PopupChatDialog::dropEvent(QDropEvent *event) { if (!(Qt::CopyAction & event->possibleActions())) diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.h b/retroshare-gui/src/gui/chat/PopupChatDialog.h index d6600b6ba..97e80a073 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.h +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.h @@ -71,7 +71,6 @@ public slots: void resetStatusBar() ; void updateStatusTyping() ; void updateStatusString(const QString& peer_id, const QString& statusString) ; - void anchorClicked (const QUrl &); void updateStatus(const QString &peer_id, int status); diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.ui b/retroshare-gui/src/gui/chat/PopupChatDialog.ui index ba8dfe264..77188f292 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.ui +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.ui @@ -751,7 +751,7 @@ p, li { white-space: pre-wrap; } true - false + true