File indexing completed on 2024-06-16 06:57:02

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2020 David Faure <faure@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #include <QApplication>
0009 #include <QDebug>
0010 #include <QList>
0011 #include <QUrl>
0012 
0013 #include <KIO/OpenFileManagerWindowJob>
0014 
0015 int main(int argc, char **argv)
0016 {
0017     QApplication::setApplicationName(QStringLiteral("openfilemanagerwindowtest"));
0018     QApplication app(argc, argv);
0019 #ifndef Q_OS_WINDOWS
0020     const QList<QUrl> urls{QUrl(QStringLiteral("file:///etc/fstab")), QUrl(QStringLiteral("file:///etc/passwd"))};
0021 #else
0022     const QList<QUrl> urls{QUrl(QStringLiteral("file:///c:/windows/notepad.exe")), QUrl(QStringLiteral("file:///c:/windows/explorer.exe"))};
0023 #endif
0024 
0025     auto *job = new KIO::OpenFileManagerWindowJob();
0026     job->setHighlightUrls(urls);
0027     job->start();
0028 
0029     QObject::connect(job, &KJob::result, job, [&](KJob *job) {
0030         app.exit(job->error());
0031     });
0032 
0033     return app.exec();
0034 }