diff --git a/src/main.cpp b/src/main.cpp index 8dc43c82..f6213b31 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,67 +1,69 @@ /* * * Copyright 2016 Riccardo Iaconelli * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License or (at your option) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #include #include #include "roommodel.h" #include "rocketchatbackend.h" #include "ruqola.h" +#include "ruqolautils.h" #include "notification.h" #include #include #include int main(int argc, char *argv[]) { QApplication app(argc, argv); app.setWindowIcon(QIcon(":/icons/systray.png")); QCoreApplication::setOrganizationName("KDE"); QCoreApplication::setOrganizationDomain("kde.org"); QCoreApplication::setApplicationName("Ruqola"); qmlRegisterSingletonType("KDE.Ruqola.Ruqola", 1, 0, "Ruqola", ruqola_singletontype_provider); + qmlRegisterSingletonType("KDE.Ruqola.RuqolaUtils", 1, 0, "RuqolaUtils", ruqolautils_singletontype_provider); qmlRegisterType("KDE.Ruqola.MessageModel", 1, 0, "MessageModel"); qmlRegisterType("KDE.Ruqola.DDPClient", 1, 0, "DDPClient"); qmlRegisterType("KDE.Ruqola.RoomModel", 1, 0, "RoomModel"); qmlRegisterType("KDE.Ruqola.RoomWrapper", 1, 0, "RoomWrapper"); RocketChatBackend c; QQmlApplicationEngine engine; QQmlContext *ctxt = engine.rootContext(); #if !defined(Q_OS_ANDROID) || !defined(Q_OS_IOS) qmlRegisterType("KDE.Ruqola.Notification", 1, 0, "Notification"); ctxt->setContextProperty("systrayIcon", Ruqola::self()->notification()); #endif // ctxt->setContextProperty("attachmentButton", Ruqola::self()->attachmentButtonClicked()); engine.load(QUrl(QStringLiteral("qrc:/Desktop.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); } diff --git a/src/ruqolautils.cpp b/src/ruqolautils.cpp index 87ad6c77..8bb2a46f 100644 --- a/src/ruqolautils.cpp +++ b/src/ruqolautils.cpp @@ -1,36 +1,44 @@ /* * * Copyright 2017 Riccardo Iaconelli * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License or (at your option) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #include "ruqolautils.h" +RuqolaUtils *RuqolaUtils::m_self = nullptr; RuqolaUtils::RuqolaUtils(QObject* parent) { } QString RuqolaUtils::markdownToRichText(const QString& markDown) { return QString(); } +RuqolaUtils* RuqolaUtils::self() +{ + if (!m_self) { + m_self = new RuqolaUtils; + } + return m_self; +}