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 <QtDBus/QtDBus> 00025 #include <kcmdlineargs.h> 00026 #include <klocale.h> 00027 #include <kapplication.h> 00028 #include "kcookieserverinterface.h" 00029 #include "kdedinterface.h" 00030 00031 int main(int argc, char *argv[]) 00032 { 00033 KLocalizedString description = ki18n("HTTP Cookie Daemon"); 00034 00035 const char version[] = "1.0"; 00036 00037 KCmdLineArgs::init(argc, argv, "kcookiejar", "kdelibs4", ki18n("HTTP cookie daemon"), version, description); 00038 00039 KCmdLineOptions options; 00040 options.add("shutdown", ki18n("Shut down cookie jar")); 00041 options.add("remove <domain>", ki18n("Remove cookies for domain")); 00042 options.add("remove-all", ki18n("Remove all cookies")); 00043 options.add("reload-config", ki18n("Reload configuration file")); 00044 00045 KCmdLineArgs::addCmdLineOptions( options ); 00046 00047 KComponentData a("kio4"); 00048 00049 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 00050 00051 org::kde::KCookieServer *kcookiejar = new org::kde::KCookieServer("org.kde.kded", "/modules/kcookiejar", QDBusConnection::sessionBus()); 00052 if (args->isSet("remove-all")) 00053 { 00054 kcookiejar->deleteAllCookies(); 00055 } 00056 if (args->isSet("remove")) 00057 { 00058 QString domain = args->getOption("remove"); 00059 kcookiejar->deleteCookiesFromDomain(domain); 00060 } 00061 if (args->isSet("shutdown")) 00062 { 00063 org::kde::kded kded("org.kde.kded", "/kded", QDBusConnection::sessionBus()); 00064 kded.unloadModule("kcookiejar"); 00065 } 00066 else if(args->isSet("reload-config")) 00067 { 00068 kcookiejar->reloadPolicy(); 00069 } 00070 else 00071 { 00072 org::kde::kded kded("org.kde.kded", "/kded", QDBusConnection::sessionBus()); 00073 kded.loadModule("kcookiejar"); 00074 } 00075 delete kcookiejar; 00076 00077 return 0; 00078 }
KDE 4.6 API Reference