File indexing completed on 2024-04-28 16:52:27
0001 /* 0002 * SPDX-FileCopyrightText: 2022 by Devin Lin <devin@kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "recordutil.h" 0008 0009 #include <QFile> 0010 #include <QStandardPaths> 0011 0012 #include <KFileUtils> 0013 #include <KNotification> 0014 0015 RecordUtil::RecordUtil(QObject *parent) 0016 : QObject{parent} 0017 { 0018 } 0019 0020 QString RecordUtil::videoLocation(const QString &name) 0021 { 0022 QString path = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation); 0023 QString newPath(path + '/' + name); 0024 if (QFile::exists(newPath)) { 0025 newPath = path + '/' + KFileUtils::suggestName(QUrl::fromLocalFile(newPath), name); 0026 } 0027 return newPath; 0028 } 0029 0030 void RecordUtil::showNotification(const QString &title, const QString &text, const QString &filePath) 0031 { 0032 KNotification *notif = new KNotification("captured"); 0033 notif->setComponentName(QStringLiteral("plasma_phone_components")); 0034 notif->setTitle(title); 0035 notif->setUrls({QUrl::fromLocalFile(filePath)}); 0036 notif->setText(text); 0037 notif->sendEvent(); 0038 }