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

KIOSlave

  • sources
  • kde-4.12
  • kdelibs
  • kioslave
  • http
  • kcookiejar
main.cpp
Go to the documentation of this file.
1 /*
2 This file is part of KDE
3 
4  Copyright (C) 1998-2000 Waldo Bastian (bastian@kde.org)
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 CONNECTION 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 
31 int 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::addCmdLineOptions
static void addCmdLineOptions(const KCmdLineOptions &options, const KLocalizedString &name=KLocalizedString(), const QByteArray &id=QByteArray(), const QByteArray &afterId=QByteArray())
kapplication.h
KCmdLineOptions::add
KCmdLineOptions & add(const QByteArray &name, const KLocalizedString &description=KLocalizedString(), const QByteArray &defaultValue=QByteArray())
ki18n
KLocalizedString ki18n(const char *msg)
KCmdLineArgs::parsedArgs
static KCmdLineArgs * parsedArgs(const QByteArray &id=QByteArray())
KCmdLineArgs
QString
klocale.h
KCmdLineArgs::isSet
bool isSet(const QByteArray &option) const
kcmdlineargs.h
version
unsigned int version()
KCmdLineArgs::init
static void init(int argc, char **argv, const QByteArray &appname, const QByteArray &catalog, const KLocalizedString &programName, const QByteArray &version, const KLocalizedString &description=KLocalizedString(), StdCmdLineArgs stdargs=StdCmdLineArgs(CmdLineArgQt|CmdLineArgKDE))
KCmdLineArgs::getOption
QString getOption(const QByteArray &option) const
main
int main(int argc, char *argv[])
Definition: main.cpp:31
KCmdLineOptions
KLocalizedString
KComponentData
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:58 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



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