• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KIOSlave

  • kioslave
  • http
  • kcookiejar
main.cpp
Go to the documentation of this file.
1/*
2This file is part of KDE
3
4 Copyright (C) 1998-2000 Waldo Bastian (bastian@kde.org)
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22*/
23
24#include <QtDBus/QtDBus>
25#include <kcmdlineargs.h>
26#include <klocale.h>
27#include <kapplication.h>
28#include "kcookieserverinterface.h"
29#include "kdedinterface.h"
30
31int main(int argc, char *argv[])
32{
33 KLocalizedString description = ki18n("HTTP Cookie Daemon");
34
35 const char version[] = "1.0";
36
37 KCmdLineArgs::init(argc, argv, "kcookiejar", "kdelibs4", ki18n("HTTP cookie daemon"), version, description);
38
39 KCmdLineOptions options;
40 options.add("shutdown", ki18n("Shut down cookie jar"));
41 options.add("remove <domain>", ki18n("Remove cookies for domain"));
42 options.add("remove-all", ki18n("Remove all cookies"));
43 options.add("reload-config", ki18n("Reload configuration file"));
44
45 KCmdLineArgs::addCmdLineOptions( options );
46
47 KComponentData a("kio4");
48
49 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
50
51 org::kde::KCookieServer *kcookiejar = new org::kde::KCookieServer("org.kde.kded", "/modules/kcookiejar", QDBusConnection::sessionBus());
52 if (args->isSet("remove-all"))
53 {
54 kcookiejar->deleteAllCookies();
55 }
56 if (args->isSet("remove"))
57 {
58 QString domain = args->getOption("remove");
59 kcookiejar->deleteCookiesFromDomain(domain);
60 }
61 if (args->isSet("shutdown"))
62 {
63 org::kde::kded kded("org.kde.kded", "/kded", QDBusConnection::sessionBus());
64 kded.unloadModule("kcookiejar");
65 }
66 else if(args->isSet("reload-config"))
67 {
68 kcookiejar->reloadPolicy();
69 }
70 else
71 {
72 org::kde::kded kded("org.kde.kded", "/kded", QDBusConnection::sessionBus());
73 kded.loadModule("kcookiejar");
74 }
75 delete kcookiejar;
76
77 return 0;
78}
KCmdLineArgs
KCmdLineArgs::isSet
bool isSet(const QByteArray &option) const
KCmdLineArgs::init
static void init(const KAboutData *about)
KCmdLineArgs::parsedArgs
static KCmdLineArgs * parsedArgs(const QByteArray &id=QByteArray())
KCmdLineArgs::addCmdLineOptions
static void addCmdLineOptions(const KCmdLineOptions &options, const KLocalizedString &name=KLocalizedString(), const QByteArray &id=QByteArray(), const QByteArray &afterId=QByteArray())
KCmdLineArgs::getOption
QString getOption(const QByteArray &option) const
KCmdLineOptions
KCmdLineOptions::add
KCmdLineOptions & add(const KCmdLineOptions &options)
KComponentData
KLocalizedString
version
static const char version[]
Definition: http_cache_cleaner.cpp:65
kapplication.h
kcmdlineargs.h
klocale.h
ki18n
KLocalizedString ki18n(const char *msg)
main
int main(int argc, char *argv[])
Definition: main.cpp:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIOSlave

Skip menu "KIOSlave"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal