Messagelib
7 #include "openurlwithmanager.h"
9 #include <KConfigGroup>
10 #include <KSharedConfig>
12 using namespace MessageViewer;
15 static const char myOpenUrlWithGroupName[] =
"OpenUrlWith";
17 OpenUrlWithManager::OpenUrlWithManager(
QObject *parent)
23 OpenUrlWithManager::~OpenUrlWithManager() =
default;
25 OpenUrlWithManager *OpenUrlWithManager::self()
27 static OpenUrlWithManager s_self;
31 void OpenUrlWithManager::clear()
33 mOpenWithUrlInfo.clear();
36 void OpenUrlWithManager::loadSettings()
38 mOpenWithUrlInfo.clear();
45 for (
int i = 0; i < openWithUrls.
count(); ++i) {
47 info.setCommand(commands.
at(i));
48 info.setUrl(openWithUrls.
at(i));
49 if (i < commandLines.
count()) {
50 info.setCommandLine(commandLines.
at(i));
52 mOpenWithUrlInfo.append(info);
56 void OpenUrlWithManager::saveRules()
63 const auto nbElement{mOpenWithUrlInfo.
count()};
64 openWithUrls.
reserve(nbElement);
66 for (
int i = 0; i < nbElement; ++i) {
67 commands.
append(mOpenWithUrlInfo.at(i).command());
68 openWithUrls.
append(mOpenWithUrlInfo.at(i).url());
69 commandLines.
append(mOpenWithUrlInfo.at(i).commandLine());
71 group.writeEntry(
"Urls", openWithUrls);
72 group.writeEntry(
"Commands", commands);
73 group.writeEntry(
"CommandLines", commandLines);
90 return mOpenWithUrlInfo;
95 mOpenWithUrlInfo = newOpenWithUrlInfo;
void append(const T &value)
The OpenWithUrlInfo class.
int count(const T &value) const const
static KSharedConfig::Ptr openConfig(const QString &fileName=QString(), OpenFlags mode=FullConfig, QStandardPaths::StandardLocation type=QStandardPaths::GenericConfigLocation)
const T & at(int i) const const
KSharedConfigPtr config()
QString host(QUrl::ComponentFormattingOptions options) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Apr 1 2023 04:01:57 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.