• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kioslave

main.cpp

Go to the documentation of this file.
00001 /*
00002 This file is part of KDE
00003 
00004   Copyright (C) 1998-2000 Waldo Bastian (bastian@kde.org)
00005 
00006 Permission is hereby granted, free of charge, to any person obtaining a copy
00007 of this software and associated documentation files (the "Software"), to deal
00008 in the Software without restriction, including without limitation the rights
00009 to use, copy, modify, merge, publish, distribute, and/or sell
00010 copies of the Software, and to permit persons to whom the Software is
00011 furnished to do so, subject to the following conditions:
00012 
00013 The above copyright notice and this permission notice shall be included in
00014 all copies or substantial portions of the Software.
00015 
00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00017 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00018 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
00019 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00020 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00021 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00022 */
00023 
00024 #include <dcopclient.h>
00025 #include <kcmdlineargs.h>
00026 #include <klocale.h>
00027 #include <kapplication.h>
00028 
00029 static const char description[] =
00030     I18N_NOOP("HTTP Cookie Daemon");
00031 
00032 static const char version[] = "1.0";
00033 
00034 static const KCmdLineOptions options[] =
00035 {
00036  { "shutdown", I18N_NOOP("Shut down cookie jar"), 0 },
00037  { "remove <domain>", I18N_NOOP("Remove cookies for domain"), 0 },
00038  { "remove-all", I18N_NOOP("Remove all cookies"), 0 },
00039  { "reload-config", I18N_NOOP("Reload configuration file"), 0 },
00040  KCmdLineLastOption
00041 };
00042 
00043 extern "C" KDE_EXPORT int kdemain(int argc, char *argv[])
00044 {
00045    KLocale::setMainCatalogue("kdelibs");
00046    KCmdLineArgs::init(argc, argv, "kcookiejar", I18N_NOOP("HTTP cookie daemon"),
00047               description, version);
00048 
00049    KCmdLineArgs::addCmdLineOptions( options );
00050 
00051    KInstance a("kcookiejar");
00052    
00053    kapp->dcopClient()->attach();
00054 
00055    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
00056    QCString replyType;
00057    QByteArray replyData;
00058    if (args->isSet("remove-all"))
00059    {
00060       kapp->dcopClient()->call( "kded", "kcookiejar", "deleteAllCookies()", QByteArray(), replyType, replyData);
00061    }
00062    if (args->isSet("remove"))
00063    {
00064       QString domain = args->getOption("remove");
00065       QByteArray params;
00066       QDataStream stream(params, IO_WriteOnly);
00067       stream << domain;
00068       kapp->dcopClient()->call( "kded", "kcookiejar", "deleteCookiesFromDomain(QString)", params, replyType, replyData);
00069    }
00070    if (args->isSet("shutdown"))
00071    {
00072       QCString module = "kcookiejar";
00073       QByteArray params;
00074       QDataStream stream(params, IO_WriteOnly);
00075       stream << module;
00076       kapp->dcopClient()->call( "kded", "kded", "unloadModule(QCString)", params, replyType, replyData);
00077    }
00078    else if(args->isSet("reload-config"))
00079    {
00080       kapp->dcopClient()->call( "kded", "kcookiejar", "reloadPolicy()", QByteArray(), replyType, replyData);
00081    }
00082    else
00083    {
00084       QCString module = "kcookiejar";
00085       QByteArray params;
00086       QDataStream stream(params, IO_WriteOnly);
00087       stream << module;
00088       kapp->dcopClient()->call( "kded", "kded", "loadModule(QCString)", params, replyType, replyData);
00089    }
00090 
00091    return 0;
00092 }

kioslave

Skip menu "kioslave"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal