Commit 4b7fb639 authored by Martin Klapetek's avatar Martin Klapetek Committed by Alexander Akulich
Browse files

[declarative] If autostarted by MC, signal the incoming channel as requested one

parent 1ff5498d
......@@ -80,6 +80,11 @@ MainLogModel::MainLogModel(QObject *parent)
Tp::AbstractClientHandler(channelClassList()),
m_observerProxy(new ObserverProxy(this))
{
QCommandLineParser parser;
parser.process(qApp->arguments());
m_openIncomingChannel = parser.isSet(QStringLiteral("openIncomingChannel"));
const QString dbLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/ktp-mobile-logger/");
connect(qApp, &QCoreApplication::aboutToQuit, this, [=]() {
......@@ -406,8 +411,9 @@ void MainLogModel::handleChannel(const Tp::AccountPtr &account, const Tp::TextCh
}
}
if (channel->isRequested()) {
if (channel->isRequested() || m_openIncomingChannel) {
Q_EMIT newRequestedChannel(contactIndex);
m_openIncomingChannel = false;
}
}
}
......
......@@ -133,6 +133,13 @@ private:
Tp::AccountManagerPtr m_accountManager;
ObserverProxy *m_observerProxy;
// This is true when mission control autostarted the app
// on an incoming channel; the model will emit newRequestedChannel()
// for the first incoming channel even though it was not requested
// This is useful to switch the application directly to the new
// message
bool m_openIncomingChannel;
friend class ObserverProxy;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment