File indexing completed on 2024-07-21 12:42:31

0001 /*
0002 
0003  * SPDX-FileCopyrightText: 2017 Riccardo Iaconelli <riccardo@kde.org>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.0-or-later
0006  *
0007  */
0008 
0009 #include "ruqolautils.h"
0010 #include "ruqola_debug.h"
0011 #include "utils.h"
0012 #include <QDesktopServices>
0013 #include <QUrl>
0014 
0015 RuqolaUtils::RuqolaUtils(QObject *parent)
0016     : QObject(parent)
0017 {
0018 }
0019 
0020 RuqolaUtils::~RuqolaUtils() = default;
0021 
0022 RuqolaUtils *RuqolaUtils::self()
0023 {
0024     static RuqolaUtils s_self;
0025     return &s_self;
0026 }
0027 
0028 QString RuqolaUtils::extractRoomUserFromUrl(const QString &url)
0029 {
0030     return Utils::extractRoomUserFromUrl(url);
0031 }
0032 
0033 void RuqolaUtils::openUrl(const QString &url)
0034 {
0035     const QUrl clickedUrl = QUrl::fromUserInput(url);
0036     if (!QDesktopServices::openUrl(clickedUrl)) {
0037         qCWarning(RUQOLA_LOG) << "Impossible to open " << clickedUrl;
0038     }
0039 }
0040 
0041 #include "moc_ruqolautils.cpp"