mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-04 14:55:43 +02:00
mainapplication: handle jami: URIs
Asking jami to launch another instance with ./jami-qt jami:xxx will search for "xxx" inside the application and select the conversation if found. This allow to support webpage with <a href="jami:username"> For GNU/Linux, in the .desktop file, x-scheme-handler/jami is added. For packaging, we will need to determine if the scheme is handled automatically. For now, to test, we need to add: x-scheme-handler/jami=jami-qt.desktop; in "~/.config/mimeapps.list" (and jami-qt.desktop) should be in a valid path. Change-Id: Ibbb6e8942f1873d81a57640bdf6f839885981be3 GitLab: #655
This commit is contained in:
parent
1b0b7c3fb7
commit
9c78604c1c
8 changed files with 35 additions and 1 deletions
|
@ -11,3 +11,4 @@ Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
Categories=Network;Telephony;
|
Categories=Network;Telephony;
|
||||||
Keywords=Qt;chat;talk;im;message;voip;
|
Keywords=Qt;chat;talk;im;message;voip;
|
||||||
|
MimeType=x-scheme-handler/jami;
|
|
@ -191,6 +191,10 @@ ApplicationWindow {
|
||||||
function onCloseRequested() {
|
function onCloseRequested() {
|
||||||
close(true)
|
close(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onSearchAndSelect(request) {
|
||||||
|
ConversationsAdapter.setFilterAndSelect(request)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
|
|
@ -308,6 +308,15 @@ ConversationsAdapter::onSearchResultUpdated()
|
||||||
searchSrcModel_->onSearchResultsUpdated();
|
searchSrcModel_->onSearchResultsUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ConversationsAdapter::onSearchResultEnded()
|
||||||
|
{
|
||||||
|
if (selectFirst_.exchange(false)) {
|
||||||
|
convModel_->select(0);
|
||||||
|
searchModel_->select(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ConversationsAdapter::onConversationReady(const QString& convId)
|
ConversationsAdapter::onConversationReady(const QString& convId)
|
||||||
{
|
{
|
||||||
|
@ -376,6 +385,13 @@ ConversationsAdapter::updateConversationFilterData()
|
||||||
set_filterRequests(false);
|
set_filterRequests(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ConversationsAdapter::setFilterAndSelect(const QString& filterString)
|
||||||
|
{
|
||||||
|
selectFirst_ = true;
|
||||||
|
setFilter(filterString);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ConversationsAdapter::setFilter(const QString& filterString)
|
ConversationsAdapter::setFilter(const QString& filterString)
|
||||||
{
|
{
|
||||||
|
@ -578,6 +594,12 @@ ConversationsAdapter::connectConversationModel()
|
||||||
&ConversationsAdapter::onSearchResultUpdated,
|
&ConversationsAdapter::onSearchResultUpdated,
|
||||||
Qt::UniqueConnection);
|
Qt::UniqueConnection);
|
||||||
|
|
||||||
|
QObject::connect(currentConversationModel,
|
||||||
|
&ConversationModel::searchResultEnded,
|
||||||
|
this,
|
||||||
|
&ConversationsAdapter::onSearchResultEnded,
|
||||||
|
Qt::UniqueConnection);
|
||||||
|
|
||||||
QObject::connect(currentConversationModel,
|
QObject::connect(currentConversationModel,
|
||||||
&ConversationModel::conversationReady,
|
&ConversationModel::conversationReady,
|
||||||
this,
|
this,
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
const QString& avatar,
|
const QString& avatar,
|
||||||
const VectorString& participants);
|
const VectorString& participants);
|
||||||
Q_INVOKABLE void setFilter(const QString& filterString);
|
Q_INVOKABLE void setFilter(const QString& filterString);
|
||||||
|
Q_INVOKABLE void setFilterAndSelect(const QString& filterString);
|
||||||
Q_INVOKABLE void ignoreFiltering(const QVariant& hightlighted);
|
Q_INVOKABLE void ignoreFiltering(const QVariant& hightlighted);
|
||||||
Q_INVOKABLE QVariantMap getConvInfoMap(const QString& convId);
|
Q_INVOKABLE QVariantMap getConvInfoMap(const QString& convId);
|
||||||
Q_INVOKABLE void restartConversation(const QString& convId);
|
Q_INVOKABLE void restartConversation(const QString& convId);
|
||||||
|
@ -93,6 +94,7 @@ private Q_SLOTS:
|
||||||
void onConversationCleared(const QString&);
|
void onConversationCleared(const QString&);
|
||||||
void onSearchStatusChanged(const QString&);
|
void onSearchStatusChanged(const QString&);
|
||||||
void onSearchResultUpdated();
|
void onSearchResultUpdated();
|
||||||
|
void onSearchResultEnded();
|
||||||
void onConversationReady(const QString&);
|
void onConversationReady(const QString&);
|
||||||
void onBannedStatusChanged(const QString&, bool);
|
void onBannedStatusChanged(const QString&, bool);
|
||||||
|
|
||||||
|
@ -106,4 +108,6 @@ private:
|
||||||
QScopedPointer<ConversationListProxyModel> convModel_;
|
QScopedPointer<ConversationListProxyModel> convModel_;
|
||||||
QScopedPointer<SearchResultsListModel> searchSrcModel_;
|
QScopedPointer<SearchResultsListModel> searchSrcModel_;
|
||||||
QScopedPointer<SelectableListProxyModel> searchModel_;
|
QScopedPointer<SelectableListProxyModel> searchModel_;
|
||||||
|
|
||||||
|
std::atomic_bool selectFirst_ {false};
|
||||||
};
|
};
|
||||||
|
|
|
@ -227,8 +227,8 @@ MainApplication::handleUriAction(const QString& arg)
|
||||||
} else if (!arg.isEmpty()) {
|
} else if (!arg.isEmpty()) {
|
||||||
uri = arg;
|
uri = arg;
|
||||||
qDebug() << "URI action invoked by secondary instance" << uri;
|
qDebug() << "URI action invoked by secondary instance" << uri;
|
||||||
|
Q_EMIT searchAndSelect(uri.replace("jami:", ""));
|
||||||
}
|
}
|
||||||
// TODO: implement URI protocol handling.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -95,6 +95,7 @@ public:
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void closeRequested();
|
void closeRequested();
|
||||||
|
void searchAndSelect(const QString& request);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initLrc(const QString& downloadUrl, ConnectivityMonitor* cm, bool logDaemon);
|
void initLrc(const QString& downloadUrl, ConnectivityMonitor* cm, bool logDaemon);
|
||||||
|
|
|
@ -502,6 +502,7 @@ Q_SIGNALS:
|
||||||
* Emitted when search result has been updated
|
* Emitted when search result has been updated
|
||||||
*/
|
*/
|
||||||
void searchResultUpdated() const;
|
void searchResultUpdated() const;
|
||||||
|
void searchResultEnded() const;
|
||||||
/**
|
/**
|
||||||
* Emitted when finish loading messages for conversation
|
* Emitted when finish loading messages for conversation
|
||||||
* @param loadingRequestId loading request id
|
* @param loadingRequestId loading request id
|
||||||
|
|
|
@ -2944,6 +2944,7 @@ ConversationModelPimpl::slotContactModelUpdated(const QString& uri)
|
||||||
searchResults.emplace_front(std::move(conversationInfo));
|
searchResults.emplace_front(std::move(conversationInfo));
|
||||||
}
|
}
|
||||||
Q_EMIT linked.searchResultUpdated();
|
Q_EMIT linked.searchResultUpdated();
|
||||||
|
Q_EMIT linked.searchResultEnded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Add table
Reference in a new issue